Ok, the continuing story of backing up Raspberry Pi with USB SSD to Synology NAS.
My second test is using raspiBackup. In contrary to earlier posts this time it works without problems.
Again, we are talking about an system based on emoncms on which i added openHABian, using the Manual Setup.
With the first test with raspiBackup i used the default settings, no configuration changed to the default raspiBackup.conf file. By default raspiBackup uses dd to create a backup image on the nas.
emoncms@emoncmsrpi3:~ $ sudo /usr/local/bin/raspiBackup.sh -a ":" -o ":" /media/backup
This resulted in the following succesful backup:
--- RBK0009I: emoncmsrpi3: raspiBackup.sh V0.6.4.2 (2184fa5) started at Thu Feb 21 11:23:24 CET 2019.
--- RBK0151I: Using backuppath /media/backup.
!!! RBK0157W: No services to stop.
--- RBK0085I: Backup of type dd started. Please be patient.
31104+1 records in
31104+1 records out
31104958464 bytes (31 GB, 29 GiB) copied, 3444.55 s, 9.0 MB/s
--- RBK0078I: Backup time: 00:57:25.
!!! RBK0156W: No services to start.
--- RBK0033I: Please wait until cleanup has finished.
--- RBK0017I: Backup finished successfully.
--- RBK0010I: emoncmsrpi3: raspiBackup.sh V0.6.4.2 (2184fa5) stopped at Thu Feb 21 12:20:53 CET 2019.
emoncms@emoncmsrpi3:~ $
And on my nas, here are the files:
Next test with rsync an stopping services openhab and mosquitto before backup and staring them afterwards. Here i changed 3 rules in the raspiBackup.conf
# type of backup: dd, tar or rsync
DEFAULT_BACKUPTYPE="rsync"
# commands to stop services before backup separated by &&
DEFAULT_STOPSERVICES="systemctl stop openhab2.service && systemctl stop mosquitto.service && service feedwriter stop && service mqtt_input stop && service emoncms-nodes-service stop"
# commands to start services after backup separated by &&
DEFAULT_STARTSERVICES="systemctl start openhab2.service && systemctl start mosquitto.service && service emonhub start && service mqtt_input start && service emoncms-nodes-service start"
This is the result after waiting for some 40 mins.
emoncms@emoncmsrpi3:~ $ sudo /usr/local/bin/raspiBackup.sh /media/backup
--- RBK0009I: emoncmsrpi3: raspiBackup.sh V0.6.4.2 (2184fa5) started at Thu Feb 21 12:53:55 CET 2019.
--- RBK0151I: Using backuppath /media/backup.
--- RBK0036I: Saving partition layout.
43+1 records in
43+1 records out
46005248 bytes (46 MB, 44 MiB) copied, 6.1295 s, 7.5 MB/s
--- RBK0158I: Creating native rsync backup "/media/backup/emoncmsrpi3/emoncmsrpi3-rsync-backup-20190221-125354".
--- RBK0085I: Backup of type rsync started. Please be patient.
--- RBK0078I: Backup time: 00:12:13.
--- RBK0033I: Please wait until cleanup has finished.
--- RBK0017I: Backup finished successfully.
--- RBK0010I: emoncmsrpi3: raspiBackup.sh V0.6.4.2 (2184fa5) stopped at Thu Feb 21 13:06:32 CET 2019.
emoncms@emoncmsrpi3:~ $
So also successful, with this on the nas.
Now i know this is working, i tested the restore. Checked the device for my sd-card.
emoncms@emoncmsrpi3:~ $ sudo fdisk -l | egrep "^Disk /|^/dev"
Disk /dev/mmcblk0: 29 GiB, 31104958464 bytes, 60751872 sectors
/dev/mmcblk0p1 8192 98045 89854 43.9M c W95 FAT32 (LBA)
/dev/mmcblk0p2 98304 60751871 60653568 28.9G 83 Linux
So the sd-card device listens to the name: /dev/mmcblk0
The restore command, for a /boot and / (root) partition on the sd-card, becomes then
emoncms@emoncmsrpi3:~ $ sudo raspiBackup.sh -0 /dev/mmcblk0 /media/backup/emoncmsrpi3/emoncmsrpi3-rsync-backup-20190221-125354/
--- RBK0009I: emoncmsrpi3: raspiBackup.sh V0.6.4.2 (2184fa5) started at Thu Feb 21 14:13:40 CET 2019.
??? RBK0149E: /dev/mmcblk0 not found.
Then i realized the /dev.mmcblk0 is in use, so i tried it with an USB sd-card reader and an other sd-card, and that worked. I could start the system with the new sd-card.
Unfortunately this needs manual operation at the site where the system resides. I would like to see a solution where no manual intervention is needed, so I am able to restore from a distance. (think o f a situation when you are away for several weeks… getting a notification that something seriously is wrong and getting remote access to my local lan is no problem.)
Ok, now I know I can have some sort of rsync backup to my nas working, I will give Amanda Backup an other try with a fresh openHABbian image without any other systems like emoncms.
Will be continued…