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: sjk on Aug 12, '09 01:17:26PM
diskutil list
returned

#: TYPE NAME SIZE IDENTIFIER 
... 
3: Microsoft Basic Data Windows 48.9 Gi disk0s3
...
So a little tinkering might be necessary depending on filesystem type.
It can also be necessary to consider whitespace in partition/volume names under the NAME field, e.g. Macintosh HD for this line:
   2:                  Apple_HFS Macintosh HD            54.9 Gi    disk0s3
And you have to be careful matching names that have the same pre-whitespace prefix. For example, with Boot, Boot i386, Boot ppc volume names the awk '/Boot/' command will match all three when the intention may be to match Boot.

I consider my workarounds for whitespace issues too icky for posting here. Eventually I'll write (or find) a nicer diskutil list output parser/matcher to handle them.

[ Reply to This | # ]
10.5: Mount a partition or volume on demand
Authored by: tedw on Aug 12, '09 01:31:23PM
And you have to be careful matching names that have the same pre-whitespace prefix. For example, with Boot, Boot i386, Boot ppc volume names the awk '/Boot/' command will match all three when the intention may be to match Boot.
I hadn't considered this, either, but since it's regular expressions it's not too difficult to resolve. if you have multiple volumes with similar names (like your boot, boot i3686, boot ppc) all you need to do is space-pad the regexp; i.e. use /boot / or /boot {3,}/ with a large enough number of spaces to exclude other names. diskutil will always output with space padding (so you don't need to worry about other whitespace), and the regexp won't match shorter names, so this should do the trick.

good point, thank you.

[ Reply to This | # ]

10.5: Mount a partition or volume on demand
Authored by: sjk on Aug 12, '09 02:18:30PM

That's my thinking on it, too. I'm just not code-savvy enough to quickly bang out a clean script. :)



[ Reply to This | # ]