Skip to content

Instantly share code, notes, and snippets.

@StephenWetzel
Last active December 13, 2021 05:57
Show Gist options
  • Save StephenWetzel/19ed310091df4d433e972f4a1b0447ae to your computer and use it in GitHub Desktop.
Save StephenWetzel/19ed310091df4d433e972f4a1b0447ae to your computer and use it in GitHub Desktop.
Backup Pi to NFS drive
#!/bin/sh
# Add to /etc/fstab:
# 192.168.1.123:/mnt/media /mnt/nfs/server/media nfs defaults,rw,user 0 0
# Cron:
# 03 * * * * /home/pi/bin/backup_full_pi.sh
date
backup_dir="/mnt/nfs/server/media/Backup/Pi/$(hostname)/"
rsync -turq --no-perms --chmod=777 --mkpath /home $backup_dir
rsync -turq --no-perms --chmod=777 --mkpath /etc $backup_dir
rsync -turq --no-perms --chmod=777 --mkpath /var/lib $backup_dir
rsync -turq --no-perms --chmod=777 --mkpath /boot $backup_dir
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment