dd (for copy and convert, except cc was already used so it became dd, IIUC) is a very powerful tool for copying.
I'm not sure what "convert" implies, because in the common uses I've run into (cloning a hard drive (or partition), creating a bootable floppy from a floppy image, etc., it sounds like no conversion is performed but instead an "exact copy" is made. Hmm, maybe the bootable floppy from a floppy image is a conversion, and/or maybe cloning a drive involves (automatically) converting from the geometry on one hard drive to the geometry of a different hard drive??
I'd like to add some words here about what dd does with respect to hard and soft links -- I guess in the normal case (cloning a hard drive) it preserves them "exactly". Likewise when creating a bootable floppy from an image. Are there other cases?
Aside: Things are getting out of hand, especially today as I'm rushing -- I'm violating the show it "once and only once" principle and I'll need to clean that up.
See:
Contents
Notes
Some Typical dd Commands
Copy an image to a floppy. (I'm sure the floppy has to be formatted first, I'm not sure whether a filesystem must exist, or if dd creates a filesystem from the image.
dd if=<path_to_image>/file.img of=/dev/fd0
Clone an entire hard drive to another -- _if the first has a lot of empty space you will waste some time -- consider alternatives, like clone just the partitions with data (not, for example, swap) -- I think there tools to copy just data or compress the image or something). Note: if the original drive is bigger than the "clonee", but all data can fit on the clonee, the dd will stop with an "out of space message" but
may still be usable (if all the "real data" fit on the second drive).
dd if=/dev/hda of=/dev/hdb
Clone a single partition from one hard drive to another.
dd if=/dev/hda2 of=/dev/hdb2
Backup the
MBR (Master Boot Record) of a hard drive (should work for a floppy as well:
dd if=/dev/hda of=backup-hda.mbr count=1 bs=512
Copy the
MBR from one disk to another:
dd if=/dev/hda of=/dev/hdb count=1 bs=512
Options
There are some useful options to dd, like to specify a block size or the number of blocks to be copied (or number of repetitions -- not sure which)
example now included above. You can do things like write all zeros to a drive using those options.
Clone
Page Ratings