Rsync to NAS

Interesting inconsistency re sec=sys, as my /proc/mounts has nfs4 sec=sys, and /proc/mounts is supposed to only show active options, unlike /etc/mtab, I was going to say, however these days it seems /etc/mtab → …/proc/self/mounts.

idmapd is supposed to work but need to poke /sys/module/nfs/parameters IIRC, possibly on both ends. Doco implies idmapd is NFSv4 only. One of these things I’m still waiting for a round tuit.

Indeed, I got this info from the Arch’s wiki.

I have been reading a lot of stuff from Synology, and it seems that they are very “locked” in their way of doing things…

Tests are over now. Using NTFS 4.1, domain set for it is home.arpa.

NAS config:

  • domain set in NFS 4.1: home.arpa
  • Map all users to admin
  • Sec=Sys
  • Read and write

No further permissions are required to that folder, only NFS permissions are required.
Enabled rsync, default settings.

EnOS config:

  • Set the Domain inside /etc/idmapd.conf to Domain = home.arpa
  • fstab entry:

192.168.255.252:/volume1/EOS_BACKUP /mnt/EOS_BACKUP nfs _netdev,noauto,x-systemd.automount,x-systemd.mount-timeout=30,timeo=14,x-systemd.idle-timeout=20min,vers=4.1 0 0

rsync command that I’m using and it is preserving everything when I restore the files:

rsync -aAxhH --delete myuser@mynas:/volume1/EOS_BACKUP/Documentos2/ /home/myuser/Documentos2/

Thanks everyone for the help, now I can backup any folder from my system to my NAS without the need to worry about permissions, ownership and etc… :slight_smile:

1 Like

Perhaps not the best way of doing things but for me it is working flawlessly.

Firefox backup
rsync -aAxhH --delete /home/myuser/.mozilla/ myuser@mynas:/volume1/EOS_BACKUP/.mozilla/
rsync -aAxhH --delete /home/myuser/.cache/mozilla/ myuser@mynas:/volume1/EOS_BACKUP/.cache/mozilla/
Firefox restore
rsync -aAxhH --delete myuser@mynas:/volume1/EOS_BACKUP/.mozilla/ /home/myuser/.mozilla/
rsync -aAxhH --delete myuser@mynas:/volume1/EOS_BACKUP/.cache/mozilla/ /home/myuser/.cache/mozilla/
Thunderbird backup
rsync -aAxhH --delete /home/myuser/.thunderbird/ myuser@mynas:/volume1/EOS_BACKUP/.thunderbird/
rsync -aAxhH --delete /home/myuser/.cache/thunderbird/ myuser@mynas:/volume1/EOS_BACKUP/.cache/thunderbird/
Thunderbird restore
rsync -aAxhH --delete myuser@mynas:/volume1/EOS_BACKUP/.thunderbird/ /home/myuser/.thunderbird/
rsync -aAxhH --delete myuser@mynas:/volume1/EOS_BACKUP/.cache/thunderbird/ /home/myuser/.cache/thunderbird/
Signal backup
rsync -aAxhH --delete /home/myuser/.config/Signal/ myuser@mynas:/volume1/EOS_BACKUP/.config/Signal/
Signal restore
rsync -aAxhH --delete myuser@mynas:/volume1/EOS_BACKUP/.config/Signal/ /home/myuser/.config/Signal/
1 Like

Just to add as a note here, if you copy the ssh keys, things will get much easier.
Just type: ssh-copy-id myuser@mynas

Then, include this in the rsync command after the --delete:

-e "ssh -i $HOME/.ssh/id_rsa.pub"

Like this:

rsync -aAxhH --delete -e "ssh -i $HOME/.ssh/id_rsa.pub" /home/myuser/.mozilla/ myuser@mynas:/volume1/EOS_BACKUP/.mozilla/

Now, you can create a file and put it into /usr/bin, give it +x attribute and you are done, backup and restore with one command, and no passwords will be asked.

Assuming that no password is associated with the key, or it is already loaded into your agent.

Or you could generate a special nas sync key without a password, which you then are able to to lock down to specific tasks / configuration in the remote sshd_config or remote .ssh/authorized_keys.

You can also bind specific keys to a host by configuring the host in .ssh/config, so you only have to do it once and it applies every time you use ssh to that host any way.