Jump to content

Using a separate partition or hard drive for your Users folder


mcsmart
 Share

4 posts in this topic

Recommended Posts

This guide will show you how to use a separate partition or hard drive for storing ALL of your personal information, settings and data. Sure you could define separate places for let's say your music library in iTunes, but still some settings will remain in your home directory.

 

Now I want to show you how you can put your entire Users folder (all users' home directories) on a separate partition. This approach might not be new to Linux users, because on Linux this is a pretty common task.

 

The benefits of this approach are:

  • separate your data from your system drive
  • in case you reinstall the OS you'll keep all of your data (including E-Mails, contacts and calendars) and application settings (IM accounts, ...)
  • if your system partition fails, you won't loose your data

What you need:

  • a running Mac OS X Leopard (or higher)
  • experience with the command line and vim (no noob questions please, this is an advanced thing!)
  • an empty disk (recommended) or partition

Warning: This is only intended for advanced users. You have to know what you are doing. Backup your data before continuing!

 

OK, let's start:

  • first of all you have to format the drive or partition
    • in case you want to use an entire drive for this, use the GUID partition scheme
    • in case you want to do this with a separate partition make sure it has enough space

    [*]create an HFS+ filesystem (journal recommended) on the partition/drive

    [*]the volume label should be "Users"

Now we have a partition we can use. The interesting stuff starts now:

  1. Enable the root user: (noobs: please stop here - this is nothing for you!)
    • Go to Applications -> Utilities and open Terminal Services
    • make sure the settings are unlocked
    • click Edit -> Enable root User and enter a strong password
    • close Terminal Services

[*]Now log out and back log in as root

[*]Get the UUID of the partition you have just created or formatted

  • to get the UUID simply open Disk Utility (if you have not already done so), select the partition and click "Info"
  • select the UUID and copy it

[*]now open a Terminal window

  • Backup your current /Users folder
    mv /Users /Users.bak
    mkdir /Users


  • Now we have to edit fstab:
    vifs


  • press "i" (insert) and paste the following line at the end of the file:
    UUID=03A99002-AF11-30A9-AA69-CDC59ACCABCD	   /Users  hfs	 auto,rw		 1 0


  • of course you have to replace 03A99002-AF11-30A9-AA69-CDC59ACCABCD with your actual partition UUID
  • quit by hitting escape and entering ":wq"
  • Your system should now mount /Users on the next boot

[*]Try it by rebooting and logging in back as root

[*]Open Terminal again

[*]Verify that your partition was mounted at /Users (NOT /Volumes/Users):

mount

[*]now you can copy your user data to the fresh /Users partition:

cp -R /Users.bak/yourusername /Users
cp -R /Users.bak/Shared /Users
touch /Users/.localized

[*]At this point everything is set up. Close Terminal, repair permissions on / with Disk Utility and logout.

You can now try to log on with your regular user account. If everything pops up as usual you have done everything correctly.

 

When you want to reinstall your OS you just need to repeat the steps and you'll get all you user data back :). Of couse the username and uid needs to stay the same. If that changes you'll have to rename your home directory and chown it.

 

 

Have fun :)

Link to comment
Share on other sites

Oh, my, there is an easier way already built into OSX.

  • Create a partition/volume and name it "Users" (actually, it can be named anything you like)
  • Make a folder on Users for each user
  • Copy the user's data to his folder on "Users"
  • Now for the shortcut:



    1. Open "System Preferences"
    2. Select "Accounts"
    3. Unlock the "Lock"
    4. Control-click (or right-click) on the user's name
    5. Select "Advanced Options"
    6. Enter a new "Home Directory" path like: /Volumes/Users/<some-user-name>  (the UUID will take care of itself)
    7. Click "OK"
    8. Close "System Preferences"
    9. Reboot or log out/log in

Done

 

Don't forget the apps which download to your Downloads folder all need to be changed, because the path to your Downloads folder has changed:

It used to be: /Users/<some-user-name>/Downloads (which really means: /Volumes/<your-MacOSX volume-name>/Users/<some-user-name>/Downloads)

 

Now it is: /Volumes/Users/<some-user-name>/Downloads

Link to comment
Share on other sites

Oh, my, there is an easier way already built into OSX.

I know, I was using this approch before as well. Actually this should work (changing the homedir is one of the most normal things in the UNIX-world), but it does not work 100%. Many applications have problems with this. Even if you symlink /Users to /Volumes/Users you'll run into problems. If you are only using Apple apps you won't notice this.

 

mcsmart

Link to comment
Share on other sites

  • 4 months later...

Hi mcsmart,

 

Thanks for sharing! I have put /Users to a separate partition as you suggested. System works like a charm. However, there is a small bug in Time Machine. It backups files in /Users, but when I enter TM, I cannot go in time on any files of that folder.

 

The problem is described in detail here: http://www.insanelymac.com/forum/index.php?showtopic=165438

Link to comment
Share on other sites

 Share

×
×
  • Create New...