The setup :
- a Ubuntu server with samba shares to 25 users all with Windows (different locales).
- the Ubuntu server then has a daily cron job executed as
Admin
(notroot
) running rsync to backup the shared folders to a Synology NAS. the report of this sync is sent by email. - the Synology NAS is mounted through
/etc/fstab
on the Ubuntu server using theadmin
account credentials, the rsync is from local folder to mounted folder.
Here my /etc/fstab
line
//192.168.0.30/NetBackup /mnt/SynologyNAS/NetBackup cifs credentials=/home/admin/.nascredentials,iocharset=utf8,gid=1000,uid=1000,file_mode=0777,dir_mode=0777,rw 0 0
The problem : I have quite a few files that are copied everyday, generating a 2MB report email instead of few kB. those files are those who have a owner that is not admin.
For instance :
Admin
creates a file in the samba-shared folderPublic
, it will then be backed up by the cron job. The owner of the file in the backup folder isAdmin
. Following day, no copy happens.UserNotAdmin
creates a file in the samba-shared folderPublic
, it will then be backed up by the cron job. The owner of the file in the backup folder isAdmin
. Following day, copy happens again, and so on.
Here is my rsync line
rsync -av --no-perms --no-owner --no-group --delete /share/localFolder/ /mnt/SynologyNAS/NetBackup/remoteFolder
I also already tried
rsync -avO --delete /share/localFolder/ /mnt/SynologyNAS/NetBackup/remoteFolder
and
rsync -vrltD --delete /share/localFolder/ /mnt/SynologyNAS/NetBackup/remoteFolder
How to setup everything so that they are copied once and for all?
Your
rsync
job is not preserving owner/group information. Please add the-a
parameter to yourrsync
command (eg: usingrsync -av <src> <dst>
)