Full Disk Image Backup on Linux Using dd

There are many backup software for Linux that can do full disk image backup. I use term full disk image backup that refers to a complete backup of the entire disk into an image file. We can then use this image to completely restore our Linux (bare metal backup). You don’t need to download, install or even purchase any software to do this kind of backup. In Linux, there is a built in “dd” command that will do full disk image backup. You can use dd to clone your disk, migrate disk or simply create backup image of your disks or partitions. 

Lets start by creating a disk backup on Linux. I am using OpenSUSE Leap but this is not distribution specific command. You can apply this on any Linux distribution you have. For example, Ubuntu, Debian, Fedora users can follow these steps described on this article. We recommend you to save the image file on an external drive. Do not save the backup in the same disk as the source disk.

A. Backup Disk to Image File

For example I have the following configuration:

  • /dev/sda – Disk containing my Linux with all applications and data
  • /dev/sdb – My External disk which is mounted on /mnt/external_disk

You can check your disk configuration with this command

sudo fdisk -l


Disk /dev/sda: 119.2 GiB, 128035676160 bytes, 250069680 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x464a368c

Device Boot Start End Sectors Size Id Type
/dev/sda1 2048 4208639 4206592 2G 82 Linux swap / Solaris
/dev/sda2 * 4208640 88100863 83892224 40G 83 Linux
/dev/sda3 88100864 250068991 161968128 77.2G 83 Linux

Disk /dev/sdb: 3.7 TiB, 4000752599040 bytes, 7813969920 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 874D14D5-FAA3-4CB2-835B-E856F81B30BA

Device Start End Sectors Size Type
/dev/sdb1 2048 7813967871 7813965824 3.7T Microsoft basic data

Let’s mount the external disk to /mnt/external_disk

sudo mount -t ntfs /dev/sdb1 /mnt/external_disk

At this point, we are ready to start the backup process. The following command will backup /dev/sda disk to /mnt/external_disk/backup_image.img.gz

sudo dd if=/dev/sda conv=sync,noerror bs=64K | gzip -c > /mnt/external_disk/backup_image.img.gz

You can modify the command above to match your current backup plan. The command will create a compressed image backup file. 

B. Clone Disk Using dd

The following example will clone disk 1 (/dev/sda) to disk 2 (/dev/sdb). 

sudo dd if=/dev/sda of=/dev/sdb bs=64K conv=noerror,sync

Please be careful with the command. If you put the wrong disk ID, you can lose your data. You will not see any progress shown on your screen. To see some informative progress, you can add progress command to it. For example:

sudo dd if=/dev/sda of=/dev/sdb bs=64K conv=noerror,sync status=progress

That’s it. Now we continue learn how to restore from the image.

Bare Metal Restore using dd

On the previous step above, we’ve learned how to create image backup. Now, let’s learn how to restore our disk from the image backup. 


Image Backup & location: /mnt/external_disk/backup_image.img.gz

Command to restore:

gunzip -c /mnt/external_disk/backup_image.img.gz | dd of=/dev/sda

The command will restore the image to /dev/sda disk. 

Be the first to comment

Leave a Reply

Your email address will not be published.