Wednesday, February 07, 2007

How To: move your Mac OS X to another partition & use it
------------------------------------------------------------------------

Initially, I installed Mac OS X 10.4.7 on 6 GB partition. Gradually, I started running out of space on my Mac partition as I kept pouring new softwares. Ultimately, I decided to create another bigger partition and move my current organized Mac OS. But then the question was how to transfer my current Mac OS to this new partition and boot from it. But thanks to a wonderful tool called RSyncX, I was able to move and boot from my organized Mac OS in new and bigger partition. Yes, RSyncX does allow you to make the new partition bootable.
You can use this technique to create backup of your entire Mac OS as well.

What you need:
  1. Mac OS Extended(journaled) partition, bigger or of same size.
  2. RSyncX, get if from here, and install it. To install rsyncx, simply extract the rsyncx archive. Double click on the installer package inside it which will be called something like RsyncX_v2.1.pkg. Double-clicking this will install the rsyncx GUI and the command line program /usr/local/bin/rsync (it will not delete the built-in rsync). Start RSyncX from the Applications folder.
  3. There are a few basic rules that you need to follow when cloning a disk with Mac OS X System files in order to get a bootable clone:
  • File permissions must be preserved. Many files belong to the root user, so you cannot simply copy these files from the Finder. There are other issues with permissions, such as the setuid bit (in English, that is a feature of a file that, when executed, gives the file or application the same privileges as the owner of the file.
  • The invisible Unix system files must be copied. Mac OS X is driven by a Unix flavored operating system called Darwin. Darwin system files reside at the root level of the derive in four folders: /private, /bin, /usr, and /sbin. These directories hold all the critical files that allow the computer to boot up and have basic functionality.
  • Unix-style links must be preserved. Symbolic links and hard links are different from the Mac aliases we are familiar with. Likewise, the way we deal with them will not be the same. Because there are some critical symbolic links on a Mac OS X disk, the integrity of these files must be preserved by the utility you use to clone/backup the disk. Some people are very familiar with the error upon booting that states "/etc/master.passwd: Not a directory". This is because the /etc symbolic link to /private/etc was broken.
  • Some directories are populated by the System after booting, and are thus unnecessary to preserve, however, although empty, they may still have to be present. For example, the Volumes directory is populated with directories corresponding to the names of Volumes you have on your system. These directories are called "mountpoints", and are created "on-the-fly" by Apple's autodiskmount utility. Because these directories do not contain data on your boot volume, they do not need to be copied during a backup/copy operation. The /dev directory is also a placeholder for system devices, such as disk drives, output devices, and communications devices. The list of devices in this directory is created each time the computer is booted up and when new hardware is added, so it is unnecessary (and a little difficult) to copy the items in this directory. Because this is a Unix system directory, however, you will not have a bootable volume unless this directory is recreated on the cloned disk. Creating an empty directory is sufficient. Likewise, it is important to backup mach_kernel (the most important file in the system), but "mach" and "mach.sym" are destroyed and recreated each boot by the /etc/rc boot script. Finally, the Network folder at the root level does not need to be backed up because it is populated by the System on startup.
  • Resource forks must be preserved. While Apple is trying to move away from Resource Forks, there are still many applications and documents that use them. Because of this, any backup or cloning utility must preserve the resource forks. If you try to clone a Mac OS X disk without preserving resource forks, many of your personal documents will be damaged.
  • Make sure the "Ignore privileges on this volume" setting is not checked for your source or target volume. This setting is called generally called "Ignore ownership on this volume". To check this setting, click on the target volume, choose "Get Info" from the File menu in the Finder and select the Privileges menu. Make sure the box at the bottom is NOT checked, otherwise permissions and ownership settings will not be preserved, no matter what tool you use to copy files. Ensure "Ownership & Permissions" are enabled as shown in following screenshot. By default, Mac OS turns off permissions management for new partitions. "Ignore ownership on this volume" at the very bottom in the below screenshot should be unchecked.



Below is a screenshot showing how to set up the RSyncX to back up the entire Mac partition to the another partition and make it bootable.



  • The "Remove Unmatched" checkbox tells RSyncX to delete any files on the destination partition that have been deleted on the source partition since the last backup.
  • "Archive" mode coupled with "Remove Unmatched" will preserve all file modification times, ownerships, etc. This will produce an exact copy of the drive.
Note: this option will also mean that any files you may have accidentally deleted will also be deleted from the backup too, making it possible to lose a file permanently if you don't notice its deletion in time.
  • Do not forget to select "Bootable Source" & "Make Bootable" options to make the new partition bootable.

Once you have all the options properly set, click on "Synchronize" to start copying. Let the RSyncX to finish copying your entire partition. Obviously next step is to make sure that new partition is an exact copy of the current Mac OS. Try booting from it. To do this, restart the Mac OS and press F8 while it boots. Choose the new partition to boot from. If you can successfully boot and login from the new partition, you are done with moving your current OS X to new partition.

Note:

If you are doing it for backup purpose, recovering from a disaster by simply booting from new partition and using rSyncX in reverse to restore the system is quiet possible.