Backup using dd command

To backup an entire hardisk

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

sda is the source hardisk and sdb is the external hardisk to which am taking backup

“if” represents input file and “of” respresents output file….

if we give parameter “conv=noerror” then it will continue to copy if there are read errors…else command may fail due to read error

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

To make image of a hardisk

#dd if=/dev/sda of=~/Desktop/hd_img.iso

Consider am having a bootable usb with a custom OS with some settings saved in it…To make an image of that

Make image of the bootable usb

#dd if=/dev/sdb of=~/Desktop/puppy.img

The above command will make an image of the bootable usb
Now connect the blank usb and make it bootable

dd if=~/Desktop/puppy.img of=/dev/sdb oflag=direct

Always run dd command as root user…use df command to know the drives else you may loose the data…

the same command with a view on the progress of the dd command:

# apt-get install pv
# pv -tpreb /dev/sda | dd of=/storage/disk.img


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s