Creating a shared home partition between Linux and Mac OS X

Dual-booting operating systems can be very convenient, but with it brings the troubles of trying to keep data synchronized between the operating systems. Sure, in most cases Linux can read/write to partitions, but something even more convenient than that is a partition that both operating systems use for userdata. This guide overviews the procedure on how to set this up between Mac OS X and Linux.

Mac OS X

Boot off your OS X installation disk. Start up Disk Utility, and create three partitions: an HFS+ Journaled volume for OS X, an HFS+ non-journaled volume which will become your shared partition, and finally a third partition of type "free space". (You actually have to create a third partition, otherwise the other two fill up the remaining space.)

Proceed through the rest of the OS X installation. Once you've booted into your new OS X installation, start up Terminal and type sudo nano /etc/fstab, enter your password, and you should be presented with an empty text file. Add the following to it:

/dev/disk0s2 /Users hfs rw 0 1

Replace disk0s2 with the name of your partition. If you're unsure, run diskutil list at the command prompt first. Once you've entered that, save and exit.

Go back to the command line. Enable the root account by typing the following:

sudo passwd root

Enter a new password and confirm it. Now that you've enabled it, quit everything and log out of your account. You should see another option, "Other user" and the login screen. Click this, and you should be presented with another login screen. Type in root for username, and the password that you previously entered for the root account.

Now that you're logged into the superuser account, open a new terminal window. Move your home folder to the new partition with the following command:

mv "/Users/*" "/Volumes/Untitled 1"

Replace "Untitled 1" with the name of your shared home partition. If you're unsure, look at your desktop; it should be mounted there.

Now you need to delete the contents of /Users so that it will be a clean mount point. Run this to delete everything in /Users:

rm -rf /Users/*

Reboot your computer, and try logging in from your main account. If everything went okay, your user account is now running off of the shared partition.


Start by creating one or two partitions in the free space left over by the OS X installer. Then install rEFIt so that you can sync the MBR to the GPT. Install Linux, and make sure it works the way you want it. Make sure your kernel has HFS+ support, if you're not sure, check the config files (usually in /boot). You might end up having to recompile your kernel to add HFS+ support.

Once you've done that, log in as root and run the following at the command prompt (if the root account isn't enabled, re-enable it with sudo su like we did in earlier in Mac OS X):

chpass username

replacing username with your username. It should bring up a list of stuff you can edit. Change UID to 501, then save and exit. The reason you need to do this is because the UID on the default user on Mac OS X is 501, and if the UIDs aren't synchronized, you're going to run into some file permission issues between the two operating systems.

Next, you need to edit your /etc/fstab file. Run the following command again:

nano /etc/fstab

Now add the following line to the text file (add it somewhere near the end):

/dev/sda2 /home hfsplus defaults 0 1

Save and exit. The last thing you need to do is clean up the /home mount point:

rm -rf /home/*

Log out, reboot, and both operating systems should now be sharing the same home folder.