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

Click here to return to the '10.5: Mount a partition or volume on demand' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.5: Mount a partition or volume on demand
Authored by: mmnw on Aug 12, '09 08:57:57AM

Your solution will only work for disks connected at startup, not for USB, Firewire or external SATA devices connected afterwards. Also, the device will be mounted, and then unmounted. I don't know, but eventually OS X will work on the drive before the unmount command is executed (i.e. TimeMachine or Spotlight).

I should also add: you can only use the /dev/disk** part with internal drives, not with externals. The reason being the actual disk number may change depending on the port the disk is connected to and the order in which the disks are connected.

You can use the /Volume/Partition_Name for unmounting (I have tested it). But what you should use is the UUID of the partition, which can be determined with diskutil info.

Also, you probably shouldn't use hdiutil (I know, it works ...), but diskutil as this hint suggests. hdiutil was made to manage disk images (like a dmg), diskutil to manage actual disks. Read the man hdiutil and man diskutil for further information.

So the command would actually look like this:

/usr/bin/diskutil unmount UUID-number

[ Reply to This | # ]
10.5: Mount a partition or volume on demand
Authored by: pub3abn on Aug 12, '09 12:46:55PM

Thanks, that was helpful.

In my case, I am unmounting a partition of an internal drive. I don't know about Spotlight, but it seems that Time Machine is only active when a user is logged in. In any case, we've never had any problems with corruption or failure to unmount, and I've been using that unmount technique for probably a year or more. But if I get around to tinkering with it again, I may try the alternate command you suggested.

[ Reply to This | # ]
10.5: Mount a partition or volume on demand
Authored by: mmnw on Aug 13, '09 03:27:00AM

I also am not sure if it can cause problems. Guess it won't. Since you are unmounting it grafecully without force.
But it could take longer than not mounting it at all. I'm pretty sure spotlight starts it's indexing process even if no user is logged in. Also I don't know if spotlight is already running at this point of boot.
So in the end, it's just a matter of elegance. Not mounting seems more "right" to me than mounting/unmounting ;)

[ Reply to This | # ]