Create home directory on partition drive

New Contributor III


I was wondering if anyone could help with this query or perhaps suggest a
better way of doing this.

I basically want to create 2 partitions on our Macs and have the
first partition for the OS and the 2nd for the Users home directory, this
way we could rebuild our machines without having to worry about backing up
User data/prefs etc.

The problem I have is that I can seem to change the home directory so that
it is on the second partition

Any idea's or is there a better way of doing this?



-- Los Angeles · Detroit · Toronto · New York · London · Cologne · Stockholm ·
Singapore · Hong Kong · Shanghai · Tokyo · Sydney

Imagination · London
25 Store Street South Crescent, London WC1E 7BL, United Kingdom
Tel +44 20 7323 3300 Fax +44 20 7462 2837


Honored Contributor

You can make a symbolic link from the /Users directory to the /Users
directory on the second partition. There are emails in the archive on
how to do this as it has been discussed here in the past.

I guess the other part would be to script or alter account creation and
set the path for home folders somewhere else, but I think the symbolic
link would be the best bet.


Not applicable

I wrote a script to create a symlink and partition the drive based off the
hd size about a yr ago with the help of these guys. The script is meant to
be ran after imaging. Pasted below. ~Joseph


# Created by HUGE | Joseph Simon on 5/24/10.

# Are You Sure ? echo "This WILL Partion the root partition. Are you sure you want to
Continue y/n? " read CONT case $CONT in n|N) exit 1;; y|Y) esac

# Change The Name of Startup Disk to MacintoshHD echo "Renaming Startup Disk to MacintoshHD" sudo diskutil rename / MacintoshHD

# Starup disk mount path mount=diskutil list | awk '/Apple_HFS/ { print $6; exit }'

# Size of Physical HD / Chops off any decimal numbers HDSize=`diskutil info /dev/disk0 | awk '/Total Size/ { sub(/..*/, "",
$3); print $3 }'`

# Name of OS Partition OS=`diskutil info /dev/"$mount" | awk '/Volume Name/ { print $3 }' | sed
-e 's/ //g'`

# Used = the amount of space USED after imaging used=`df -h / | awk '/dev/ { sub(/..*/, "", $3); print $3 }' | sed -e
's/%//g' | sed -e 's/Gi//g'`

# Set OS Partion Size Based on Your HD size and How much has been used
thus far

if [ $HDSize -ge 200 ]

then newhd=$[ $used + 50 ]

else newhd=$[ $used + 30 ]


# Set User Partion Size newuser=$[ $HDSize - $newhd - 1 ]

# Enable Journaling On Partioned Drive echo "Enabling Journaling on "$OS"" sudo diskutil enableJournal /Volumes/"$OS"

# RePartiton ! echo "Partioning. "$OS" : "$newhd"GB UserData : "$newuser"GB" sudo diskutil resizeVolume "$mount" "$newhd"G JHFS+ UserData "$newuser"G

# Location Variables mhd=/Volumes/"$OS"/Users ud=/Volumes/UserData/Users

# Move /User Account to new partition echo "Moving "$mhd" to "$ud"" sudo mv "$mhd" "$ud"

# Create Symlink echo "Creating New "$mhd" SymLink" sudo ln -s "$ud" "$mhd"

echo "Done, Check Symlink !!"

# Echo Stats echo "MacintoshHD : "$newhd"GB, UserData : "$newuser"GB"

exit 0

New Contributor

i've had problems using a sym link. i switched to mobile accounts with casper's mcx. here's a pic of the mcx prefs in casper...

![external image link](attachments/1098fc9918514a6985bec7a6ce4a71d4)
![external image link](attachments/09e97ee6441340d09f3e274864c598b7)

New Contributor III

Thanks Guys

I'll give it a go and see how I get along


New Contributor III

Thanks Eric

I'll give that a go

Not applicable

Is there any reason not to just mount the partition directly on /Users? Try adding a line like this in /etc/fstab (creating it if it doesn't exist):

UserData /Users hfs auto,rw

This says to mount the partition named UserData (might want to change that to the device name, though) using mount_hfs, automatically at boot time, with read/write access. The fstab(5) man page has more information about the file's syntax. I don't have an easy easy to test this, so be sure to try it first. It might also be useful to have at least one account (perhaps the JAMF managed account?) whose home directory is not in /Users, in case something happens.

Not applicable

Looks like you might want to add nobrowse to the options, like so:

UserData /Users hfs auto,rw,nobrowse

This keeps it from showing up as a mounted volume in the Finder.

Honored Contributor

I have had issues with /etc/fstab in the past when using it to control
auto mount options in OS X. YMMV I guess.

Contributor III

I have two options:
1) symlink (that other people have mentioned). Here is the process that I have used when using this option:
Copy the ‘Users’ directory to its new location:
# sudo ditto /Users /Volumes/Data/Users
Rename the original:
# sudo mv /Users /Users.old
Direct OS X to look for the Users directory in its new location by creating a symbolic link:
# sudo ln –s /Volumes/Data/Users Users
After confirming that the above procedure was successful, you may delete the original Users directory.
2) in Mac OS X 10.6, in System Preferences > Accounts, when you control-click on user's account, you will get an "Advanced Options…" option. In the "Advanced Options" window, you can—among other things—choose the location of the user's home directory. I am sure there is a way of accessing this option via Terminal so you can script it.


Valued Contributor II

Think we needd that script promised by Oxford Uni at the user conf in London!