You are not logged in.
So, I came up with the wondrous idea of using rsync and cronjob to back up some files. for this purpose i use an SD card. with Gparted I named the card as "BU". What happens is that after a day or two (restart) it changes alone to "BU1".
What is this all about?
My Rsync command is as follows:
rsync --exclude-from '/home/pc/MEGA/Scripts/exclude.txt' -av --delete /home/pc /media/pc/BU/
Im hoping somebody can help me
Last edited by Luki (2017-03-25 19:31:55)
Offline
Easy solution: find the mount point of the SD card by its UUID instead of its filesystem label, which is best way to identify a filesystem really.
First, find the UUID:
lsblk -no NAME,UUID
A UUID might look like this: c37e0113-989a-4619-9972-c92a2b8a98b5 for Linux-native filesystems (ext, xfs) or short like: 63E8-13ED for FAT.
Then, use the following script to back up your stuff after replacing the value of NEEDLE with your UUID:
#!/bin/bash
readonly NEEDLE=877d3f4d-8290-41f8-9212-51844c5a168a
die() {
echo "$@"
exit 1
}
find_mountpoint() {
local NAME UUID MOUNTPOINT
lsblk -P -no NAME,UUID,MOUNTPOINT | while read LINE; do
eval "$LINE"
if [[ $UUID = $NEEDLE ]]; then
if [[ -n "$MOUNTPOINT" ]]; then
echo "$MOUNTPOINT"
return 0
else
return 1
fi
fi
done
return 1
}
readonly MOUNTPOINT=$(find_mountpoint) || die "Backup file system is not mounted."
echo "Found backup file system at $MOUNTPOINT, starting backup."
rsync --progress --human-readable --exclude-from '/home/pc/MEGA/Scripts/exclude.txt' -av --delete /home/pc "$MOUNTPOINT"/
This will continue to work even if the FS label changes, for whatever reason (I have no idea why this might happen without doing it manually; it could be because of the auto mounting tool/routine having a bug that mounts the fs with the unchanged label at another mount point with the '1' appended).
Offline
....
Thanks! Looks like it's working.
Offline