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 ...
Get Unix Backup and Recovery now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.