Skip to content

Instantly share code, notes, and snippets.

@NiKiZe
Last active June 30, 2022 21:44
Show Gist options
  • Save NiKiZe/51ea95706f9692123e2c3fe41c2eff32 to your computer and use it in GitHub Desktop.
Save NiKiZe/51ea95706f9692123e2c3fe41c2eff32 to your computer and use it in GitHub Desktop.
Linux system backup
# from https://wiki.archlinux.org/title/Full_system_backup_with_tar
# -p, --acls and --xattrs store all permissions, ACLs and extended attributes.
# Without both of these, many programs will stop working!
# It is safe to remove the verbose (-v) flag. If you are using a
# slow terminal, this can greatly speed up the backup process.
#--exclude-from=$exclude_file
tar --exclude=/tmp/* --exclude=/var/tmp/* --exclude=/usr/portage/* --acls --xattrs --one-file-system -cpvf - . | xz -zvv -T3 -0 > file.xz
restore:
xz | tar --acls --xattrs --numeric-owner -xpf -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment