dd is a very handy tool and there are some more practical things we can do. For example if we want to dump a 3TB drive and want to preserve it and only 200GB are being used on the 3TB we can save a lot of space with gzip.
How to Use dd to backup a raw hard drive and tar gzip at once
sudo dd if=/dev/sda bs=20M| gzip -c > /mnt/extraspace/backup.img.gz
How to use dd to backup a raw hard drive WITHOUT compression:
sudo dd if=/dev/sda of=/mnt/extraspace/backup.img.gz bs=20M
Restoring is just the opposite.
How to restore a raw image with dd with compression:
change the /dev/sdX to the drive you want to restore to (be careful and understand /dev/sdX will be totally wiped out and erased with this operation or at least as much data as the image contains)
gunzip -c /mnt/yourddimage.img.gz | dd of=/dev/sdX
How to restore a raw image with dd WITHOUT compression:
change the /dev/sdX to the drive you want to restore to (be careful and understand /dev/sdX will be totally wiped out and erased with this operation or at least as much data as the image contains)
sudo dd if=/mnt/yourddimage.img of=/dev/sdX bs=10M
dd, restore, disk, images, compression, gzipdd, tb, preserve, gb, gzip, backing, tar, dev, sda, mnt, extraspace, sudo, bs, img, gz, restoring, sdx, erased, contains, gunzip, yourddimage, imag,