6

I know that the following will work:

hdiutil attach old.sparsebundle -mountroot .
diskutil rename old_label new_label
hdiutil detach old_label
hdiutil attach old.sparsebundle -mountroot .

This results in old_label being mounted as new_label, but it's inelegant to mount it to rename it and then to unmount it and remount it for the label to take effect.

Is there another way?

eatloaf
  • 607
  • 1
  • 9
  • 16
  • 1
    I *frequenty* accidentally rename my root from "`MacHD`" to "` `" when I try to use quicklook to see how much free space I have, so the answer is probably yes, wouldn't know how to do it from a command prompt though. – James Nov 13 '11 at 11:38
  • eatloaf is trying to figure out how to rename an unmounted image without mounting it, not how to rename a mounted image without unmounting it. @eatloaf, i spent some time today trying to figure this out myself (well, something similar … i was having trouble renaming an image at all until i figured out i was mounting it at / via sudo then trying to rename it without sudo), and all pointers i found routed me through attaching and renaming. of course, if you know ahead of time the volname, you can hdiutil -create -volname new_label, but that's annoying. it implies a name can be changed … grrr… – john.k.doe Jul 22 '12 at 18:00

0 Answers0