Cloning a disk or backing up your drive with ditto, rsync, hdiutil and asr:Ditto is a command-line utility that ships with Mac OS X. Ditto preserves permissions when run as root and preserves resource forks by default. Ditto can be used to clone your system with the following step:
sudo ditto -X / /Volumes/Backuprsync can be used to make a bootable clone as well. In addition to basic file copying, rsync also offers the ability to synchronize the source and target volumes -- it can copy only the items that have changed, thus subsequent clones, or backups, are much faster. The syntax is pretty easy:
sudo rsync -xrlptgoEv --progress --delete / /Volumes/BackupThat will backup your entire drive, deleting anything from the target that is not on the source drive (synchronizing, that is). Rsync also preserves resource forks (that's what the "E" argument is for) and will give you a bootable backup just as well as ditto. Learn more about using rsync to regularly backup your drive to a remote machine.
While it doesn't give you a bootable clone, backing up to a disk image does offer flexibility in the location of your backup as well as backup portability -- your entire volume is located in a single file. Restoring from disk images is pretty easy as well, just mount the disk image and treat it like any other volume. Backing up a volume to a disk image (UDZO means a compressed disk image in this case) is simply done with this one command:
sudo hdiutil create /Volumes/Backup/mikes_laptop.dmg -format UDZO -nocrossdev -srcdir /Finally, the ideal tool to use for creating bootable clones of your volumes is Apple Software Restore. Apple Software Restore, or asr, is also a command-line tool built-in to Mac OS X. While asr essentially functions like ditto in its file-copy mode, it also has the ability to clone a volume at the block level, preserving every last bit of data on the volume.
asr syntax for volume cloning is also pretty easy:
sudo asr -source / -target /Volumes/Backup -erase -nopromptThe "-erase" argument is optional, though recommended when cloning an operating system. Merged OSes are not usually very happy. To use asr in block-copy mode, you must be able to unmount both the source and target. That is, you can't block-copy your boot volume. Learn more about this in the CCC documentation about asr.