My first post on here.
I am trying to backup all data files from one server to another. The data can be owned by several users or by reserved nologin users.
I am trying to create a remote mirror of all users files. Ready for restoring at a later date.
I have searched on here and lots of googling but all the solutions involve changing ownership of the file or other fiddles.
I have samba and nfs(export) shares.
The system is 2 raspberry PIs each with several multibay usb drives, so raspbian/debian based.
My best solution so far is:
cat /etc/scripts/backup_data4.sh
if [ -e /mnt/data4_B/B4 ]; then
printf "There is a B4 marker\n"
sudo rsync -avz -e ssh /mnt/data4/git /mnt/data4_B/
sudo rsync -avz -e ssh /mnt/data4/stacking2 /mnt/data4_B/
else
printf "B4 does not exist\n"
fi
where /mnt/data4_B is a mounted exported drive on backup server.
/etc/exports
/mnt/data1/ 192.168.0.160(rw,sync,no_subtree_check)
/mnt/data2/ 192.168.0.160(rw,sync,no_subtree_check)
/mnt/data3/ 192.168.0.160(rw,sync,no_subtree_check)
/mnt/data4/ 192.168.0.160(rw,sync,no_subtree_check)
/mnt/data5/ 192.168.0.160(rw,sync,no_subtree_check)
/mnt/data6/ 192.168.0.160(rw,sync,no_subtree_check)
/mnt/data7/ 192.168.0.160(rw,sync,no_subtree_check)
/mnt/data8/ 192.168.0.160(rw,sync,no_subtree_check)
This script does work to a point but I have lots of issues with ownership and permissions on the backup server.
Any suggestions welcome. Thanks.
Extra Added.
user names, UID and GID are identical on both systems.
I can't find any way to use:
rsync -av fromdir user@server:todir
that can handle multiple users files.