Mac OS X Backup Software


Your Mac OS X comes with software that can be used to back it up. Unfortunately, it does not include anything that could reasonably be considered an all-purpose backup tool. .Mac members can use the Backup software included with their accounts to back up documents and other account data, but this is hardly a comprehensive systemwide tool. The final topic of this chapter will take you through the available built-in applications, as well as some third-party applications you might want to look into.


The ditto command can be used to copy any Mac OS X directory structure from one location (or volume) to another. It can even be used to create complete booting copies of the operating system. It is not an incremental backup tool, but it can do what most standard Unix command-line tools can't: copy complete files, including their resource forks.

The ditto syntax is

 ditto  [<options>] <source> [<source>...] <destination>  

Table 20.1 defines the ditto command-line options.

Table 20.1. ditto Command-Line Reference




Source path .


Destination path. This is created if it doesn't already exist.


Print a line of output for each directory copied .


Print a line of output for each object copied (file, directory, and so on).


Copy resource forks for all files that have them.

-arch [ppcm86ki386hppasparc]

When copying the files, remove information for system architectures other than what is specified. Because Mac OS X is available on only the PPC platform at this time, this of little use right now.

-bom [Bill of Materials File]

Restricts the objects being copied to those contained in a bill of materials ( .bom ) file. BOM files are stored with the Contents/Resources directory of Mac OS X package files.

If you'd like a GUI face on ditto , download Carbon Copy Cloner at Carbon Copy Cloner, shown in Figure 20.2, is shareware, and can be used to easily copy complete, bootable Mac OS X volumes .

Figure 20.2. Carbon Copy Cloner adds a GUI to the ditto tool.



Another command-line tool that can handle HFS+ is hfspax from Howard Oakley. It is a free download from

Alternatively, an HFS+-aware version of tar can be found at http://www. metaobject .com/Community.html#hfstar.

dump / restore

