12

On Mac OS X 10.6.7, when I mount a sparse disk image (either by double-clicking it or using hdid from the command line), the image:

  • Appears on my desktop
  • Needs to be re-mounted every time I log in

I'd like to set up the equivalent of an /etc/fstab which will mount the image when the system boots, and make it permanent - so I don't have to worry if my symbolic links will resolve or not.

Is this more trouble than it's worth on a Mac? I noticed that there is no /etc/fstab, and /etc/fstab.hd contains a dire warning:

IGNORE THIS FILE.
This file does nothing, contains no useful data, and might go away in
future releases.  Do not depend on this file or its contents.

I tried sudo hdid -notremovable <image>, which seemed like half of what I wanted (according to man hdid), but it failed with an error: hdid: attach failed - no mountable file systems.

1
  • When you add -nomount, you at least get a device. But I haven't been able to mount that yet.
    – Daniel Beck
    Commented Jun 26, 2011 at 8:22

1 Answer 1

11

The attach failed - no mountable file systems error seems to be a known bug of the -notremovable option to the hdid or hdiutil command respectively (see "hdituil -notremovable fails to mount disk image", https://discussions.apple.com/thread/2639671).

As a workaround, try adding your sparse disk image to System Preferences -> User Accounts -> Log in Items.

Yet another approach would be to write a launch daemon that mounts the sparse disk image at boot time (optionally for all users).

For a step-by-step guide in this respect see: http://wiki.ninjafocus.net/Mac_Mount_Points

3
  • Thanks for the links. Too bad the "Mac Mount Points" wiki solution only worked for 10.5. I guess I'll go with the "Log in Items" workaround for now.
    – mpontillo
    Commented Jun 27, 2011 at 8:51
  • 1
    +1 for launchd since you can control the mount to happen before a user logs in if desired.
    – bmike
    Commented Jul 5, 2011 at 13:17
  • The option System Preferences -> User Accounts -> Log in Items is now moved to System Settings -> General -> Login Items. Add the disk image to Open at Login list. Commented Nov 23, 2023 at 8:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .