Wednesday, February 9, 2011

dd command primer

Example 1. Backup Entire Harddisk

# dd if=/dev/sda of=/dev/sdb
 
# dd if=/dev/sda of=/dev/sdb conv=noerror,sync
  • “if” represents inputfile, and “of” represents output file. So the exact copy of /dev/sda will be available in /dev/sdb.
  • If there are any errors, the above command will fail. If you give the parameter “conv=noerror” then it will continue to copy if there are read errors.
  • Input file and output file should be mentioned very carefully, if you mention source device in the target and vice versa, you might loss all your data.

Example 2. Create an Image of a Hard Disk

# dd if=/dev/hda of=~/hdadisk.img
 

Example 3. Restore using Hard Disk Image


# dd if=hdadisk.img of=/dev/hdb
 

 Example 6. CDROM Backup

dd if=/dev/cdrom of=tgsservice.iso bs=2048
 

 

No comments: