LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-28-2014, 08:05 PM   #1
rmcellig
Member
 
Registered: Sep 2009
Posts: 252
Blog Entries: 1

Rep: Reputation: 24
rsync not working


I am going crazy with a problem that seems really easy to resolve. This code works fine:

Code:
rsync -av  /home/randy/chuo-radio-shows/  randy@192.168.2.18:/media/masterlps/chuo-radio-shows
This one here gets me the following error:

Code:
randy@watt0s:~$ rsync -av  /home/randy/chuo-radio-shows/  randy@192.168.2.14:/media/nic/chuo-radio-shows
sending incremental file list
rsync: mkdir "/media/nic/chuo-radio-shows" failed: No such file or directory (2)
rsync error: error in file IO (code 11) at main.c(605) [Receiver=3.0.9]
rsync: connection unexpectedly closed (9 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(605) [sender=3.0.9]
randy@watt0s:~$
I have /media/nic as part of my fstab entry and it mounts fine. No problems at all. What could be causing the problem? What should I look at and post back?
 
Old 05-28-2014, 08:40 PM   #2
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora
Posts: 2,630

Rep: Reputation: 495Reputation: 495Reputation: 495Reputation: 495Reputation: 495
is it mounted when you try to run the rsync command? if its not mounted before the rsync command, rsync will not mount it for you.
 
Old 05-28-2014, 09:06 PM   #3
rmcellig
Member
 
Registered: Sep 2009
Posts: 252
Blog Entries: 1

Original Poster
Rep: Reputation: 24
Yes. /media/nic is mounted. I can use the drive from pcmanfm with no problems.
 
Old 05-29-2014, 12:17 AM   #4
potato_farmer
Member
 
Registered: May 2014
Posts: 55

Rep: Reputation: Disabled
What happens when you run the following?
ls -la /media/nic/chuo-radio-shows

Or the following?
touch /media/nic/chuo-radio-shows/file

Also, when you run rsync, make sure to keep consistent with how you end your source and dest dirs. If you have a trailing slash for one, add a trailing slash for the other.
 
Old 05-29-2014, 07:09 AM   #5
rmcellig
Member
 
Registered: Sep 2009
Posts: 252
Blog Entries: 1

Original Poster
Rep: Reputation: 24
I tried with and without the trailing slash as well. Same thing.


Code:
randy@watt0s:~$ ls -la /media/nic/chuo-radio-shows
total 0
drwxrwxr-x  2 randy randy 0 May 28 19:51 .
drwxr-xr-x 45 randy randy 0 May 28 19:51 ..
randy@watt0s:~$



Code:
randy@watt0s:~$ touch /media/nic/chuo-radio-shows/file
randy@watt0s:~$ ls
chuo-radio-shows  Desktop  Documents  Downloads  Music  Pictures
randy@watt0s:~$ cd /
randy@watt0s:/$ ls
bin   cdrom  etc   initrd.img      lib         media  opt   root  sbin     srv  tmp  var      vmlinuz.old
boot  dev    home  initrd.img.old  lost+found  mnt    proc  run   selinux  sys  usr  vmlinuz
randy@watt0s:/$ cd media/nic
randy@watt0s:/media/nic$ ls
chuo-radio-shows   Desktop    Downloads      Music  Pictures  systeminfo-Wednesday-03-July-2013-06:45:13.txt  Videos
CrashPlan.desktop  Documents  Komodo-Edit-8  Other  Public    Templates
randy@watt0s:/media/nic$ cd chuo-radio-shows/
randy@watt0s:/media/nic/chuo-radio-shows$ ls
file
randy@watt0s:/media/nic/chuo-radio-shows$
 
Old 05-29-2014, 08:05 AM   #6
michaelk
Moderator
 
Registered: Aug 2002
Posts: 16,430

Rep: Reputation: 1938Reputation: 1938Reputation: 1938Reputation: 1938Reputation: 1938Reputation: 1938Reputation: 1938Reputation: 1938Reputation: 1938Reputation: 1938Reputation: 1938
So it appears that /media/nic is the mount point for /home/nic (or /home/randy) on 192.168.2.14. The rsync command posted does not use mount point in your fstab and would reference the path /media/nic/chuo-radio-shows on 192.168.2.14 which probably does not exist.

You can rsync between mounted directories or use the actual path on 192.168.2.14.

Last edited by michaelk; 05-29-2014 at 08:08 AM.
 
Old 05-29-2014, 11:40 AM   #7
potato_farmer
Member
 
Registered: May 2014
Posts: 55

Rep: Reputation: Disabled
I should have clarified. I meant run these commands on the destination host (not the one you are running the rsync command on).

What happens when you run the following?
ls -la /media/nic/chuo-radio-shows

Or the following?
touch /media/nic/chuo-radio-shows/file
 
Old 05-29-2014, 12:32 PM   #8
rmcellig
Member
 
Registered: Sep 2009
Posts: 252
Blog Entries: 1

Original Poster
Rep: Reputation: 24
Code:
results

nicole@nicpc:~$ ls -la /media/nic/chuo-radio-shows
ls: cannot access /media/nic/chuo-radio-shows: No such file or directory
nicole@nicpc:~$ ls
chuo-radio-shows   Other
CrashPlan.desktop  Pictures
Desktop		   Public
Documents	   systeminfo-Wednesday-03-July-2013-06:45:13.txt
Downloads	   Templates
Komodo-Edit-8	   Videos
Music
nicole@nicpc:~$ touch /media/nic/chuo-radio-shows/file
touch: cannot touch `/media/nic/chuo-radio-shows/file': No such file or directory
Wouldn't this be a normal response because the mount point for this computer is on my source machine? The Dell 3000, and not on the destination machine?
 
Old 05-29-2014, 12:37 PM   #9
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,561

Rep: Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127
The command you posted would copy all files from the directory /home/randy/chuo-radio-shows/ on your local machine to the directory /media/nic/chuo-radio-shows on 192.168.2.14. Since 192.168.2.14 does not have a /media/nic/chuo-radio-shows directory, the command fails.

So, what is it exactly that you're trying to accomplish here?
 
Old 05-29-2014, 12:46 PM   #10
rmcellig
Member
 
Registered: Sep 2009
Posts: 252
Blog Entries: 1

Original Poster
Rep: Reputation: 24
There are the three instances where I am using rsync. The first two work great. The last one doesn't.

Code:
#sync chuo-radio-shows folder
*/30 * * * * rsync -av  /home/randy/chuo-radio-shows/  randy@192.168.2.13:/media/mainserver_/chuo-radio-shows
*/30 * * * * rsync -av  /home/randy/chuo-radio-shows/  randy@192.168.2.18:/media/masterlps/chuo-radio-shows
*/30 * * * * rsync -av  /home/randy/chuo-radio-shows/  randy@192.168.2.14:/media/nic/chuo-radio-shows
Here is my fstab file on my Dell (Source machine)

Code:
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda1 during installation
UUID=5d8299f1-890a-4149-a92a-71d9123006b7 /               ext4    errors=remount-ro 0       1
# swap was on /dev/sda3 during installation
UUID=6c800312-a0c3-4a70-b4b6-81b7afd78ad8 none            swap    sw              0       0
/dev/fd0        /media/floppy0  auto    rw,user,noauto,exec,utf8 0       0

#mount samba share
//192.168.2.13/mainserver /media/mainserver cifs credentials=/home/randy/.smbcredentials,uid=1000,gid=1000,iocharset=utf8,sec=ntlm 0 0
//192.168.2.11/randymac /media/imac cifs credentials=/home/randy/.smbcredentials,uid=1000,gid=1000,iocharset=utf8,sec=ntlm 0 0
//192.168.2.18/dv6home /media/dv6 cifs credentials=/home/randy/.smbcredentials,uid=1000,gid=1000,iocharset=utf8,sec=ntlm 0 0
//192.168.2.18/masterlps /media/masterlps cifs credentials=/home/randy/.smbcredentials,uid=1000,gid=1000,iocharset=utf8,sec=ntlm 0 0
//192.168.2.14/home /media/nic cifs credentials=/home/randy/.smbnicole,uid=1000,gid=1000,iocharset=utf8,sec=ntlm 0 0
Attached Thumbnails
Click image for larger version

Name:	nic.png
Views:	5
Size:	25.0 KB
ID:	15629  
 
Old 05-29-2014, 12:50 PM   #11
potato_farmer
Member
 
Registered: May 2014
Posts: 55

Rep: Reputation: Disabled
It looks like you are mounting /media/nic from the destination to the source:
//192.168.2.14/home /media/nic cifs credentials=/home/randy/.smbnicole,uid=1000,gid=1000,iocharset=utf8,sec=ntlm 0 0

Try this instead:
rsync -av /home/randy/chuo-radio-shows/ /media/nic/chuo-radio-shows/

You already mounted it right? You don't need to have rsync go to the server and look for the path (that does not exist). You can simply copy from your local source to the mount point on the local source.
 
Old 05-29-2014, 12:56 PM   #12
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,561

Rep: Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127
Alright, it looks like you're just confused about how network shares (and perhaps mounting in general) work on Linux.

When you mount a network share, for example //192.168.2.14/home to /media/nic, the remote directory 192.168.2.14:/home becomes available locally at /media/nic. 192.168.2.14:/home/myfile can be accessed locally at /media/nic/myfile.

You seem to be combining the remote access and the local access verbage in your rsync call. If you want to sync /home/randy/chuo-radio-shows on your local machine to /home/chuo-radio-shows on 192.168.2.14, you can do it using either:
Code:
rsync -av /home/randy/chuo-radio-shows/ /media/nic/chuo-radio-shows/
OR
Code:
rsync -av /home/randy/chuo-radio-shows/ 192.168.2.14:/home/chuo-radio-shows/
The first one uses the cifs remote mount to do the transfer. The second one uses rsync's default remote transfer protocol (usually ssh) to do the transfer.

You CANNOT reference your LOCAL mount point on the REMOTE filesystem, however, which is what your earlier rsync command was attempting to do. There is no /media/nic/chuo-radio-shows on 192.168.2.14, it doesn't exist. /media/nic/ on your LOCAL filesystem is a remote mount of 192.168.2.14:/home, so when YOU reference /media/nic/chuo-radio-shows on your LOCAL filesystem, you're actually pointing to 192.168.2.14:/home/chuo-radio-shows.

You need to pick which way you want to reference the remote destination. Do you want to transfer through the CIFS mount? If so, use the first rsync syntax I provided above by pointing to the mount point on your local filesystem. Do you want to transfer through rsync's default remote transfer protocol (eg: ssh)? If so, use the second rsync syntax I provided above by pointing to the remote location on the remote machine directly.

Your first two commands are only working because of a fluke. Those directories just happened to exist there, either through some freak coincidence, or because you created them for some reason. They should all be failing like the third one is.

Last edited by suicidaleggroll; 05-29-2014 at 12:58 PM.
 
Old 05-29-2014, 01:09 PM   #13
rmcellig
Member
 
Registered: Sep 2009
Posts: 252
Blog Entries: 1

Original Poster
Rep: Reputation: 24
Hi suicidaleggroll,

Thanks so much for clearing this up. I will try out both methods you described and post back. I see exactly what you are talking about now and I understand! Wow! I love learning all about Linux even though my brain gets confused at times.

I have a question. When I set up my fstab for 192.168.14 does connect regardless of who the user(s) are at the other end or is this defined in the creadentials file I created and included in the fstab entry?
 
Old 05-29-2014, 01:22 PM   #14
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,561

Rep: Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127Reputation: 2127
The cifs entry in fstab will be mounted using the credentials you provide.

If these are all Linux systems though, I would highly suggest avoiding samba and cifs and just use NFS though. NFS will handle linux file access and user permissions much cleaner than samba will, since samba is built for sharing with windows systems (and the user permission hell that entails).

With NFS, just make sure your user "randy" has the same UID on all machines, and file ownership and permissions will cross over seamlessly.

Last edited by suicidaleggroll; 05-29-2014 at 01:25 PM.
 
Old 05-29-2014, 01:25 PM   #15
rmcellig
Member
 
Registered: Sep 2009
Posts: 252
Blog Entries: 1

Original Poster
Rep: Reputation: 24
Thanks! I just wanted to make sure that I had it rock solid clear in my head. I tried rsync out and it works fine now. Glad I went through this learning process. Thank you so much!!!
 
  


Reply


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
rsync --delete not working shea1roh Linux - Software 8 08-10-2015 11:08 PM
Rsync Not Working Properly carlosinfl Linux - Software 1 07-26-2010 12:58 PM
rsync over ssh not working LocoMojo Slackware 3 01-18-2009 04:43 PM
RSYNC Not Working carlosinfl Linux - General 13 10-24-2007 02:10 PM
rcp and rsync not working at all veyden Linux - Networking 19 12-14-2005 11:08 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:40 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration