Saturday, December 10, 2016

Moving OS X Users to a separate partition

Moving OS X Users to a separate partition


After considering the Alternatives for separating the OS X users home directories, I decided to use a separate partition.
In this post, Ill explain in detail how to use a separate partition ("Volume" in Mac OS X parlance) for /Users.

While the actual procedure is not difficult, it involves several steps.
  • First, well rename /Users to /UsersOld, and well create a new /Users directory that will serve as the mount-point for our new partition
  • Then we have to edit the /etc/fstab to instruct OS X to automatically mount (that is, make it accessible) the new partition on /Users
  • Afterward, well "move" the contents of our /UsersOld folder into its new place.
  • Lastly, we might want to tweak the set-up a bit to make it look, as much as possible, as a regular installation


Mac OS X, being a Unix system, has the almighty root user. However, on OS X Snow Leopard, its disabled by default.
As well be using the root account for this procedure, check Apples support article on root if yours is not enabled.


Throughout the rest of this guide, well also be using the Terminal.
Ill be marking the commands to be typed in bold, as follows:
# echo you type this you type this #

Getting Ready

  • Make sure all your users (if any) are logged-out
  • Login as root
  • Launch the Terminal

Renaming the /Users directory

Now well move our current /Users folder aside, so we can set-up a new one for our mount-point.
# mv /Users /UsersOld #

Setting up the new /Users mount-point

Well now prepare the new /Users Mount-Point.
This is as simple as creating a Folder, and setting correct ownership and permissions.
# mkdir /Users # chown root:admin /Users # chmod 755 /Users #

Identifying the Partition

Mac OS X identifies each partition by a UUID (Universal Unique Identifier).
Well need the UUID to instruct OS X to automatically mount the partition in the next step, so lets gather it.
  • Open Disk Utility
  • Find the partition you wish to use as /Users, right-click it and select Information (or hit CmdKeyi)
  • Select the value of Universal Unique Identifier, and copy it (CmdKeyc)
  • Close the information window
  • If the partition is mounted, right-click on it, and Unmount it

Setting up auto-mounting of /Users

Its time to instruct Mac OS X how to mount our new /Users partition.
Being a Unix-based system, this can be done by editing the /etc/fstab file.
  • Before editing this file, it might be wise to save a backup of the original one.
    # touch /etc/fstab # cp /etc/fstab /etc/fstab.orig #
  • Launch TextEdit (or, if you are familiar with the vi text editor, you can use vifs)
    # open -a TextEdit /etc/fstab #
  • The TextEdit window opens (probably with an empty file if you havent already edited it)
  • Make sure its in plain text format (if not, select from the Format menu the "Make Plain Text" option)
  • Append the following line at the end of the file:
    UUID=TheValueYouCopiedAbove /Users hfs auto

    After editing, your file should look similar to:
    UUID=84BA91DE-C37F-F13D-B5C9-FECA5184DEB7 /Users hfs auto
  • Save the file and Quit TextEdit

Mounting the new /Users for the first time

At this stage, our /etc/fstab file is ready, and, on the next boot, Mac OS X should be able to automatically mount our /Users partition.
Lets verify that it can be mounted, as expected, on /Users.
  • In Disk Utility, find the partition you designated for /Users, right-click it and select mount
  • The new /Users Volume should appear in Finder (and in the Desktop if you selected that in your Finders Preferences)

As we want to keep the same level of permissions as we had before the move, well make sure file ownership is preserved.
  • In Finder, locate the Users Volume, right-click on it and select Get Info (or hit CmdKeyi)
  • Verify that the Ignore ownership on this volume is NOT checked.
If you prefer, this can also be done from the Terminal, as follows:
# diskutil enableOwnership /Users #

Moving the home directories contents to the new /Users partition

With our partition mounted, and permissions properly set, its time to move all users home directories to the new partition
Note that depending on the size of your users home directories, the mv command below might take quite a while to complete
# mv /UsersOld/* /UsersOld/.[^.]* /Users/ # rmdir /UsersOld #

We can now reboot and verify the /Users is correctly mounted !
At this time, all our users home directories are in the new partition, and as we instructed OS X to mount it automatically (via the /etc/fstab file), it should be accessible just as before.
... But dont uncork the champagne yet !

Final tweaks

You wouldnt notice its been relocated, except for a couple of details:
  1. The familiar Users folder icon has been replaced by a disk icon,
  2. If youve set your finder preferences to show the hard disks on the desktop, /Users is also shown there.

We can fix these two easily:

Fixing the icon

Fixing the icon is as simple as Fixing the Orange HardDisk Icons, however, instead of using the Internal.icns file, well be using the UsersFolderIcon.icns file found in /System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/

If you prefer, this can also be done from the Terminal, as follows:
# cp /System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/UsersFolderIcon.icns /Users/.VolumeIcon.icns #

Hiding the /Users icon

If you dont want the Users Volume to appear as a separate one (eg. on the Desktop, or finders sidebar), well append an option to the line we added in /etc/fstab.
The option is nobrowse, and well add it immediately after auto, separated by a comma.
  • Launch TextEdit (or, if you are familiar with the vi text editor, you can use vifs)
    # open -a TextEdit /etc/fstab #
  • The TextEdit window opens with contents similar to this:
    UUID=84BA91DE-C37F-F13D-B5C9-FECA5184DEB7 /Users hfs auto
  • Change auto so it reads auto,nobrowse, as follows:
    UUID=84BA91DE-C37F-F13D-B5C9-FECA5184DEB7 /Users hfs auto,nobrowse
  • Save the file and Quit TextEdit
On the next reboot (actually, on the next mount), the Users icon will no longer appear on the Desktop or in Finder as a separate disk.

Caveats (Update 15-Nov-2010):
There are a couple of side-effects to hiding the /Users folder that make this a less-than-optimal solution:
  • Browsing /Users over the network is complicated
  • It will be hidden in the Time Machine "space" interface too, so its tricky to restore files or folders.
    Showing hidden files is a way around this, but it clutters all Finder windows, and restores the /Users desktop icon (Defeating the purpose of nobrowse).
Given these two limitations I stopped using the nobrowse option.
I can live with that /Users icon on my Desktop !

Now... Wheres that champagne !

Available link for download