Bottom Line: If you are comfortable learning a few of the tools built in to Mac OS X, you can ensure your data remains protected.
While there is a great deal of excitement about the recent release of Microsoft’s Windows Vista, many of the features touted by this operating system have been present in Apple’s Mac OS Tiger (10.4) for over a year. One particularly convenient feature is the encryption built in to the the operating system.
The security control panel allows you to turn on File Vault, which encrypts your home directory and protects your files from prying eyes. This won’t help if you leave yourself logged in without a password-protected screen saver, but it will prevent someone from getting access to your data by hooking it up to another computer as a hard drive (Apple’s FireWire Target Disk Mode) or by manually extracting the hard drive. This is particularly important for laptop users with sensitive data, since laptops are generally more predisposed to theft than desktop computers.
File Vault is great, but backups are essential, and Apple’s Backup software (as well as many that can be purchased seperately) don’t allow for encrypted backups. Fortunately, all the tools you need to keep your data encryped are built-in. Taking advantage of them, however, will require some comfort using some of the Unix software that powers the Mac interface.
I will presume that you are backing up to an external hard drive, which I think is the easiest and most effective solution. The first step is to ensure the data on your laptop is secure. This is done simply by going to the Security control panel on the Mac and switching on File Vault. This will take some time when you first activate it, and each user who wants their home directory encrypted will have to activate this seperately. I recommend you also check the box to require a password when waking from sleep or screen saver, and have the screen saver turn on after a predeterimined amount of time. This will ensure that your data isn’t compromised if someone comes across your computer after you’ve finished using it.

The next step is to create a secure place to store the backups of your home directory. Run the Disk Utility (located in the Utilities folder within the Applications folder). Click “New Image” and change the location to your external hard disk. Change the size to the size of your hard disk (you will likely have to choose “Custom”). Encryption should be set to AES-128, and the format should be sparse disk image. You can call this image anything you like, but I would recommend something you will recognize, like Backup.

What does this all mean? A disk image is a “virtual” disk that leads a double life. In its standard state (unmounted), it appears like a file on your hard disk. When you “mount” the disk image, it turns into a virtual hard disk that appears alongside any others you may have – you can copy files to and fro with ease. Why use a disk image intead of just a hard disk? Unlike hard disks, you can encrypt and password-protect an entire disk image; any files copied onto the disk image are automatically protected. When you selected AES-128 (above), you told the computer to make sure this disk image automatically encrypts anything that is copied onto it. There are two types of disk images on the Mac: regular disk images and “sparse” disk images. Regular disk images are a fixed size, like the hard disk in your Mac. If you create a 40 GB conventional disk image, it will take up 40 GB even if there are no files on it. A sparse disk image, on the other hand, starts off small and grows only as needed. When you create a 40 GB sparse disk image, it has a maximum size of 40 GB, but will start out much smaller. As you add more files to the disk image it will grow. It is important to choose a size that’s bigger than you will ever want from this disk image, since it can never grow beyond the maximum you set when you create it. That is why I recommended setting the size of your backup image to be the same as the size of your internal hard disk – you’re home directory will never get bigger than this unless you upgrade your hard disk.
After you’ve followed these directions, you will be prompted for a password – make sure you remember this password, since you’ll need it to access your backup in the future. This does not need to be the same as the password for your account. I recommend selecting the option to add the password to your keychian. This will allow you to load your backup while you are logged in without needing to enter the password every time.
Once you are done, you will see an icon in the Finder that represents your newly-created disk image mounted alongside your other hard disk. Since you will want to automate the mounting and unmounting of this disk image, you should unmount the disk image by clicking the eject icon next to the disk image’s name.
Now you have protected your home directory with File Vault and created a secure disk image to store your backup. Now it is time to actually make the backup. Load up TextEdit and copy and past the code below:
#!/bin/sh
echo "Mounting backup"
hdiutil mount /Volumes/External/Backup.sparseimage
echo "Running backup"
rsync -aE --delete --delete-after ~ /Volumes/Backup
echo "Unmounting backup"
hdiutil detach /Volumes/Backup
This is set to back up to an external drive called “External” with a disk image called “Backup”. If you used different names, before to change the names above. If you used a space in the name of either your image or your external hard disk, you will need to put a backslash (\) before the space so the computer doens’t get confused.
For example, if your external disk was named “External Disk”, the third line of code would read:
hdiutil mount /Volumes/External\ Disk/Backup.sparseimage
You will need to make sure this file is in plain text format, go to the format menu and choose “make plain text”. Now save the file as backup.command (make sure there is no .txt at the end). Save it in your home directory.
You have now created a “shell script” that will automatically mount your backup disk image, backup your home directory, and unmount the disk image, all for free! In order to activate this script so it can be run, you have to make some changes via the Terminal. Load up the Terminal (it’s in your Utilities folder) and type:
chmod u+x backup.command
Then hit return. This tells your Mac that you want to be able to run the script you just created. Quit the terminal and go to your home directory. You should see a file called backup.command. Make sure your external hard disk is connected and double click on the the file. The terminal will pop up and your computer will start backing up. It may take a while the first time you run it, but each subsequent time, it will only copy whatever has changed from the last time you backed up.