How to take backup of complete hard disk in Linux

The most important part for any sys admin is to take regular backup. Here I will show you few methods which you can use to take a backup of your hard disk using dd command. You can take a backup of entire hard disk to some external storage either manually or you can run a cron job for the same.

Copying the data from hard disk using dd command

# dd if=/dev/sda of=/dev/hda
Here "if" represents input HDD and "of" represents output HDD. So make sure make the entry properly because it might lead you to complete loss of data.

If you receive any error running the above command then try the following command
# dd if=/dev/sda of=/dev/hda conv=noerror,sync
Using this, the command will continue to copy even if gets any read error.

Creating a image file of the harddisk

But this is not much appropriate to copy the harddisk files to remote locations so I prefer making an image file of the harddisk and restoring the same to a remote location.
# dd if=/dev/sda of=/backup/hdd_1.img
Restoring from a image file

# dd if=hdd_1.img of=/dev/hda



Converting CD-ROM into .iso file

# dd if=/dev/cdrom of=/backup/cdrom.iso bs=2048
Here we are specifying the default block size i.e.2048 bytes which will be used to convert the cdrom file into .iso file

Follow the below links for more tutorials:

1 thought on “How to take backup of complete hard disk in Linux”

Leave a Comment

close button