Skip to content

Instantly share code, notes, and snippets.

Last active Feb 14, 2019
What would you like to do?
backup disk
# Archive
tar -cvpzf backup.tar.gz --one-file-system /
# Restore
sudo tar -xvpzf /path/to/backup.tar.gz -C /media/whatever --numeric-owner
# based on
# and
# remote backup
ssh user@remote "dd if=/dev/sda | gzip -1 -" | dd of=image.gz
# mounting
# * unzip the image.gz to image.img
gunzip < image.gz > image.img
# * calculate offset
fdisk -l image.img
# Check for start start sector and sector size. Multiply those, e.g. 2048 * 512
sudo mount -o loop,offset=1048576 image.img /path/to/mount-point/
sudo mount /dev/sda1 /mnt
sudo mount --bind /dev /mnt/dev
sudo mount --bind /proc /mnt/proc
sudo mount --bind /sys /mnt/sys
sudo chroot /mnt
sudo grub-install /dev/sda
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment