Using dd
and gzip
to create and restore disk images
First order of business with dd
is to work out which device you are targeting
lsblk -a | grep -v loop
shows disks and partitions
If you need to check what the partitions are sudo fdisk -l /dev/YOURDEVICE
To copy the disk sudo dd status=progress bs=4M if=/dev/YOURDEVICE | gzip -c7 YOURIMAGENAME.img.gz
To generate a checksum from the disk sudo sha1sum /dev/YOURDEVICE
To generate a checksum from the image zcat YOURIMAGENAME.img.gz | sha1sum -
To write out the disk image zcat YOURIMAGENAME.img.gz | sudo dd status=progress bs=4M of=/dev/YOURDEVICE
lsblk -io kname,size
disks and partitions
lsblk -ido name,size
just disks/loops
Add conv=noerror
to the command for disks that are producing read errors
I'm cloning test instruments disks, these are sparsely used disks
Around 6GB used on a 80GB disk, gzips to around 5GB
dd
and gzip
are standard in `nix OSes so a live Linux distro can be used for this task