Problem backing up read-only files

Gary Johnson garyjohn at spocom.com
Thu Jul 22 19:04:14 MDT 2010


I have a PC on which I run Windows XP and Cygwin 1.5.  To this is
attached an HP Media Vault mv2120 via Ethernet through a switch.
I can copy files back and forth between the XP machine and the
Media Vault, so that much seems to work fine.

I would like to use rsync to back up some of the files on the XP
machine to the Media Vault.  This seems to work as it should as long
as the files have write permission, but rsync fails to copy files
that have only read permission.

To demonstrate this, I created an 'rstest' directory under my Cygwin
home directory and created in it two files, one with default
permissions and the other without write permissions.

    bash-3.2$ mkdir rstest
    bash-3.2$ cd rstest
    bash-3.2$ echo "hello, world" > rstest1.txt
    bash-3.2$ echo "hello, world" > rstest2.txt
    bash-3.2$ chmod -w rstest1.txt 
    bash-3.2$ ll
    total 2
    -r--r--r-- 1 Gary Johnson None 13 Jul 22 17:02 rstest1.txt
    -rw-r--r-- 1 Gary Johnson None 13 Jul 22 17:02 rstest2.txt

On the Media Vault, I created another 'rstest' directory.

    bash-3.2$ mkdir //hpmediavault/Documents/rstest
    bash-3.2$ ll -d //hpmediavault/Documents/rstest
    drwxr-xr-x 1 Gary Johnson None 0 Jul 22 17:04 //hpmediavault/Documents/rstest

Then I attempted to transfer both files to the 'rstest' directory on
the Media Vault.

    bash-3.2$ rsync -avv * //hpmediavault/Documents/rstest
    sending incremental file list
    delta-transmission disabled for local transfer or --whole-file
    rstest1.txt
    rstest2.txt
    rsync: rename "/hpmediavault/Documents/rstest/.rstest1.txt.uCmUNq" -> "rstest1.txt": Permission denied (13)
    total: matches=0  hash_hits=0  false_alarms=0 data=26

    sent 188 bytes  received 50 bytes  476.00 bytes/sec
    total size is 26  speedup is 0.11
    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 1024
    -rw-r--r-- 1 Gary Johnson None 13 Jul 22 17:02 rstest2.txt

I thought that I might be able to work around the problem by
omitting the -a flag, which implies -p, but the results were
exactly the same.

I am able to copy read-only files and preserve their permissions by
using "tar cf" and "tar xf" in a pipeline, and that works fine for
an initial backup, but for subsequent backups I really need a way to
copy only those files that have changed.

What can I do to fix or work around this problem?

The version of rsync I'm using on Cygwin is

    rsync  version 3.0.4  protocol version 30
    Copyright (C) 1996-2008 by Andrew Tridgell, Wayne Davison, and others.
    Web site: http://rsync.samba.org/
    Capabilities:
        64-bit files, 64-bit inums, 32-bit timestamps, 64-bit long ints,
        socketpairs, hardlinks, symlinks, no IPv6, batchfiles, inplace,
        append, ACLs, no xattrs, iconv, symtimes

Regards,
Gary



More information about the rsync mailing list