Skip to main content

Copy image to disk with Disk Destroyer

dmesg -w # and plug in your drive; see dev name that was added
lsblk # verify device name
fdisk -l /dev<output disk> # verify device name, product name (Disk model) and size

# WARNING: this will overwrite output disk data
dd if=<input imag file img> of=/dev/<output disk> bs=1M oflag=direct status=progress

Backup drive to disk

Uses dd for copy and pv for progress bar.

#!/bin/sh -eu
INPUT_DEV=$1

sudo fdisk -l "${INPUT_DEV:?}" 1>&2
BYTES=$(sudo fdisk -l "${INPUT_DEV:?}" | head -n 1 | cut -d' ' -f5)

echo 1>&2
echo "Backup from ${INPUT_DEV:?} (${BYTES:?} bytes)" 1>&2
echo "Continue? [N/y]" 1>&2

read Y
test "$Y" = "y" || exit 0

sudo dd if="${INPUT_DEV:?}" bs=1M | pv -s "${BYTES:?}" | zstd -12