Benches Uncategorized

11

mounting sparse bundle disk image prior to login

apple Verified

Imported from the Apple Support Forums via the Wayback Machine 🔗

Is it possible to mount a sparse bundle disk image prior to login (i.e at the login window)?

11 replies

Sign in or join Beachball Help to reply.

  1. 0

    Apple Support Community member

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Try creating a loginhook which calls the diskutil mount command.

    (33246)

  2. 0

    Apple Support Community member

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    you mean hdiutil mount not diskutil mount, right?
    I'll try a login hook. I did try a launch daemon using Lingon and it refused to run.

  3. 0

    Apple Support Community member

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    nope, doesn't work.

  4. 0

    Apple Support Community member

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    What about using your shell's dot files to call hdiutil? For bash, the .profile is read at each login. You can add script in that file to execute what you want.

  5. 0

    Apple Support Community member

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    glsmith wrote:
    What about using your shell's dot files to call hdiutil? For bash, the .profile is read at each login.

    My .bash_profile runs whenever a new shell window is opened, so this may not be an idea solution.

    --
    Cole

  6. 0

    Apple Support Community member

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    those are only run once you've logged in and started a shell.

  7. 0

    Apple Support Community member

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Would be relatively easy to detect a mounted image and do nothing in that case...

  8. 0

    Apple Support Community member

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Oh, right you are. Too bad the "login hooks" didn't work, that seems like exactly what you want...

  9. 0

    Apple Support Community member

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    I wrote a simple C program which uses system to run the hdiutil attach command on a sparse bundle I created. After compiling, I added the executable to my Login startup items. Now at login, my sparse bundle is automatically mounted.

    There seem to be some downsides. For one, it appears that the loginwindow daemon or maybe launchd itself still holds a reference open inside the mounted image. This means you have to use "unmount -f" to unmount it, or just use "hdiutil detach". Also, running the binary from the Startup Items is done via terminal, so that is launched at login time and it leaves a window open after it's done (even though my settings say never to leave a window open after a process exits).

    Perhaps these are minor issues though. At least, I can have the image mounted at login time...

  10. 0

    Apple Support Community member

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    I think you are missing the real problem here. Mounting a disk image upon login is easy and not a problem. what I wanted was a way to have it mounted before any user is logged in, i.e at the login window. actually I no longer need it. I wanted it for [this thread|http://discussions.apple.com/message.jspa?messageID=7477721#7477721] because the person there wanted to keep users home directories inside sparse bundles. Of course,such a bundle needs to be mounted before a person can log in. biovizier told me how to accomplish that. Thanks for the input anyway.

    Message was edited by: V.K.

  11. 0

    Apple Support Community member

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Oh, ok. Yes, I was missing the point...