Backup with dd Command

Posted by zbrom on June 26, 2021 · 1 min read

This tutorial provides an effective method for backing up your boot hard drive which contains your OS. Backing up your system is very essential to protect against data loss; additionally if something where to go drastically wrong with your system, you could restore to a previous image. I recommend backing up your system drive at least once every three months. Additionally data backups should occur much more often.


Use fdisk or blkid to identify which drive you would like to backup or restore (e.g. /dev/sda).

fdisk -l

Backing up your system:

Use the dd command to backup your system. (I chose to use gzip compression in order to save space, because dd will copy every sector of your hard drive.)

Change /dev/sda to your desired drive;  make sure to include the proper path for the destination of the backup.

dd if=/dev/sda | gzip > /[your desired path]/backup.gz

Restoring your system:

Use the gzip command piped into the dd command to restore your system.

Change /dev/sda to your desired drive;  make sure to include the proper path for the location of the backup to restore.

gzip -dc /[your desired path]/backup.gz | dd of=/dev/sda