Raspian Backup over NFS with mount point check
Jump to navigation
Jump to search
setup : Raspian Debian OS with 2 raspberry pi's and one USB DISK
- create a Backup Script with:
nano /root/firmware-dd.sh
enter:
#!/bin/bash date=`/bin/date +%Y%m%d-%H%M%S` hostname=`/bin/hostname` mount -t nfs XXX.XXX.XXX.XXX:/usbdisk /mnt -o soft,nolock,rsize=4096,wsize=4096 if ! grep /mnt /proc/mounts > /dev/null 2>&1; then umount /mnt && exit 0 fi cd /mnt/Firmwares dd if=/dev/mmcblk0 of=$hostname-$date.img bs=1M sleep 2 sync sync cd / umount /mnt exit 0
Remark: The Script mount the USBDISK on the other 2nd. raspberry pi which is exported via NFS and the mount check exit the script if the NFS Share is offline or broken! If ok the Firmware is dumped to the NFS USB Drisk.
run it on root crontab every week:
@weekly sh /root/firmware-dd.sh > /dev/null 2>&1
Check weeky the output!