Jump to Navigation

255 - dd command for backup

The ' dd ' command is one of the original Unix utilities and should be in everyone's tool box.
It can strip headers, extract parts of binary files and write into the middle of floppy disks;
it is used by the Linux kernel Makefiles to make boot images. It can be used to copy and convert magnetic tape formats,
convert between ASCII and EBCDIC, swap bytes, and force to upper and lowercase.

For blocked I/O, the dd command has no competition in the standard tool set. One could write a custom
utility to do specific I/O or formatting but, as dd is already available almost everywhere,

1. Backup full hard disk copy

# dd if=/dev/sda of=/dev/sdb

# dd if=/dev/sda of=/path/to/image

# dd if=/dev/sda | gzip > /path/to/image.gz

* The example gzip is used to compress the image if it is really just a backup.

2. Restore Backup of hard disk copy

# dd if=/path/to/image of=/dev/sda

# gzip -dc /path/to/image.gz | dd of=/dev/sda




Main menu 2

Story | by Dr. Radut