#1305 mount backup device by DEVICEUUID

This commit is contained in:
rootzoll 2020-07-04 01:00:15 +02:00
parent 1cc37451d5
commit afba3f5a8b
3 changed files with 48 additions and 13 deletions

View File

@ -939,11 +939,15 @@ The script `/home/admin/config.scripts/internet.sshpubkey.sh` helps on init, sho
To test it - open or close a channel and check if you find a copy of `channel.backup` on your remote server. You can check the background-script logs to see details on errors: `sudo journalctl -f -u background`
#### C) Local Backup Target
#### C) Local Backup Target (USB Thumbdrive)
*You can also backup the SCB to another local drive, e.g. an USB stick:*
In the `/mnt/hdd/raspiblitz.conf` the parameter `localBackupTarget='[DIRPATH-WITHOUT-ENDING-/]'` can be set to activate this feature.
You can use a small USB thumb drive (everything over 128MB is fine). Format it on your laptop as FAT32 (or ext4 if you have a linux laptop). Then plug it into a free USB port on your RaspiBlitz (use one of the USB 2 port - not the blue ones if possible).
In the `/mnt/hdd/raspiblitz.conf` the parameter `localBackupDeviceUUID='[DEVICEUUID]'` can be set to activate this feature.
The `DEVICEUUID` of your Thumbdrive you get when you see if you call on the terminal `lsblk -o NAME,SIZE,UUID`
To test it - open or close a channel and check if you find a copy of `channel.backup` in the specified location. You can check the background-script logs to see details on errors: `sudo journalctl -f -u background`

View File

@ -228,20 +228,32 @@ do
sudo mkdir -p /home/admin/backups/scb/ 2>/dev/null
sudo cp $scbPath $localBackupPath
sudo cp $scbPath $localTimestampedPath
echo "OK channel.backup copied to '${localBackupPath}' and '{$localTimestampedPath}'"
sudo cp $scbPath /boot/channel.backup
echo "OK channel.backup copied to '${localBackupPath}' and '{$localTimestampedPath}' and '/boot/channel.backup'"
# check if a local backup target is set
# check if a additional local backup target is set
# parameter in raspiblitz.conf:
# localBackupTarget='[DIRPATH-WITHOUT-ENDING-/]'
if [ ${#localBackupTarget} -gt 0 ]; then
echo "--> Onsite-Backup SCP Server"
sudo cp ${localBackupPath} ${localBackupTarget}/
sudo cp ${localTimestampedPath} ${localBackupTarget}/
result=$?
if [ ${result} -eq 0 ]; then
echo "OK - Local Backup exited with 0"
# localBackupDeviceUUID='[DEVICEUUID]'
if [ ${#localBackupDeviceUUID} -gt 0 ]; then
# check if device got mounted on "/mnt/backup" (gets mounted by _bootstrap.sh)
backupDeviceExists=$(df | grep -c "/mnt/backup")
if [ ${backupDeviceExists} -gt 0 ]; then
echo "--> Additional Local Backup Device"
sudo cp ${localBackupPath} /mnt/backup/
sudo cp ${localTimestampedPath} /mnt/backup/
# check reseults
result=$?
if [ ${result} -eq 0 ]; then
echo "OK - Sucessfull Copy to additional Backup Device"
else
echo "FAIL - Copy to additional Backup Device exited with ${result}"
fi
else
echo "FAIL - Local Backup exited with ${result}"
echo "FAIL - BackupDrive mount - check if device is connected & UUID is correct" >> $logFile
fi
fi

View File

@ -431,6 +431,7 @@ fi
#################################
sudo chown bitcoin:bitcoin -R /mnt/hdd/bitcoin 2>/dev/null
#################################
# MAKE SURE USERS HAVE LATEST LND CREDENTIALS
#################################
@ -444,6 +445,24 @@ else
echo "skipping LND credientials sync" >> $logFile
fi
################################
# MOUNT BACKUP DRIVE
# if "localBackupDeviceUUID" is set in
# raspiblitz.conf mount it on boot
################################
source ${configFile}
if [ ${#localBackupDeviceUUID} -gt 0 ]; then
echo "Mounting BackupDrive: ${${localBackupDeviceUUID}}" >> $logFile
sudo mkdir -p /mnt/backup 2>/dev/null
sudo mount --uuid ${localBackupDeviceUUID} /mnt/backup >> $logFile
mountWorked=$(df | grep -c "/mnt/backup")
if [ ${mountWorked} -gt 0 ]; then
echo "OK BackupDrive mounted to: /mnt/backup" >> $logFile
else
echo "FAIL BackupDrive mount - check if device is connected & UUID is correct" >> $logFile
fi
fi
################################
# DETECT FRESHLY RECOVERED SD
################################