Fix rsync to NAS Copies Everything Every Time

backuplinux

I run Ubuntu Linux and use backup script that copies things over using rsync:

rsync -rc /home/user/source /media/nas/destination

or

rsync -r /home/user/source /media/nas/destination

However – it takes approximately 2.5 hours every day (i run this every day), to get it done. There is approximately 76 Gb of data over 1Gbit lan. So – basically – rsync just doesn't skip existing files in destination – it just copies everything over and over again.

I assume that the problem lies in NAS (d-link 321) and that it's a samba share that doesn't support unix persmission system – right? So this way rsync can't distinguish old files from new files – right? I've tried rsync with -c parametr (skip based on checksum, not mod-time & size) but still no dice, still takes 2.5 hours.

Can anybody suggest the way of syncing appx 70-80 Gb of data that doesn't ivolve "dumb" copying of everything every time?

Thanks:)

UPDATE

well. no luck. I've erased destination directory and and ran this twice:

rsync -r --times /home/user/source /media/nas/destination

It still took 2.5 hours both times. so it copies everything twice.

mmm. I went deeper to investigate this problem. And it looks like rsync doesn't preserve times. I've ran stat command on some files from source and destination – and Access, Modify, Change times aren't preserved on destination. I have no clue as to why does this happen…
Any other suggestions?
P.s. I relatively new to Linux – sio it can be something really dumb and silly:)

UPDATE 2
Resolved: problem as I realized stemmed from me mounting shares incorrectly. I've been mounting them like this (in /etc/fstab):

//192.168.10.199/Volume_1 /media/Volume_1 cifs   guest,rw,iocharset=utf8,file_mode=0777,dir_mode=0777 0 0

And this is what worked:

//192.168.10.199/Volume_2 /media/Volume_2 cifs    
username=sam,password=some_password,uid=developer,gid=developer,_netdev 0 0

Rsync preserves times now and only takes 3 minutes!

Best Answer

Why don't you try:

rsync -a /home/user/source /media/nas/destination

-a is convenience option specifically for archiving. It works for me all the time.

Here is what man page says:

-a, --archive archive mode; same as -rlptgoD (no -H)