Knowledge Base

Preserving for the future: Shell scripts, AoC, and more

Save whole hard drive image

I have some old hard drives (IDE connectors) I wish to backup. In my current solution, these old Windows XP-era-sized hard drives are a piece of cake to store. But how should I store them? They aren't compact discs, so genisoimage wouldn't cut it.

Here's how I chose to preserve them.

make disk image

time sudo qemu-img convert -c -O qcow2 /dev/sdd1 DOWNSTAIRS_PC.qcow2

mount image

sudo modprobe nbd max_part=8
sudo qemu-nbd --connect=/dev/nbd0 ~/DOWNSTAIRS_PC.qcow2
sudo fdisk /dev/nbd0 -l
sudo mount /dev/nbd0 /mnt/foo

when done

sudo umount /mnt/foo
sudo qemu-nbd --disconnect /dev/nbd0
sudo modprobe -r nbd

References

  1. https://unix.stackexchange.com/questions/522839/how-to-clone-a-single-partition-from-a-hd-to-a-qcow2-disk-image-for-use-in-qemu
  2. https://unix.stackexchange.com/questions/268460/how-to-mount-qcow2-image

Comments