Tag Archives: raid

Mac /Users partition on RAID1

This is what I’ve created:

  • Fresh new installation of Mac OS X Lion on a new 128SSD hard drive (this should work with Mavericks too);
  • Create a RAID1 with the 2 TB disks, and mounted in /Users;
  • Restored apps/confs/data from Time Machine using Migration Assistant.

Create RAID1

This is quite handy to have the user’s data safe.
I’ve simply created a RAID1 using Disk Utility and set this new device to auto mount in /Users folder 😉
Call the new device “Users“. I will use this name as reference in this guide.
Simply drop the hard drives in the Raid section and select Mirrored Raid Set – Mac OS Extended (journaled)
Once created, CMD+I on the new device and take note of Universal Unique Identifier the famous UUID

It might be interesting to follow this guide to create an encrypted logical volume on the RAID partition to save your data 😉

How to mount this new drive in /Users?

First of all you need to enable “root” user

Very easy… open Terminal, got superuser privilegies (sudo su - command) and once the prompt shows “#“, type passwd command.
Set a new password (it will ask to insert it twice).
Now, go to Users and Group and in Login Options select Show Input menu in login window (this can be rolled back once finished).
Logout (better if you do a full reboot).
Once the OS is up again you will have an “old fashion” login window, where you need to enter username and password.
Fantastic!
Insert root as username and the password is the one you’ve just set via Terminal: you will login as super user.

Second, copy the current data

Now… back to the Terminal!
Open it (and you will be already root user! ), have handy the UUID you’ve saved before and digit the following commands:

cd /
cp -a /Users/* /Volumes/Users/
cp -a /Users /Users.orig
rm -rf /Users/*
vifs

Now you need to press SHIFT+g
Then press o
Then insert the following, of course replacing the XXX with your UUID

UUID=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX /Users hfs auto

Once finished, to save press these in sequence esc : wq

For more info check any vim editor guide.

What we’ve done is coping the full content of /Users in our new RAID device (called “Users” during the RAID setup).
Created a copy on the local drive as well (just to stay from the safe side 😛 )
Removed all the content of /Users and make it ready to get the new RAID1 device mounted inside (sounds a bit xxx but it’s not 😀 )
Edited /etc/fstab to auto mount the RAID1 device automatically at the boot.

Third… reboot and login

Now it’s all ready for the reboot and login with your normal user!
Once confirmed that all works, you can safely remove Users.orig folder and restore the original login window.

Forth (optional): restore from Time Machine

Now you can finally restore your data manually using Time Machine.
Migration Assistant will probably fail if the amount of data is bigger than the size of your main OS disks. The reason is that It’s not able to understand that there are extra 2TB of space under Users.
What I’ve done is restoring ALL my OS except the users, using Migration Assistant, and then, I’ve used Time machine and copied manually all the folders inside /Users … and all worked! 😉