The dump and restore commands work together to create an incremental backup system. Although typically used with tape drives (which are unsupported in Mac OS X's dump / restore ), these commands can also be used to back up to disks, removable media, and remote tapes. Unfortunately, they do not support the HFS+ file system, so unless you've based your system on UFS, their usefulness to you may be quite limited. As you may guess from the names , dump creates the backup, and restore restores it.

The syntax for dump is simply

 dump [  -<options>  ]  <filesystem>  

As always, the complexity is in the details. Table 20.2 provides a reference for dump .

Table 20.2. Command-Line Reference for dump




File system to back up. Should be specified as a device name on Mac OS X. The mount command displays mounted volumes.


Update the dumpdates ( /etc/dumpdates ) after each dump . This is required for dump to keep track of its backup status.


The level of the dump to perform. is always a full dump, whereas 1 9 may be chosen for other levels when developing a backup strategy.

-f <destination>

The destination file to write to. The destination may be a normal file or a device such as a disk ( /dev/diskxxx ). You can also specify a remote device in the format username@hostname:device . The remote system must be configured to deal with these requests .

-b <blocksize>

The size (in k ) of dump records written to the output device. This is constrained by the I/O system and is usually limited to 64KB.

-d <density>

The tape density in the bits per inch.

-s <tape length>

The length of the tape in feet.

Several of these options ( b , d , s ) are obviously related to backups that involve a tape device. Because Mac OS X doesn't support tapes at the command-line, these can be used only when backing up to remote tape drives, which, again, must be configured under Linux or another Unix flavor. If you do decide to use dump, read through the manpages; a number of more obscure options are not shown here.

After running a dump to a file, device, or remote tape, you can subsequently restore the contents by using the restore command. As with dump , the basic syntax is simple:

 restore -i  <options>  

Obviously, options are required for telling restore what it is restoring. The most common command-line options are shown in Table 20.3

Table 20.3. Restore Options




Run in interactive mode. We've provided this as part of the default syntax, but it is an option. If you're interested in other ( noninteractive ) methods of restoring files, please refer to the man pages.


Output a line with each file's type and name as it is being restored.

-b <blocksize>

The size (in k ) of the dump records in the backup file.

-f <source backup set>

The backup file created by dump . This may be a normal file, or a device such as a disk ( /dev/diskxxx ). You can also specify a remote device in the format username@hostname:device . The remote system must be configured to deal with these requests.

-s <file number>

If multiple dump files exist on a tape, chooses the file number to use. Files are numbered incrementally, starting at 1.

When running in interactive mode ( -i ), restore reads the backup file, then drops the user into to an interactive shell where they can pick and choose the files and directories that they want to restore.

Table 20.4 shows the interactive command reference for restore .

Table 20.4. Interactive restore Command Reference



ls [ <directory> ]

Lists the contents of the current or named directory.

cd <directory>

Changes to the named directory.


Displays the path of the current directory.

add <file or directory>

Adds a file or directory to the list of objects to restore. If a * is specified, all elements in the current directory are selected.

delete <file or directory>

Removes a file or directory from the list of objects to restore. This does not affect the data stored in the backup.


Extracts the files that you've added to the restoration list. This is usually the final step in restoring files.


Displays a command reference.


Exits the restore session. If you have added files to the restore list and not extract ed them, the list will not be restored.

When using restore , remember that you're not working within your Mac OS X file system; you're viewing the contents of the dump file. What you see is what is available to restore, not what is currently on your system.

Again, unless you're in an all-Unix environment, dump / restore might not be appropriate for your system.

Retrospect 5.0

Dantz's Retrospect 5.0 for Mac OS X comes in a variety of different flavors, from a standalone "Retrospect Express" for a single computer to Retrospect Server, capable of backing up Windows and Mac OS 9/X clients and even sensing and archiving notebook computers as they connect to the network.

Retrospect is a full incremental backup solution that supports hundreds of storage devices, features built-in scheduling, and can automate offsite backups by storing information on FTP servers, as shown in Figure 20.3.

Figure 20.3. Retrospect can create offsite backups by archiving to remote FTP servers.


Whether you are running multiple Macintosh or Windows computers on a network or a single standalone computer, Retrospect is a wise investment. It provides a comprehensive cross-platform backup solution that behaves like a Macintosh application.

Disk Copy and hdiutil

The Disk Copy utility that comes with Mac OS X can create perfect disk images of a source volume. If you've downloaded .dmg or .img files before, you've worked with disk images. The entire contents of a partition can be copied to an image, giving you a complete archive of the partition at the time it was captured, including file ownerships and permissions. Because the image is stored in a single file, you can store multiple images on a single backup volume (such as a CD-ROM or Firewire Drive).

To create an image, start Disk Copy and choose New Image from Device (Option+Command+I) from the File menu. A device selector window appears, as shown in Figure 20.4. Expand the disk objects by clicking the disclosure arrow in front of each line. The disks display all available partitions. If only a single partition exists on the disk, you select it by choosing the disk itself; you cannot expand it in the list.

Figure 20.4. Disk Copy can create disk images from any readable partition.


Choose one of the disks or partitions and click the Image button. Mac OS X prompts you for image's destination, format (Read-only, Read/Write, Compressed), and whether or not it should be encrypted. If you're creating a backup, I recommend choosing a read-only format. The "compressed" format also results in a read-only image, but unless you're short on space, the length of time it takes to compress the image is rarely worth the space savings. Finally, don't bother with encryption unless you're storing a backup of sensitive information. Encrypting an image is also a time-consuming action, not necessary for most backups.


If you're not sure what partition you want to choose when making an image, you may want to use the mount command-line tool to show where the partitions are mounted. For example:

 #  mount  /dev/disk0s9 on / (local) devfs on /dev (local) fdesc on /dev (union) <volfs> on /.vol (read-only) /dev/disk0s10 on /Volumes/Laptop 9 (local) 

Here you can see two disks: the main Mac OS X volume (mounted on /) corresponds to disk0s9 , whereas my Mac OS 9 partition (Laptop 9) is disk0s10 . Alternatively, use disktool -l to display slightly more detailed volume information.

To create an image from a folder within a partition, choose New Image from Folder or Volume from the File menu. You can then choose what data to image by using the standard Mac OS X file browser.


To create and manipulate disk images from the command line, you can use the hdiutil utility. hdiutil provides all the features of Disk Copy, accessible through a relatively simple syntax: hdiutil <verb> [options] . Available options are dependent on the verb. Several common verbs and options are shown in Table 20.5 hdiutil sports a large number of verbs and options, and I recommend reading the full man page to see all of them. Those provided in the preceding table are sufficient for most common tasks , such as imaging and burning CDs or DVDs of critical directories on your system. For example, the following sequence creates a new disk image, mounts it, copies the contents of my home directory to it, unmounts it, and, finally burns the image to a CD.

Table 20.5. Common hdiutil Verbs and Options

Verb and Options


attach <imagename>

Mount the named disk image.

detach <device name> [-force]

Unmount the disk image device. If the force option is used, the unmount is completed regardless of open files.

create <imagename><size spec> [options]

Create a new disk image with the given image name and size. Size can easily be specified by using -size <spec> followed by a number and unit of measure (b/k/m/g/t/p/e), such as -size 100g for 100GB. Other options include - volname <volume name> to set a volume name, and -fs <HFS+HFSMS-DOSUFS> to set a file system.

resize <size spec><imagename> [options]

Resize an existing image. Options include -imageonly to resize the image file, not the partitions it contains, -partitiononly to resize the partitions, not the image, and -growonly or -shrinkonly to allow the image file to grow or shrink, respectively.

burn <imagename> [options]

Burn the image to optical media. Use the options to control the burn process: -testburn tests the burn without actually writing, -eject ejects the CD after burning ( -noeject does the opposite ), -verify verifies the burn process ( -noverify does the opposite), -optimizeimage optimizes the image for burning ( -nooptimizeimage , again, does the opposite), -speed <#> sets the burn speed, -erase performs a quick erase on the media, and -fullerase erases the entire media.

verify <imagename> [options]

Verifies the checksum of an existing image.

 %  hdiutil create -size 100m -fs HFS+ myimage  ............................................................................... Initialized /dev/rdisk2s2 as a 100 MB HFS Plus volume /usr/bin/hdiutil: detach: "disk2s1" detached successfully. /usr/bin/hdiutil: detach: "disk2s2" detached successfully. /usr/bin/hdiutil: detach: "disk2" detached successfully. created: myimage.dmg %  hdiutil attach myimage.dmg  /dev/disk2              Apple_partition_scheme /dev/disk2s1            Apple_partition_map /dev/disk2s2            Apple_HFS                       /Volumes/untitled %  ditto -rsrcFork /Users/jray /Volumes/untitled  %  hdiutil detach /dev/disk2  hdiutil: detach: "disk2s1" detached successfully. hdiutil: detach: "disk2s2" detached successfully. hdiutil: detach: "disk2" detached successfully.  % hdiutil burn myimage.dmg  


Mac OS X Maximum Security
Maximum Mac OS X Security
ISBN: 0672323818
EAN: 2147483647
Year: 2003
Pages: 158 © 2008-2017.
If you may any questions please contact us: