September 2, 2010

Alternatives for separating the OS X users' home directories

Most OS X installations you'll find, probably use just one partition per disk. This may be convenient, but coming from years on Unix/Linux, that's a no-go for me... We can do better...
So, let's see how we can get the users' home directories on a separate partition ("Volume" in Mac OS X parlance) or disk.

You might be asking why? and what is that good for?
Well, having /Users on a separate partition makes it easier to backup and manage your installation, and if you ever want to reinstall your OS, your data will remain untouched (For a more in-depth description of considerations, check out my post on Multiple Partitions on OS X - Pros and Cons).

This will also be beneficial for owners of SSDs, as it allows them to have the OS and applications on the SSD, and user data on a hard disk drive.


Alternatives

There are several ways of separating a user's home folder:

Option 1: Using System Preferences|Accounts

Right-click on a user's icon, select 'Advanced', and change the user's "Home Directory".
Nice and easy... But we have to do it for each user (and when we add new users, we have to remember to do it again).
Worse yet, some applications insist on looking for the user's home directory under /Users...

Option 2: "Symlinking" /Users to the new partition

A hackish way of doing it...
Just create a symbolic-link (shortcut) from /Users to point to the new partition.
While this works, we still have to deal with mounting the new volume.

But there's a "cleaner" way... The Unix Way...

Option 3: Mount the new partition on /Users

Sysadmins' delight !
We'll modify the /etc/fstab file so the new partition is mounted on /Users.


You probably guessed it... I prefer The Unix Way

I'll explain this in detail How to move the OS X /Users to a separate partition in the next post.

5 comments:

  1. I found online, so I'm not sure it's true that changing the /Users folder location on osx is not advisable because updates can have problems if Users is not under root. And in general packages use the default Users location under root.
    Have you experienced some of this problems with your method?
    Thanks for sharing your ideas anyway.

    ReplyDelete
  2. @scrax: That's exactly the reason why I prefer not to use Option 1 above.

    Similarly, applications might fail in case it's a symbolic-link (softlink)...
    That's why I discarded Option 2.

    This leaves us with Option 3, which, for all practical matters, is identical to leaving /Users under root...

    As for your question...
    No, I haven't experienced any kind of problems with this Option 3, and that's what I use.

    ReplyDelete
  3. Thank's for your reply and explanations. I'll try Option 3 and report here if I found any issue. :)

    ReplyDelete
  4. I got a bit impulsive and went with Option 1, before I saw this post... Is there an easy way to switch between Option 1 and 3? My setup is a 60GB SSD and a 400GB for Users.

    Also, my startup volume seems to be Read Only, is there any connection there between?

    ReplyDelete
  5. @bb: Unless you understand the rationale behind each step in option 3, I'd recommend you to revert to default, and then follow my guide.

    As for your start-up volume being read-only, this is probably due to permissions. Only Administrators should be able to write there.

    ReplyDelete