Backing up to NAS with rsync

Linux Kernel, Network, and Services configuration.
Post Reply
Message
Author
User avatar
ramack
Posts: 500
Joined: 2008-01-28 15:31
Location: Centennial, CO
Has thanked: 6 times

Backing up to NAS with rsync

#1 Post by ramack »

Last month I bought a Zyxel NAS326 (RAID 1 2x 4TB HDD) to use as a backup target for my Debian desktop and a couple of Windows laptops. From my Debian machine I mount the NAS
sudo -s mount -v -t cifs -o username=username,uid=1000,gid=1000 //192.168.1.XX/username/ /home/username/NAS326/

Then I use rsync to backup to the NAS
rsync -vartH --exclude={'.*','NAS326'} /home/username/ /home/username/NAS326/DesktopBackUp/username/

All files are being copied each time, so the date, file size, or something else isn't being compared correctly. This seems to be a somewhat common issue, but I haven't been able to find a solution yet. The closest I've found is here:
https://serverfault.com/questions/26241 ... every-time

Any ideas? Maybe mount as or with a different FS other than cifs?
homemade AMD64, Acer AspireOne 150, Asus eeePC 900, i386; Testing
i386,Dell Vostro 1000 AMD64, Dell Inspiron 1100; Sid
XFCE on all.

lindi
Debian Developer
Debian Developer
Posts: 575
Joined: 2022-07-12 14:10
Has thanked: 2 times
Been thanked: 115 times

Re: Backing up to NAS with rsync

#2 Post by lindi »

Can you SSH to the NAS? Does the NAS have rsync?

User avatar
donald
Debian Developer, Site Admin
Debian Developer, Site Admin
Posts: 1362
Joined: 2021-03-30 20:08
Has thanked: 243 times
Been thanked: 296 times

Re: Backing up to NAS with rsync

#3 Post by donald »

rsync -avzxtH

-a Archive
-v Be verbose
-z Compress files during transfer
-x Don't cross filesystem boundaries (I.E. stay within mount points)
-t Copy transfer times
-H Preserve hard links
Typo perfectionish.


"The advice given above is all good, and just because a new message has appeared it does not mean that a problem has arisen, just that a new gremlin hiding in the hardware has been exposed." - FreewheelinFrank

User avatar
ramack
Posts: 500
Joined: 2008-01-28 15:31
Location: Centennial, CO
Has thanked: 6 times

Re: Backing up to NAS with rsync

#4 Post by ramack »

lindi wrote: 2023-01-05 20:25 Can you SSH to the NAS? Does the NAS have rsync?
I"m not near it, but I'm pretty sure I can ssh into it and yes it does have rsync.
homemade AMD64, Acer AspireOne 150, Asus eeePC 900, i386; Testing
i386,Dell Vostro 1000 AMD64, Dell Inspiron 1100; Sid
XFCE on all.

User avatar
ramack
Posts: 500
Joined: 2008-01-28 15:31
Location: Centennial, CO
Has thanked: 6 times

Re: Backing up to NAS with rsync

#5 Post by ramack »

donald wrote: 2023-01-05 21:23 rsync -avzxtH

-a Archive
-v Be verbose
-z Compress files during transfer
-x Don't cross filesystem boundaries (I.E. stay within mount points)
-t Copy transfer times
-H Preserve hard links
I'll add the x and z options, run the command and report back with the results.

Thanks to both of your for the suggestions.
homemade AMD64, Acer AspireOne 150, Asus eeePC 900, i386; Testing
i386,Dell Vostro 1000 AMD64, Dell Inspiron 1100; Sid
XFCE on all.

lindi
Debian Developer
Debian Developer
Posts: 575
Joined: 2022-07-12 14:10
Has thanked: 2 times
Been thanked: 115 times

Re: Backing up to NAS with rsync

#6 Post by lindi »

The point is that if it has ssh and rsync you could omit cifs completely. If you run rsync against a locally mounted cifs filesystem it is going to need to download all metadata locally to do the comparison. If you use rsync with ssh it will do this on the NAS itself.

User avatar
ramack
Posts: 500
Joined: 2008-01-28 15:31
Location: Centennial, CO
Has thanked: 6 times

Re: Backing up to NAS with rsync

#7 Post by ramack »

lindi wrote: 2023-01-06 10:46 The point is that if it has ssh and rsync you could omit cifs completely. If you run rsync against a locally mounted cifs filesystem it is going to need to download all metadata locally to do the comparison. If you use rsync with ssh it will do this on the NAS itself.
Looks like I can only ssh into the NAS with the admin account and not a regular user despite having regular user sub-directories in /home. I'm looking into see why that is...I would have thought that any user could ssh into the NAS. I don't use ssh much, but i've been able to ssh into other Linux boxes on LANs as long as I knew the username & password which was typically my account, just on a different Linux machine on the same network.
homemade AMD64, Acer AspireOne 150, Asus eeePC 900, i386; Testing
i386,Dell Vostro 1000 AMD64, Dell Inspiron 1100; Sid
XFCE on all.

reinob
Posts: 1231
Joined: 2014-06-30 11:42
Has thanked: 117 times
Been thanked: 54 times

Re: Backing up to NAS with rsync

#8 Post by reinob »

Check if your NAS supports the rsync daemon (vs cifs, ssh, etc.)

Then you can use something like

Code: Select all

rsync -av /home/username/ user@server::module
(where in the server you define the "module" module as pointing to the appropriate directory).

User avatar
ramack
Posts: 500
Joined: 2008-01-28 15:31
Location: Centennial, CO
Has thanked: 6 times

Re: Backing up to NAS with rsync

#9 Post by ramack »

reinob wrote: 2023-01-09 12:58 Check if your NAS supports the rsync daemon (vs cifs, ssh, etc.)

Then you can use something like

Code: Select all

rsync -av /home/username/ user@server::module
(where in the server you define the "module" module as pointing to the appropriate directory).
Only root/admin can.
homemade AMD64, Acer AspireOne 150, Asus eeePC 900, i386; Testing
i386,Dell Vostro 1000 AMD64, Dell Inspiron 1100; Sid
XFCE on all.

Post Reply