Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Unmount a volume at startup' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Unmount a volume at startup
Authored by: TigerKR on Jun 15, '05 12:58:23AM

A word of caution:

You have absolutely no assurance that what was /dev/disk1s2 (for example) one day will still be /dev/disk1s2 the next time you boot.

Character device description files (such as /dev/rdisk0s10) are created at boot time and do not survive a shutdown. Unless the boot volume is a CD, disk0 should contain the boot volume, but all other numbers cannot be assumed to remain stable.



[ Reply to This | # ]
Unmount a volume at startup
Authored by: jkhong on Jun 15, '05 02:04:28AM

Hi TigerKR, thanks for taking the time to caution users about the potential problems with /etc/fstab and changing device ids. I found your comments describing the issue deeper to be very helpful.

Other readers might want to read up TigerKR's comments describing the situation.



[ Reply to This | # ]
Unmount a volume at startup
Authored by: jitterbugboy on Jun 15, '05 03:49:27PM

assuming that the drive numbers are dynmaic, you can unmount using the partition name like this

/usr/sbin/diskutil unmount /Volumes/Emergency/

where Emergency is the name of a partition I would rather unmount.



[ Reply to This | # ]
Unmount a volume at startup
Authored by: bdm on Jun 15, '05 07:33:54PM

It is not true that disk0 is always the boot disk. Mine is disk1 right now. I'm guessing that the startup code assigns numbers in some sort of hardware order: my two internal hard disks are numbered in the order that they appear on the ATA bus and the numbering was constant over many restarts. However, you are right in that we shouldn't assume anything not clearly documented. The solution is to use the mount point name, as jitterbugboy suggested. So the diskutil line in the original hint can be changed to

/usr/sbin/diskutil unmount "/Volumes/Whateveritscalled"

I knew there were possible solutions using fstab and similar, but fiddling with things like that will just give trouble at the next OS upgrade.

Brendan.

[ Reply to This | # ]
Unmount a volume at startup
Authored by: TigerKR on Jun 15, '05 11:56:07PM

You're absolutely right. Looking now at df my boot drive is /dev/disk2s12



[ Reply to This | # ]
Unmount a volume at startup
Authored by: g00ner on Jun 18, '05 06:11:08AM

Many thanks for this tip guys it works well.

After reading through this thread and looking at the 'man diskutil' commands in Terminal I've now modified the script slightly by using 'eject' rather than 'unmountDisk'. This works better for me as It now also stops my LaCie FW drive's fan (which is noisier than my G4 MDD!)

Many thanks for all the info.

g00ner.



[ Reply to This | # ]