As you may already know, Mac OS X is a Unix-like system based on BSD and Mach. Among other things, this means that there is a single virtual file system on which you can attach new volumes by means of mount points and the mount(8) utility. One could consider partitioning a disk to place specific system areas in different partitions to prevent the degradation of each file system, but the installer does not let you do this (I suspect the one for Mac OS X Server might have this feature, but this is just a guess). Being Unix, this doesn't mean it isn't possible!

As a demonstration, I explain here how to install Mac OS X so that the system files are placed in one partition and the users' home directories are in another one. This setup keeps mostly-static system data self contained in a specific area of the disk and allows you to do a clean system reinstall without losing your data nor settings.

First of all boot the installation from the first DVD and execute the Disk Utility from the Utilities menu. There you can partition your disk as you want, so create a partition for the system and one for the users; let's call them System and Users respectively, being on the disk0s2 and disk0s3 devices. Both should be HFS+, but you can choose whether you want journaling and/or case sensitivity independently. Exit the tool and go back to the installer.

Now do a regular install on the System volume, ignoring the existence of Users. To make things simple, go through the whole installation, including the welcome wizard. Once you are in the default desktop, get ready for the tricky stuff.

Reboot your machine and enter single user mode by pressing and holding Command+s just after the initial chime sound. At the command line, follow the instructions to remount the root volume as read/write. If I recall correctly, it tells you to do:
# fsck -fy /
# mount -u rw /
Mount the Users volume in a temporary location, copy the current contents of /Users into it and remove the original files. For example:
# mkdir /Users2
# mount -t hfs /dev/disk0s3 /Users2
# rsync -avE /Users/ /Users2
... ensure that /Users2 matches /Users ...
# rm -rf /Users/.[a-zA-Z_]* /Users/*
# umount /Users2
# rmdir /Users2
I used rsync(1) instead of cp(1) because it preserves the files' resource forks, if present (provided you give it the -E option).

Once the data migration is done, you can proceed to tell the system to mount the Users volume in the appropriate place on the next boot. Create the /etc/fstab file and add the following line to it:
/dev/disk0s3 /Users hfs rw
Ensure it works by mounting it by hand:
# mount /Users
If no problems arise, you're done! Reboot and enjoy your new system.

The only problem with the above strategy is that your root volume must be big enough to hold the whole installation before you can reorganize the partitions. I haven't tried it but maybe, just maybe, you could do some manual mounts from within the Terminal available in the installer. That way you'd set up the desired mount layout before any files are copied, delivering the appropriate results. Note that if this worked, you'd still need to do the fstab trick in this case, but you'd have to do it on the very first reboot, even before the install is complete!

Go to posts index

Comments from the original Blogger-hosted post: