Problem backing up read-only files

Matt McCutchen matt at mattmccutchen.net
Thu Jul 22 21:03:14 MDT 2010


On Thu, 2010-07-22 at 19:57 -0700, Gary Johnson wrote:
> On 2010-07-23, Alex Ferrara wrote:
> > Hi Gary,
> > 
> > It looks like the problem occurs after rsync has transferred the
> > file and is renaming the temporary file to the actual name. I am
> > guessing that the HP media vault has Samba running on it, and it
> > is actually denying access.
> > 
> > As a long show, you could try --inplace, which will mean rsync
> > does not need to rename the file.
> 
> That worked for the initial transfer of that read-only file, but ne
> 
>     bash-3.2$ touch *
>     bash-3.2$ ll
>     total 2
>     -r--r--r-- 1 Gary Johnson None 13 Jul 22 19:46 rstest1.txt
>     -rw-r--r-- 1 Gary Johnson None 13 Jul 22 19:46 rstest2.txt
>     bash-3.2$ rsync -vv --inplace * //hpmediavault/Documents/rstest
>     delta-transmission disabled for local transfer or --whole-file
>     rstest1.txt
>     rstest2.txt
>     rsync: open "/hpmediavault/Documents/rstest/rstest1.txt" failed: Permission denied (13)
>     total: matches=0  hash_hits=0  false_alarms=0 data=26
> 
>     sent 159 bytes  received 50 bytes  418.00 bytes/sec
>     total size is 26  speedup is 0.12
>     rsync error: some files/attrs were not transferred (see previous errors) (code 23) at /home/lapo/packaging/rsync-3.0.4-1/src/rsync-3.0.4/main.c(1040) [sender=3.0.4]
>     bash-3.2$ ll //hpmediavault/Documents/rstest
>     total 2048
>     -r-------- 1 Gary Johnson None 13 Jul 22 19:42 rstest1.txt
>     -rw------- 1 Gary Johnson None 13 Jul 22 19:46 rstest2.txt
> 
> I guess that's to be expected since the man page says, in the
> description of the --inplace option,
> 
>     (4) a file that does not have write permissions can not be
>     updated,
> 
> That will let me do the initial backup of several more files that
> happen to be read-only, but unfortunately doesn't solve the problem
> in the long term.

Try --chmod=u+w .

One can generally copy read-only files to a unix filesystem with no
trouble, because on a unix filesystem, renames check only the directory
permissions, not the file permissions.  (As for read-only directories,
rsync is smart enough to temporarily enable user-write permission while
it processes them.)  But with a non-conformant destination filesystem,
it looks like --chmod=u+w is the only thing that will solve your issue.

-- 
Matt



More information about the rsync mailing list