LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   Problem Getting rsync Script to run (http://www.linuxquestions.org/questions/linux-general-1/problem-getting-rsync-script-to-run-864800/)

gjblackford 02-24-2011 11:54 AM

Problem Getting rsync Script to run
 
Hi,

I am trying to run a rsync backup Script to backup my data from my HD to my NAS Drive (currently mounted as Samba share, but can change to NFS if that would improve things, if I can work out how!), but when I run the Script I get the following error on every file it tries to copy

Code:

rsync: mkstemp "/media/NASBackups/LinBackup/Documents/Scripts/.backup.sh.lyCSGW" failed: Operation not permitted (1)
As I mentioned I am mounting my Share from my NAS as Samba and below is the fstab entry

Code:

//192.168.2.150/Backups    /media/NASBackups    smbfs    username=myuserid,password=mypwd,file_mode=0777,dir_mode=0777    0    0
the rsync command with options is as follows
Code:

rsync /media/Data/Gavin/Documents/ -r --force --delete --ignore-errors -a /media/NASBackups/LinBackup/Documents/
The error seems to be with the -a option, but I have no idea why.

Can anyone help?

Thanks,


Gavin,

colucix 02-24-2011 12:17 PM

It might depend on the actual filesystem type of the NAS drive. For example, if it is vfat you cannot store some information, like owner and group of the files. Note that the -a option is a shortcut for multiple options:
Code:

-a, --archive              archive mode; same as -rlptgoD (no -H)
so that you can explicitly apply each of them, just removing the offending ones. For example I would try without -o and -g and perhaps without -p, so that you command line should be:
Code:

rsync /media/Data/Gavin/Documents/ -rlptD --force --delete --ignore-errors /media/NASBackups/LinBackup/Documents/
Moreover you can add -vv to get a verbose output with an high level of verbosity. At least for debugging purposes.

rn_ 02-24-2011 12:28 PM

are you sure your userid has write permissions to that drive? can you manually create files and folders in that path?

gjblackford 02-24-2011 12:48 PM

Hi,

Thanks for the responses

rn_ - I definately have read/write access to the NAS I have created folders and if I remove the -a from the options, it works fine, but I would rather have this option when the backup is being performed

colucix - Just checked my NAS and it is formatted as ext3, I have also tried rsync with the Options you suggested and I get the same error.

As I mentioned without the -a switch it works fine and also if I try and copy a file manually to the NAS I have no problems. my thoughts are not I need to add something else to my fstab entry (or would NFS give me any benefits?)


Gavin,

colucix 02-24-2011 03:24 PM

Quote:

Originally Posted by gjblackford (Post 4269936)
colucix - Just checked my NAS and it is formatted as ext3, I have also tried rsync with the Options you suggested and I get the same error.

As I mentioned without the -a switch it works fine

So we have to find out which is the offending option. You should try to remove them one at a time and see what triggers this error. Then you can think about modifying the mount options in /etc/fstab if necessary.

At this point I would start by removing -p, that is run like this:
Code:

rsync /media/Data/Gavin/Documents/ -vv -rltgoD --force --delete --ignore-errors /media/NASBackups/LinBackup/Documents/
Two questions: have you tried the -vv option? Is the error related always to the same file, that is Scripts/.backup.sh.lyCSGW?

To speed up your test and limit the verbose output you can eventually try to sync only that file:
Code:

rsync /media/Data/Gavin/Documents/Scripts/.backup.sh.lyCSGW -vv -rltgoD --force --delete --ignore-errors /media/NASBackups/LinBackup/Documents/Scripts/

gjblackford 02-24-2011 04:27 PM

Hi,

Thanks for the help, the file that was listed turned out to be a temp file as I had backup.sh open in edit mode when I tried to run the backup last, but I was getting the same error for every file, I was orignally going to use the Back in Time app but I got this error with that so decided to write a simple rsync script myself!

When I try to run the command again with -vv I get the following)

Code:

rsync /media/Data/Gavin/Documents/Scripts/backup.sh -vv -rltgoD --force --delete --ignore-errors /media/NASBackups/LinBackup/Documents/Scripts/
sending incremental file list
delta-transmission disabled for local transfer or --whole-file
backup.sh
rsync: failed to set times on "/media/NASBackups/LinBackup/Documents/Scripts/.backup.sh.eqngD7": Operation not permitted (1)
total: matches=0  hash_hits=0  false_alarms=0 data=1272

sent 1364 bytes  received 31 bytes  2790.00 bytes/sec
total size is 1272  speedup is 0.91
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1060) [sender=3.0.7]

but if I remve all flags except -rl then I get the following instead, I think I tried all other combinations and still got the same error

Code:


rsync /media/Data/Gavin/Documents/Scripts/backup.sh -vv -rl --force --delete --ignore-errors /media/NASBackups/LinBackup/Documents/Scripts/
sending incremental file list
delta-transmission disabled for local transfer or --whole-file
backup.sh
total: matches=0  hash_hits=0  false_alarms=0 data=1272

sent 1347 bytes  received 31 bytes  2756.00 bytes/sec
total size is 1272  speedup is 0.92

Thanks,


Gavin,

colucix 02-25-2011 03:43 AM

The mkstemp error in post #1 means the file cannot be opened for reading/writing and most likely this is a problem with the owner of the destination directory. Apparently the /etc/fstab entry indicates the samba share is mounted with your userid, but what about the directories below the mount point? I would deeply investigate the owner/group attributes of the shared filesystem.

The failed to set times error in post #6 again let me think about a problem of ownership: you cannot change the timestamp of a directory if you're not the owner of the directory itself. And usually it needs to be changed if you want to update the content of the directory. However, rsync has an option to avoid the timestamp modification of directories, -O (uppercase o).

Hence you can try to add the -t option again in conjunction with -O. Furthermore you reported that options -o and -g fail. Definitively a ownership issue.

gjblackford 02-25-2011 02:04 PM

I had a play with changing the fstab entries from mounting the Shares as Samba to nfs and everything now works fine, so I think I must need something else in my fstab if I want to mount as Samba.

Mind you Gnome is doing something Strange it keeps giving me 2 entries in Places for my Backup Share and when I select one of them I am told that it is already busy or mounted!

But at least it seems to work.


Thanks for the help.


Gavin,


All times are GMT -5. The time now is 05:12 PM.