dd how to backup and restore disk images including compression with gzip

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.

Backing Stuff up with dd

How to Use dd to backup a raw hard drive and tar gzip at once

  • Change /dev/sda to the drive you want to backup
  • Change /mnt/extraspace to the path you want to backup to

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 Stuff with dd

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


Tags:

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,

Latest Articles

  • Linux Mint Dual Boot Install Avoid Wiping our your Main C: drive /dev/sda MBR
  • QEMU-KVM soundhw deprecated how to enable sound in QEMU 4.x series
  • Virtualbox Error Cannot register the hard disk because a hard disk with UUID already exists solution
  • kernel: [549267.368859] mate-terminal[7871]: segfault at 2000000101 ip 00007f5d0a9548f0 sp 00007fff7012c610 error 4 in libgobject-2.0.so.0.4800.2[7f5d0a920000+52000]
  • apcupsd how to setup and monitor APC UPS units
  • How To Password Reset, Recover, Bypass, Remove and Unlock on Windows 10,8,7,Vista,XP,NT,2000,2003,2008,2012,2016,2019 Administrative Login Programs
  • Nvidia Ubuntu Linux Screentearing Video with solution driver
  • ?? Question Marks for time, permissions and size of a file?
  • mdadm how to stop a check
  • access denied by acl file qemu-kvm: bridge helper failed
  • Linux NIC connecting at 100M instead of 1000M gigabit speeds? It could be overheating
  • "This kernel requires the following features not present on the CPU: cmov Unable to boot - please use a kernel appropriate for your CPU.
  • http://vault.centos.org/5.9/os/i386/repodata/filelists.xml.gz: [Errno -1] Metadata file does not match checksum solution
  • Linux Ubuntu Wifi Disabled Only Works When Laptop Plugged Into Wall AC Power
  • CentOS 6 impossible to compile a newer libguestfs
  • chroot
  • How To Get Started on Ubuntu with gpt-2 OpenAI Text Prediction
  • Remove cloud-init in your VM
  • QEMU-KVM KVM Command Line Practical Guide
  • Linux How To Change NIC Name to eth0 instead of enps33 or enp0s25