Skip to content

Instantly share code, notes, and snippets.

@jj11hh
Created May 17, 2020 15:06
Show Gist options
  • Select an option

  • Save jj11hh/c08bde20f628f842ed248fc2881f7e62 to your computer and use it in GitHub Desktop.

Select an option

Save jj11hh/c08bde20f628f842ed248fc2881f7e62 to your computer and use it in GitHub Desktop.
backup ubuntu system to another partition
#!/bin/bash
cd / # THIS CD IS IMPORTANT THE FOLLOWING LONG COMMAND IS RUN FROM /
mount /dev/nvme0n1p9 /mnt || exit 1
tar -cvpzf /mnt/backup-$(date +%F_%H%M%S).tar.gz \
--exclude=/proc \
--exclude=/tmp \
--exclude=/mnt \
--exclude=/dev \
--exclude=/sys \
--exclude=/run \
--exclude=/media \
--exclude=/var/log \
--exclude=/var/cache/apt/archives \
--exclude=/usr/src/linux-headers* \
--exclude=/home\
--exclude=/boot/efi\
--exclude=/snap /
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment