Create Backups for Free in Mac OS X with Disk Utility

Jinx
Disk images make the perfect backup file. Without any extra software or cost, Mac OS X will compress and encrypt the data into a single file that can be copied anywhere. While most backup programs need to be installed on a computer in order to be able to decrypt and read the backup, encrypted disk images can be opened on any Macintosh.

Creating the disk image with Disk Utility.

Disk Utility is located in the Applications/Utilities folder on the hard drive. Most people only use Disk Utility to repair disks and permissions, but it can also be used as a backup program.

Go under the File menu and select New. A pop-up menu will show up with two options: Blank Disk Image and Disk Image from Folder. Choose the Disk Image from Folder and a dialogue box comes up and asks you to select the folder that you wish to backup. After selecting the folder that you want to back up another dialogue box appears asking you to name the disk image to be created and specify the type of disk image to be created. For backups, select compressed for Image Format and 128-bit AES encryption for Encryption. Mac OS X 10.5 Leopard adds the option for 256-bit AES encryption with is more secure, but takes longer to create and open up. Next a box appears asking you to enter a password for the encrypted disk image. Choose a difficult password because disk images can be opened if someone can guess your password. Microsoft offers a free online password strength tester and notes about creating passwords that cannot be easily guessed.

Selecting the Save Password in Keychain option means that the password to the disk image will be stored under your account information on that Mac. The image can be opened up by manually entering a password. If you are the only user of that computer, then this option can save time. However, if you share the computer with other people and do not have separate user accounts, then they can open the backup file too.

Now that the file is created, the image can be moved to another computer or flash drive in case the primary hard drive fails.

Automatically creating the disk image with a script

All of this can be done through Disk utility, but if you do it repeatedly, creating a little script can save time. For example, in Terminal which is located in Applications/Utilities:

hdiutil create -encryption -stdinpass -srcfolder private encryptedfolder.dmg

So, it would look something like this:

hdiutil create -encryption -stdinpass -srcfolder /Users/Myaccount/Documents encryptedfolder.dmg

Note that the command is entered in Terminal as all one line with a return. This will encrypt the folder to a disk image called encryptedfolder.dmg and bring up a password dialogue box for you to enter a password. If you want to enter the password in the script then try this.

echo -n "password" | hdiutil create -encryption -stdinpass -srcfolder private encrypted.dmg

This will create the disk image with the password of "password" without bringing up an interactive dialogue box. Be warned that anyone with access to the computer may be able to read this script and see your password, but that is not a problem if you take the disk image away from the computer.

Published by Jinx

IT guy by day  View profile

To comment, please sign in to your Yahoo! account, or sign up for a new account.