backup-filesystem.sh 500 B

12345678910111213141516
  1. #!/usr/bin/env bash
  2. set -euo pipefail # bash strict mode
  3. dte=$(date +'%Y-%m-%d')
  4. path="${1:-/mnt/crucial_nvme/Backups}"
  5. archive="${path}/backup_${dte}.tar.${2:-xz}"
  6. export XZ_OPT=-9v
  7. tar --ignore-case \
  8. --exclude=/{dev,proc,sys,run,tmp,opt,mnt,media} \
  9. --exclude={swapfile,share,docker,flatpak} \
  10. --exclude=*{cache,lost-found,trash,steam}* \
  11. --exclude=.{local,wine,mozilla} \
  12. --exclude=*.{mp4,mkv,flac,tar}* \
  13. --exclude-backups --exclude-caches-all \
  14. -acpvf "$archive" /