about me about me
photography photography
software projects software projects
contact me contact me

Yesterday I finally got around to removing my flakey superdrive from my Macbook Pro and replaced it with an optical bay hard disk (OBHD) from NewModeUS. This meant I was able to add another 320GB drive where my superdrive once lived (much needed as I was at 92% disk usage on my system drive). I also have an Intel X25-M 80GB to install but I’ll save that for when I have the time.

In preparation to moving to SSD, I’m looking to divert as many writes as possible, to prolong the performance of the drive (no TRIM support in OS X at present – no, not in Snow Leopard either). One of the best ways to do this is to migrate my user directory to my second (magnetic) hard drive. You might argue I’m losing the performance I paid for getting an SSD but boot times and applications launches should still benefit as the OS and apps reside on my X25-M.

Before proceeding with these instructions it’s vital you have a backup of your user directory and any other data on your Mac that you want to keep.

One of the top search results in Google for how to move / change your user directory in Mac OS X recommends using a symlink. There is however a cleaner method documented back in 2002:

First, make sure that on the new volume, the “Ignore ownership on this volume” setting in the volume Get Info window is not checked

Dan Frakes

Open Terminal and enter:

$ sudo ditto -rsrc "/Users/greg" "/Volumes/newvolume/Users/greg"
$ sudo niutil -createprop / "/users/greg" home "/Volumes/newvolume/Users/greg"

The problem being that niutil no longer exists in OS X 10.5 (Leopard) and later.

$ niutil
-bash: niutil: command not found

In Leopard and later the NetInfo Manager has been replaced the Directory Services client (dscl). Since Mac OS X 10.4 ditto also has the -rsrc arguments enabled by default.

The commands you’re looking for under Leopard (and Snow Leopard) are as follows:

(substitute your own username, here I’m moving my user directory to my second hdd/volume ‘Data’)

$ sudo ditto "/Users/greg" "/Volumes/Data/Users/greg"
Password: (enter password)
$ dscl
Entering interactive mode... (type "help" for commands)
 > cd /Local/Default/Users/
 > ls
 > change greg dsAttrTypeNative:home /Users/greg /Volumes/Data/Users/greg
 > exit

Logout and login again, verify your home directory has moved by opening Terminal and checking the public working directory:

$ pwd
/Volumes/Data/Users/greg

Now rename your old user directory to be sure, before removing it (or leaving it if you can afford the space):

$ cd /Volumes/OSX/Users/
$ mv greg greg.old

I rebooted after this to check my machine started up without any issues. Then removed my old user directory (sudo rm -rf greg.old).

Congratulations you’ve moved your user directory.


comments

Peri // 26.Sep.2010 // 10:18

it seems that this permission has been take away since Jan,
any ideas?

Peri-Pans-MacBook:Users PerIPan$ mv PerIPan PerIPan.old
mv: rename PerIPan to PerIPan.old: Permission denied

Thanks!
Peri

Peri // 13.Oct.2010 // 20:39

thank you very useful,
in order to complete the process I did the copy as you describe and then I moved the user folder via the ‘Accounts’ Advanced option.
:)

DanielJenkins // 01.Oct.2011 // 03:38

For peri try using $ sudo always seams helpful.

Check out how change the destination of the home folder, thus you won’t have to re-install the OS.
http://www.tuaw.com/2009/05/14/tuaw-tip-moving-your-home-folder-to-another-disk-or-moving-it/