I have two NAS servers which I want to sync using rsync. What path settings do I need when I have the same directory-name on both servers, and I want to synchronize both directories? It doesn’t seem to work for me. I have the directory /NAS/PICS on server 1 and /NASBACKUP/PICS on server 2. I use this command: rsync -av /mnt/HD_a2/NAS/PICS root@<ip>:/shares/NASBACKUP/PICS I end up with /shares/NASBACKUP/PICS/PICS on server 2 every time. I tried with and without trailing / on de server-1-path /mnt/HD_a2/NAS/PICS, but I don’t think it makes a difference. When I use this command with a server-1-directory which is not on server-2 (e.g. /mnt/HD_a2/NAS/PICS-TEST), then it works, but no succes when the directory already exists on both ends. Any ideas?
I will suggest you to use different mount points for the two drives e.g. One harddrive at /mnt and other at /media
I will prefer use of sshfs for that. Install sshfs in server-1 Then mount the second server2 drive as follows: where xxx.xxx.xxx.xxx will be IP of server2 Then you have mounted the remote drive locally and finally run the rsync as
Try: rsync -av /mnt/HD_a2/NAS/PICS/ root@<ip>:/shares/NASBACKUP/PICS/ you need a "/" after PICS. you have no Slash at the end of the source-path, the recent path will be created on destination .
Thanks for all the answers! I am not sure what I did wrong before, but I'm using this script now and everything works fine! #!/bin/sh # RSYNC=/usr/bin/rsync SSH=/usr/bin/ssh RUSER=root RHOST=-ip- RPATH=/mnt/HD_a2/NASBACKUP LPATH='/shares/NASBACKUP/FOTOS /shares/NASBACKUP/DOCUMENTEN /shares/NASBACKUP/VIDEO /shares/NASBACKUP/COMPLETE_SHOOTS' echo BEGIN >> /var/log/rsync.log datum=`date "+%Y%m%d_%H%M%S"` echo $datum >> /var/log/rsync.log 2>&1 $RSYNC -av --ignore-existing "$SSH" $LPATH $RUSER@$RHOST:$RPATH >> /var/log/rsync.log 2>&1 datum=`date "+%Y%m%d_%H%M%S"` echo $datum >> /var/log/rsync.log 2>&1 echo EIND >> /var/log/rsync.log
Hey guy, abit of a noob here, but maybe you can help me with this, as i have has no reply's. https://www.howtoforge.com/community/threads/stats-authentication-prompt.68443/