O'Reilly logo

Unix Backup and Recovery by W. Curtis Preston

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Backing Up and Restoring with the dd Utility

As far as backup utilities go, the dd utility is about as featureless as they come. However, it has certain applications for which it is uniquely suited.

Basic dd Options

The basic syntax of dd is as follows:

# dd if=
                  device 
                  of=
                  device
                   bs=
                  blocksize

The preceding options are used almost every time you run dd ; they are explained in the following sections.

Option: specifying the input file

The if= argument specifies the input file or the file from which it is going to copy the data. This is the file or raw partition that you are going to back up (e.g., dd if=/dev/dsk/c0t0d0s0 or dd if=/home/file). If you want dd to look at stdin for its data, you don’t need this argument.

Option: specifying the output file

The of= argument specifies the output file or the file to which you are sending the data. This could be a file on disk or an optical platter, another raw partition, or a tape drive[25] (e.g., dd of=/backup/file, dd of=/dev/rmt/0n). If you are sending to stdout, you don’t need this argument.

Option: specifying the block size

The bs= argument specifies the block size, or the amount of data that is to be transferred in one I/O operation. This value normally is expressed in bytes, but in most versions dd also can be specified in kilobytes by adding a k at the end of the number (e.g., 10 K). (This is different from a blocking factor, like dump and tar use, which is multiplied by a fixed value known as the minimum block size. A blocking ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required