LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Rsync Issue (https://www.linuxquestions.org/questions/linux-newbie-8/rsync-issue-730989/)

deibertine 06-05-2009 02:56 PM

Rsync Issue
 
Hi all,

I'm trying to do backups using rsync. The idea is to backup all of my configs into a windows mounted drive from my unix box so I had this cifs share mounted on /mnt/shared.

I also have a script setup to run every week which has these syntax:
#!/bin/sh
rsync -arz /usr/local/importantdir* /mnt/shared
rsync -arz /usr/local/veryimportantdir* /mnt/shared
rsync -arz /usr/local/absolutelyimportantdir* /mnt/shared
rsync -arz /usr/local/itwouldloosemyjobimportantdir* /mnt/shared

The windows share is mounted via automount in /etc/fstab:
//csaa-dev2/unixbackup /mnt/shared cifs username=asqluid,password=p@r@n01d 0 0

However when I test one of the syntax making sure it runs, I'm getting this error:
rsync: mkstemp "/mnt/shared/.import.log.K4IRFz" failed: Operation not permitted (1)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1039) [sender=3.0.6]

I have permissions setup on both the unix side and most importantly in the windows shared folder to the same username=asqluid,password=p@r@n01d credentials in which from the unix box, I can create/delete a file/folder under the asqluid user.

Can someone please advise me on what's wrong? Am I missing something? :confused:

I'd appreciate it!

Thanks,
DB

pkraus109 06-05-2009 03:06 PM

What are the actual unix permissions on the /mnt/shared. What user are you. It sounds like a permission issue. Try it as root or from sudo just to rule it out.

"I have permissions setup on both the unix side and most importantly in the windows shared folder to the same username=asqluid,password=p@r@n01d credentials in which from the unix box, I can create/delete a file/folder under the asqluid user. "

You can create it from *nix or from windows?

Also make sure you have permission on the source directories aswel. Again doing it as sudo or root will rule out permission issues.

deibertine 06-05-2009 03:51 PM

Rsync Issue
 
Quote:

Originally Posted by pkraus109 (Post 3564556)
What are the actual unix permissions on the /mnt/shared. What user are you. It sounds like a permission issue. Try it as root or from sudo just to rule it out.
"I have permissions setup on both the unix side and most importantly in the windows shared folder to the same username=asqluid,password=p@r@n01d credentials in which from the unix box, I can create/delete a file/folder under the asqluid user. "
You can create it from *nix or from windows?
Also make sure you have permission on the source directories aswel. Again doing it as sudo or root will rule out permission issues.


Ok you kind of gave me an idea there my friend but still having issues. :(
Well I ran the script under root but got this error:
rsync: recv_generator: failed to stat "/mnt/shared/impt.tar.gz": Permission denied (13)
rsync: symlink "/mnt/shared/xconsole.txt" -> "/usr/local/important/imp.txt" failed: Operation not supported (95)


Here are the permissions under /mnt/shared:
[root@csaa-dev2]# ls -als /mnt/shared
total 400
0 drwxrwxrwx 1 root root 0 Jun 5 13:20 .
8 drwxrwxr-x 3 root root 4096 Jun 5 12:07 ..
0 drwx------ 1 asqluid asqluid 0 Jun 5 13:11 asqluid
0 drwxrwxrwx 1 root root 0 Aug 17 2007 importantdir
128 -rw-r--r-- 1 root root 129719 Mar 4 2008 CollabConsole_archive.txt
0 drwxrwxrwx 1 asqluid3 asqluid3 0 Feb 5 07:40 asqluid3
0 drwxr-xr-x 1 asqluid4 asqluid4 0 Apr 15 11:58 asqluid4
0 drwxrwxrwx 1 root root 0 Jun 5 11:48 F$ILES
0 drwxrwxr-x 2 root root 0 Jun 5 12:08 Rest
8 -rw-r--r-- 1 root root 6960 Jan 9 2004 Reaig.sog
0 drwxr-xr-x 1 root root 0 May 15 2008 asqluid7
256 -rw-r--r-- 1 root root 261970 Jun 4 15:42 asqlbackup.log

Should I change the owner/group permissions on all files/dir in /mnt/shared to asqluid so that the script can write completely to it?

Under asqluid id in my unix box, I can create files/folders no problems in /mnt/shared.

Please advise.

Thanks!
DB

david1941 06-05-2009 04:20 PM

You might add the --copy-unsafe-links option to rsync

Dave

pentode 06-05-2009 04:40 PM

"Windows mounted drive"? What filesystem is this drive using? rsync only works with filesystems (for destination) that support hardlinks. Such as a Linux file system (ext3, etc). Certainly won't work on a FAT32 drive (been there, tried that) and I don't think it will work on an NTFS drive.

deibertine 06-05-2009 04:48 PM

Ok, I've made a little progress, I think. :)
After researching on this this it turned out that I need to invoke sudo with rsync.
However having sudo there means I have to add asqluid to the sudoers file which will give the user rights to launch any command in the unix box.

General question: If I add asqluid to the sudoers file, will it have the same rights as root and will be a local admin user to the box?

Getting back to my rsync issue, after launching the script with sudo:
sudo rsync -arzl /usr/local/importantdir /mnt/shared

Now I'm getting this error:
rsync: recv_generator: mkdir "/mnt/shared/Dir/Tration/ava/re/.systemPrefs/com/intraspect/patches/_!$c!.g!x!#4!:!!u!$:!;g!1" failed: No such file or directory (2)
*** Skipping any contents from this failed directory ***

Any idea on what's wrong?

Thanks!

deibertine 06-05-2009 04:57 PM

Rsync Issue
 
Quote:

Originally Posted by pentode (Post 3564634)
"Windows mounted drive"? What filesystem is this drive using? rsync only works with filesystems (for destination) that support hardlinks. Such as a Linux file system (ext3, etc). Certainly won't work on a FAT32 drive (been there, tried that) and I don't think it will work on an NTFS drive.

Thanks for those additional notes.

It's a Windows 2003 server on the share drive so NTFS.

That's weird you said that as it does create "some" of the backup (files/directories/folder) via the script but not understanding on why I'm getting those errors.

Verified after testing the script that it does syncs some of the files in the mounted drive.

I've mounted it via cifs (also tried smbfs).

Any other ideas?

deibertine 06-05-2009 05:02 PM

Rsync Issue
 
Quote:

Originally Posted by david1941 (Post 3564617)
You might add the --copy-unsafe-links option to rsync

Dave

Sorry, no go. :(

# rsync -arzl --copy-unsafe-links /usr/local/importantdir /mnt/shared
rsync: recv_generator: mkdir "/mnt/shared/importantdir/va/jre/.systemPrefs/com/intraspect/patches/_!$c!.g!x!#4!:!!u!$:!;g!1" failed: No such file or directory (2)
*** Skipping any contents from this failed directory ***
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1039) [sender=3.0.6]

deibertine 06-09-2009 11:49 AM

Cant seem to figure this one out.
I have just merged out of rsync and instead used a typical bash script by using "tar" to backup my files.
Here's the tutorial I followed:
http://www.linuxconfig.org/Bash_scripting_Tutorial


Thanks for all the help!


All times are GMT -5. The time now is 11:26 AM.