Rsync to a mounted Linux CIFS share
I was in a position where I wanted to rsync some files from my Linux box to a NAS drive. The drive in question is a Lacie Internet Space (like this but white), which runs Linux. I guess because it’s designed mainly for Windows use, it uses the SMB/CIFS protocol.
In order to rsync files to the NAS, I mounted the drive with fstab. This worked OK, but when I tried to do rsync -va --del
, I got a load of permissions errors, whether I ran it as me or root. The errors meant that file metadata wasn’t being transferred, but also that locally deleted files weren’t being deleted on the NAS (making the –del option useless).
I searched and searched for the solution, and everybody seemed to have it, but nothing worked. Then I came across KaZim’s fstab page. The answer which was eluding me was to add the noperm
option to the relevant line in fstab. (Apparently it’s a problem with smb shares on Linux servers.) Here’s my working fstab entry:
//HIPSERV/MyBackup/Archie /mnt/backup cifs credentials=/root/.eve,nocase,noperm,file_mode=0777,dir_mode=0777 0 0
[It may be obvious to most people, but to mount everything in fstab do mount -a
as root.]
And here’s the working rsync:
rsync -va --del /home/nick/ /mnt/backup/