Tag Archives: umount

[MacOS] Chameleon On USB: Mounting USB Stick Correctly

Inserting USB sticks to your Mac OS X based system makes Mac OS X mount the stick without assigning certain permissions like owners, or groups.

I. How things get mounted on Mac OS

The mount command on the terminal returns most likely some lines, like that:

  • testuser$ mount
  • /dev/disk0s2 on / (hfs, local, journaled)
    devfs on /dev (devfs, local, nobrowse)
    map -hosts on /net (autofs, nosuid, automounted, nobrowse)
    map auto_home on /home (autofs, automounted, nobrowse)
    /dev/disk3s1 on /Volumes/CHAMBOOT (hfs, local, nodev, nosuid, journaled, noowners)
    /dev/disk1s4 on /Volumes/Mac OS X Install DVD (hfs, local, nodev, nosuid, noowners)

You can see quite a lot of slices (i.e. ~partitions) are mounted to that system I am running here. For instance disk1s4 is the forth slice of disk1 and it countains an image of a Mac OS X Install DVD. And you can see a CHAMBOOT named drive mounted with several options.

II. Mount Options/Permissions

Our beloved USB stick named CHAMBOOT (contains Chameleon and) is disk3s1 and is mounted to /Volumes/CHAMBOOT. Mac OS handles USB mounting for most of our every day life operations fairly reliable. But this comes at a cost, as this simplicity is achieved here by applying options like nosuid and noowners during the mount process.

For people willing to run Chameleon from a USB stick permissions are inevitable, as for instance an Extensions.mkext kextcache can only be generated with proper file permissions being set.

II. Mounting USB with permissions

This just requires some simple mount operations being performed manually on the terminal. Do the following:

  • testuser$ sudo -s
    Become ultimate root now.
  • testuser$ cd
    Get back to the home folder whereever you’ve been before.
  • testuser$ sync
    Force completion of pending disk writes.
  • testuser$ umount -f /Volumes/CHAMBOOT
    This unmounts the USB stick called CHAMBOOT
  • testuser$ mkdir chamboottemp
    Create a temporary folder for our mounting session
  • testuser$ mount_hfs /dev/disk3s1 chamboottemp/
    Mount the USB stick to the temporary folder
  • testuser$ mount
    See how the drives are mounted now
  • /dev/disk0s2 on / (hfs, local, journaled)
    devfs on /dev (devfs, local, nobrowse)
    map -hosts on /net (autofs, nosuid, automounted, nobrowse)
    map auto_home on /home (autofs, automounted, nobrowse)
    /dev/disk3s1 on /Users/admin/chamboottemp (hfs, local, journaled)
    /dev/disk1s4 on /Volumes/Mac OS X Install DVD (hfs, local, nodev, nosuid, noowners)
    You can see the USB stick is now mounted without “extra” options.

Now you can apply changes to the USB stick’s files in the proper manner (like copying files, repairing permissions and creating a kextcache). After having performed all the changes, you can correctly unmount. Read here:

III. Manually Unmounting

  • testuser$ cd
    Get back to the home folder whereever you’ve been before.
  • testuser$ umount -f chamboottemp
    Force to unmount the device mounted to the chamboottemp folder now.
  • testuser$ rmdir chamboottemp
    It is safe to delete the chamboottemp folder now.

IV. Links

» Mac OS X Reference Library: Man Page for “sync”
» Mac OS X Reference Library: Man Page for “mount”
» AsereBln.BlogSpot.com: Some terminal work