LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 02-24-2011, 11:54 AM   #1
gjblackford
Member
 
Registered: Jul 2006
Location: Reading, UK
Distribution: Ubuntu
Posts: 68

Rep: Reputation: 15
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,
 
Old 02-24-2011, 12:17 PM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
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.
 
Old 02-24-2011, 12:28 PM   #3
rn_
Member
 
Registered: Jun 2009
Location: Orlando, FL, USA
Distribution: Suse, Redhat
Posts: 127
Blog Entries: 1

Rep: Reputation: 25
are you sure your userid has write permissions to that drive? can you manually create files and folders in that path?
 
Old 02-24-2011, 12:48 PM   #4
gjblackford
Member
 
Registered: Jul 2006
Location: Reading, UK
Distribution: Ubuntu
Posts: 68

Original Poster
Rep: Reputation: 15
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,
 
Old 02-24-2011, 03:24 PM   #5
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Quote:
Originally Posted by gjblackford View Post
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/
 
Old 02-24-2011, 04:27 PM   #6
gjblackford
Member
 
Registered: Jul 2006
Location: Reading, UK
Distribution: Ubuntu
Posts: 68

Original Poster
Rep: Reputation: 15
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,
 
Old 02-25-2011, 03:43 AM   #7
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
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.
 
Old 02-25-2011, 02:04 PM   #8
gjblackford
Member
 
Registered: Jul 2006
Location: Reading, UK
Distribution: Ubuntu
Posts: 68

Original Poster
Rep: Reputation: 15
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,
 
  


Reply

Tags
problem, rsync, run, script


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Run script from cron - problem froxxiieee Linux - Software 2 07-01-2010 09:13 AM
Could I run rsync to download files from a server without rsync daemon? Richard.Yang Linux - Software 1 09-18-2009 04:08 AM
rsync: getting a script to run before/after every instance? abolishtheun Linux - General 1 04-14-2009 07:04 AM
how to write a script to know problem in network(rsync is going on) abhishekrahel Linux - Server 4 10-24-2008 12:37 AM
on Network Up Script run? On Battery power run script? v2-ncl Linux - General 0 12-08-2003 09:34 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:22 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration