OS X Users Folder On A Separate Partition Using bash Scripts and Casper Imaging

OS X Users Folder On A Separate Partition Using bash Scripts and Casper Imaging

Keep user’s home folders separated from the system so a re-image will not destroy their data.

Requirements For This Walkthrough


  1. Users Icon


Why Do This?

Re-imaging a computer is often the fastest recovery method, but it is destructive because it erases everything.  Mounting the /Users  folder on a separate partition allows you to re-image a computer without destroying the user data.  This allows you to deploy the System partition without worrying about user settings.

Likewise, end-users can set things the way they want.  They can even keep their own ~/Applications  folder.  This separation or User and System integrates well with Apple’s methodology of resource domains.


  • Increased complexity because two partitions need to be managed
  • Users may run out of space based on what sizes were chosen for the partition
  • The System partition may run out of space based on what sizes were chosen for the partition



Marko Jung presented The College Challenge at the 2012 JNUC (and the similar presentation The Egg of Columbus in 2013).  I loved the concept but was not versed in Perl (language used for partitioning the disk), so I decided to try to make a bash version of the workflow.  It is not nearly as advanced and does not have a lot of error-checking, but I plan to improve this over time.

Conceptual Overview

  1. Erase/partition the disk with a bash script
  2. Deploy an /etc/fstab  file at imaging time
  3. Modify /etc/fstab  on the first boot after imaging with another bash script
  4. Change the icon to look like the normal /Users  folder so end-users don’t really know anything is different


Create the partition-disk.sh  Script

Below is the script to run before deploying the image.  It will partition the disk into three partitions: Macintosh HD, Users HD, and Recovery HD.  Adjust the disk sizes per your environment.

Create /etc/fstab

Using Casper Composer, capture a new package to capture the /etc/fstab  file as well as the /Users  folder icon, which will both be deployed at imaging time.  Use vifs  to edit /etc/fstab  with the following line:

LABEL=Users\040HD /Users hfs rw

This will mount the /Users  folder to a partition named exactly Users HD using HFS+ and making it read/write.  This file needs to be deployed before the image is applied.

Install the New /Users Icon

For the second part of the package, create a new folder to store the icon: /usr/local/imaging/users.icns.  Copy the icon into this folder.  This will be applied to the /Users  partition on first boot so that it looks like a regular folder. The icon I created just uses the normal icon with a little disk-slice badge on the bottom right.  From a distance, this looks like a normal folder to an end-user, but an admin will easily notice the badge, which will be an indicator that the workflow worked properly.

Create the package with Composer and save it as a .pkg.

Create A Script to Modify /etc/fstab

This script will tell the system to mount /Users  to the UUID of the Users HD partition.

Create A Script to Change the /Users Icon

This script will copy the icon deployed from the previous .pkg to the root of the /Users  partition.  This command works because it is a Volume and not a folder.  If it was just a folder, the process to change the icon is different.

Create the Workflow

This is what the Casper Imaging workflow looks like without any additional packages.