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 09:03:51AM

I'd like to add something:

You don't need to determine the dev_id of the drive. Since you already know the UUID of the partition for the first part of the hint you can also use the UUID to mount the partition. Just use

#! /bin/bash
/usr/bin/diskutil mount UUID

where UUID is this weird long number assigned to the partition, which you can get, btw, by typing

diskutil info /Volume/PartitionName


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

the main problem is that UUIDs only apply (so far as I can tell) to volumes formatted with HFS and HFS+. Windows-compatible volumes don't seem to have them, and I don't know about NFS or other formats (since I haven't made any to test). if you're only working with Apple file systems, then yes, UUIDs are certainly better and easier, but I don't think it generalizes.



[ Reply to This | # ]
10.5: Mount a partition or volume on demand
Authored by: tedw on Aug 12, '09 01:18:36PM
ah, wait, I see what you're saying: since you've already but the LABEL or UUID into the fstab file, then you might as well just put it directly into diskutil's mount command without searching for it, right? The reason I did it this way, though, is to handle cases where the script gets run while the disk isn't mounted: the dev_id variable will be the null string if the disk is not there, and so the script will fail gracefully. I don't know what will happen if you ask diskutil to mount a volume on a non-present drive; probably nothing, but... point taken.

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

You are absolutely right, FAT and NTF volumes don't have a UUID. Didn't consider this. This will make the first part of the hint pretty hard with external volumes. Anyone know what to use in fstab instead of UUID?
(Don't say /dev/disk** since this will only work with fixed internal drives).



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

Oh, I'm sorry ... didn't read the first part right. Of course you use the LABEL of the drive ...



[ Reply to This | # ]
10.5: Mount a partition or volume on demand
Authored by: woodgie on Aug 13, '09 01:10:49AM

There's a small typo, it should read:

diskutil info /Volumes/PartitionName

Add an s at the end of Volume.



[ Reply to This | # ]