🌑

Linhost.info

DD the Swiss army knife for Linux

The Windows world has Norton Ghost, Linux has dd which can take on multiple tasks from cloning a drive to creating an image for storage. Keep in mind this post takes a very narrow approach towards using dd, you can always do more research. This is a list of the common ways I use dd.

Disk cloning

Clone a hard disk, move all the data located in sda to sdb.

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

If duplication of the disk is not needed we can instead create an image file for storage.

dd if=/dev/sda of=~/disk1.img

Restore the image file.

dd if=disk1.img of=/dev/sda

Copy CD/DVD in to ISO

Create a ISO out of a CD or DVD

dd if=/dev/cdrom of=/home/user/cd.iso bs=2048 conv=notrunc

Erase the data from the drive by overwriting it with random data. Keep in mind this solution does not comply with any kind of standard.

dd if=/dev/urandom of=/dev/hda

If you wish to use a solution that securely erases the data in hard drives use Darik’s Boot and Nuke (DBAN).

, — Dec 11, 2008