Personal tools
You are here: Home Articles How To Move Your Mac Home Directory To A Seperate Partition

How To Move Your Mac Home Directory To A Seperate Partition

This article explains how to configure your Mac to store user data on a separate partition.

One 'best practice' in computing, particularly in the Unix/Linux world is that of using multiple partitions or multiple hard disks to separate sets of data.  A partition is a logical division of your hard disk drive.  You may also have multiple disks with one more more partitions on them.  Even if you have one disk, that shows up as as a single volume on your Mac, that one volume is still one partition.  Usually though, the term partitioning is used to refer to dividing one disk into multiple sections, called volumes in OS X.  This use of the term partitioning may be likened to erecting walls to partition a large room into various sections for different purposes. 

Partitioning schemes are determined by your purpose in partitioning.  For example you may partition for the sake of data security.  If you spread your data across multiple partitions or disks, you are less likely to loose everything in the case of hard disk corruption.  Having your operating system and your data on separate partitions also makes replacing/reinstalling your operating system easier.  You will be able to do so without backing up your data since your data would already be on a separate volume/partition than your operating system.

With the foregoing in mind, this how-to will explain how to partition your Mac, installing Mac OS X on one partition, while placing user data on another partition.  However, the principles also apply to a situation in which you wish to move your user data to an entirely different hard drive, such as an external drive on your laptop, or a secondary internal drive on your desktop.  If you only wish to move your data to a second drive or to an existing volume you may skip to the section "Moving Your User Directory".

Partitioning Your Hard Drive


Partitioning your hard drive will destroy all data.  So before doing so, backup all your data.  Partitioning is best done before you start using your machine, that way you don't have any data to worry about backing up.  There are programs that offer you the ability to partition your hard drive without losing your data.  This is called non-destructive partitioning, or resizing.  However, I have been unable to find any programs that are free.

If your hard drive is smaller than 6GB, partitioning may not be worth your while.  Mac OS X requires 4GB for a full install.  That would leave a measly 2GB for your data.  This is not to say that you should not partition, but it may be better to just get an additional hard drive, put Mac OS X on the smaller one, and use the bigger one for user data.

Here are the steps to partition your hard drive:
  1. Boot from your OS X DVD or CD 1. 
  2. When the installer starts go to the Utilities menu.
  3. Choose Disk Utility.
  4. Choose the drive you wish to partition.
  5. From the tabs to the right, choose the one titled Partition.
  6. Below the label that says Volume Scheme choose a partitioning scheme.  For the purpose of separating your operating system from your data, two partitions are sufficient.
  7. Adjust the partition sizes depending on the size of your hard drive.  Allow at least 5 Gigabytes for OS X.
  8. Under Volume Information, name the partition for your operating system "Mac OS X".  And name the volume for your data "Data".  This will help you to identify them easily later.
  9. Unless you have reasons not to, accept the default format: Mac OS Extended (Journaled)
  10. Next, click the Partition button.
  11. When the partitioning process is complete, close the Disk Utility and continue with the installation.
  12. When the installer prompts you for the volume to install Mac OS X on, choose the partition you named Mac OS X.
  13. Complete the installation process.

When your installation is complete and your have restarted your Mac and logged in, you should see two volumes on the desktop: Mac OS X and Data.  You have completed the partitioning, and the first step in separating your data from your operating system.

Moving Your User Directory


Mac OS X stores user data in the Users directory/folder located at the root level of your OS X volume.  This step involves moving that directory to a new partition, renaming (and eventually deleting) the old one, and then telling OS X to look for the Users directory at its new location.  All of this can be done with a few commands issued via the Terminal:

  1. Launch the Terminal.  The Terminal application can be found in Applications -> Utilities -> Terminal.
  2. Change your working directory to the root of your Mac OS X volume:
    cd /
  3. Copy the Users directory to its new location.  The following command will copy your users' directories to the root of the specified partition or volume:
    sudo ditto /Users /Volumes/Data/
  4. Rename the old one until you are ready to delete it:
    sudo mv /Users /Users.old
  5. Tell OS X to look for the Users directory in its new location by creating a symlink:
    sudo ln -s /Volumes/Data Users

The last step was the creation of a symbolic link (symlink for short).  This step is the key ingredient in this recipe.  A symlink directs the operating system to look for a file or directory in another location.  The ability to symlink comes from Mac OS X's Unix core.  A symlink is similar to what Mac users know as Aliases.  However, making an alias for this step would not work since the OS X Unix core would not understand an Alias.  However, the Unix core and all the Mac stuff on top observe and obey sysmlinks.

Test If It Works!


At this point, you can test that your modifications have worked by logging out and logging back in.  After your re-login Mac OS X will use the Users directory that you moved to the Data partition.  The easiest way to confirm that this is the case is to open the Data volume and see if your home directory located in the Users folder appears with a house icon.  This icon identifies that directory as your active home directory.  If this worked, then you may now delete your old Users directory with the following terminal command:
rm -rf /Users.old

Congratulations!  You have successfully moved your data to a separate partition.
Document Actions
Google
OpenID Log in