Page 1 of 1

RSYNC and symlinks

Posted: Mon Aug 17, 2020 2:02 pm
by turbine2
Hi everyone,
I've had a look around and I can't see anything directly that looks like this problem.

I have a raspberry pi (what a surprise) that I want to back up the SD card to as a hot backup. To do this I have a mount on an ASUSTOR NAS that is mounted to \mnt\backups\

The FSTab entry is this:-

Code: Select all

//xxx.xxx.xxx.xxx/Backups /mnt/backup cifs username=xxxxxx,password=xxxxxxxx,vers=3.0,users,auto,user_xattr,sfu 0 0
As I understand it the sfu option should allow me to backup the symlinks, however when I run the script to backup I get the following error for several of the files

Code: Select all

rsync: symlink "/mnt/backup/piserver/lib/systemd/system/fuse.service" -> "/dev/null" failed: Operation not supported (95)
The rsync line I am using is:-

Code: Select all

rsync -avH --delete-during --delete-excluded --exclude-from=/usr/bin/rsync-exclude.txt / /mnt/backup/$HOSTNAME/
I'm guessing that this is a limitation of the ASUSTOR rsync, but wanted to check if there is something else I should be looking at.

Also, is there a way that I can force fstab to use the IPV4 address rather than the IPV6 one? I can resolve both, but the IPV6 is external so routing becomes an issue.

Many thanks,

David

Re: RSYNC and symlinks

Posted: Mon Aug 17, 2020 2:41 pm
by Kendek
/etc/rsyncd.conf:

Code: Select all

uid = root
gid = root
read only = false
use chroot = no
dont compress = *

[backups]
path = /Backups

Code: Select all

> rsync -aAXxh --progress --delete / 192.168.1.x::backups
or reverse:

Code: Select all

uid = root
gid = root
read only = false
use chroot = no
dont compress = *

[system]
path = /

Code: Select all

> rsync -aAXxh --progress --delete 192.168.1.x::system /Backups

Re: RSYNC and symlinks

Posted: Tue Aug 18, 2020 1:59 pm
by turbine2
Um, I'm not sure what you're telling me there, would you mind expanding on that and how it solves my symlinks problem please?

Re: RSYNC and symlinks

Posted: Tue Aug 18, 2020 2:17 pm
by bls
turbine2 wrote:
Tue Aug 18, 2020 1:59 pm
Um, I'm not sure what you're telling me there, would you mind expanding on that and how it solves my symlinks problem please?
He's suggesting a different method of accessing files on a remote system using rsync, instead of using CIFS. This will work well if xxx.xxx.xxx.xxx is a Linux system of some sort that you can start the rsyncd service on. 'man rsyncd.conf' will give you details on the config file.

If you are able to start an rsyncd service on your ASUSTOR, rsyncd would be a much better way to go than using CIFS.

You might be able to make your backups work with your current configuration if you review the rsync command format carefully (man rsync), especially the switches "-l" (lower case L), -L, --copy-unsafe-links, --safe-links, --munge-links, --copy-dirlinks, and --keep-dirlinks.Sorry, I've not actually used any of these, but looking at 'man rsync' and searching for symlink, these all popped up.

Re: RSYNC and symlinks

Posted: Tue Aug 18, 2020 2:39 pm
by Kendek
Yes, or use rsync over SSH, but not CIFS or any other similar protocol. Rsyncd is the best choice inside local network for compatibility and performance reasons. SSH may be a bit slower due to encryption.

Code: Select all

> rsync -aAXxh --progress --delete / root@192.168.1.x:/Backups

Re: RSYNC and symlinks

Posted: Fri Aug 21, 2020 7:14 pm
by turbine2
Ah, I see, thank you for the clarification. I think the Asustor uses busybox Linux as it’s o/s. I will have a look at those options.

Thanks for the help.

Re: RSYNC and symlinks

Posted: Tue Sep 15, 2020 9:42 am
by turbine2
Thanks to Kendek and bls I have managed to fix this.

In the end I scrapped the idea of using a mounted share to do the rsync and used SSH key logins between the Pi and the Asustor to do the rsync backup. Unfortunately due to the 'security settings' of the Asustor I have to do that a the Asustor's root user rather than the backup user I intended but it's working now.

Goodness only knows why I started down the route of a mounted drive because that's not how I use rsync on other systems.