Skip to content

Instantly share code, notes, and snippets.

@jarthod
Last active December 28, 2022 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jarthod/a994a5b8ec15545b81aac4c37a24c29b to your computer and use it in GitHub Desktop.
Save jarthod/a994a5b8ec15545b81aac4c37a24c29b to your computer and use it in GitHub Desktop.
Linux backup cheat sheet

Prepare (Ubuntu 22.04 Live):

sudo su
apt install pv

Dump disk (or partition) to local file

zstd < /dev/nvme0n1 | pv > laptop.img.zst

Dump disk (or partition) to compressed image over network (NAS)

zstd < /dev/nvme0n1 | pv | ssh adrien@192.168.0.10 "cat > /volume1/Backup/laptop.img.zst"

Restore disk image from local file

zstd -dc laptop.img.zst | pv > /dev/nvme0n1

Restore disk image from NAS (untested)

ssh adrien@192.168.0.10 "cat /volume1/Backup/laptop.img.zst" | pv | unzstd > /dev/nvme0n1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment