Backup with NFS and dietpi-backup
In this example, and on the same subnet, backup gamgee (source Pi, the one to backup) on baggins (destination Pi, the one storing the backup)
On the destination
Install NFS server
BASH
sudo apt update
sudo apt install -y nfs-kernel-server
Create the backup directory
BASH
sudo mkdir -p /backup_pi/gamgee
Configure the export
BASH
echo '/backup_pi/gamgee 192.168.10.50(rw,sync,no_subtree_check,no_root_squash)' | sudo tee -a /etc/exports
sudo exportfs -a
Check the directory
BASH
sudo showmount -e localhost
Expected output
Export list for localhost: /backup_pi/gamgee 192.168.10.50
On the source
Install NFS
BASH
sudo apt update
sudo apt install -y nfs-common
Create a mount point
BASH
sudo mkdir -p /backup_nfs
sudo mount -t nfs 192.168.10.1:/backup_pi/gamgee /backup_nfs
Test the link
BASH
sudo touch /backup_nfs/testfile && sudo rm /backup_nfs/testfile && echo "OK"
Expected output
OK
Run the non-interactive backup
BASH
sudo dietpi-backup 1 /backup_nfs
Optional: unmount when the backup is finished
BASH
sudo umount /backup_nfs
NFS server remains active on the destination.
Restore from the backup
On the source, re-create the mount point
BASH
sudo mkdir -p /backup_nfs
sudo mount -t nfs 192.168.10.1:/backup_pi/gamgee /backup_nfs
Run the non-interactive restore
BASH
sudo dietpi-backup -1 /backup_nfs
And reboot
BASH
sudo reboot