Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I have a encrypted sparsebundle and I want to mount to to a folder in my home directory and not under /Volumes. How can I do that?

share|improve this question

3 Answers 3

up vote 10 down vote accepted

The hdiutil command-line utility gives you more flexibility, and is extensively documented in man hdiutil. Something like this should do:

hdiutil attach -mountpoint ~/myMountPoint mySparsebundle.dmg
share|improve this answer
    
can this be made persistent across reboots? –  Erik Allik Dec 24 '12 at 9:28
    
@ErikAllik yes - but why not ask a general unstinted how to run a shell script at boot time (before a user logs in) or after a user logs in. –  bmike Dec 24 '12 at 14:11

hdiutil attach /Volumes/ATimeMachine/Pictures/iPhoto\ Library.sparsebundle -mountpoint ~/iPho

/dev/disk3 Apple_partition_scheme
/dev/disk3s1 Apple_partition_map
/dev/disk3s2 Apple_Driver43
/dev/disk3s3 Apple_Driver43
/dev/disk3s4 Apple_Driver_ATA
/dev/disk3s5 Apple_Driver_ATA
/dev/disk3s6 Apple_FWDriver
/dev/disk3s7 Apple_Driver_IOKit
/dev/disk3s8 Apple_Patches
/dev/disk3s9 Apple_HFS /Users/me/iPho

where "iPhoto Library.sparsebundle" is on a DroboFS (NAS) and is a 500G "hard disk" image formatted MacOS HFS journaled

Running the hdiutil command mounts the image under my home directory. I tired to mount it on top of the original iPhoto Library, but the original was still visible in there after mounting, so I changed the name of the mount point to "iPho" instead. Then I decided it didn;t really matter where the mount point was, it would be fine under /Volumes as long as iPhoto.app knows where it is.

Option click iPhoto.app to launch it with a prompt to create a new library, and I did that in the mounted disk image. Then import all photos (previously managed with Picasa under a ~/Pictures directory tree) on my hard drive into iPhoto, which copies them into the mounted image, which resides on the NAS where it has some fault tolerance because of the DroboFS. This also frees up half the space on my small 500G SSD drive in the Macbook Air.

share|improve this answer

You might also be interested in http://blog.marc-seeger.de/2011/02/06/encrypted-diskimages-in-osx/ which explains step by step how to set up auto-mount to the specified mount point:

  • run mount to identify the disk device (/dev/diskNsN usually)
  • run diskutil info /dev/diskNsn | grep UUID to get the UUID
  • use sudo vifs to add a line to /etc/fstab

    UUID=whatever-you-noted-before /path/to/mountpoint hfs rw 1 0
    
  • Add your disk image to your login items to have it automatically mounted on /path/to/mountpoint on your next login

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.