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 03-19-2012, 10:25 AM   #1
JaSauders
Member
 
Registered: Oct 2011
Posts: 31

Rep: Reputation: Disabled
Rsync and .gvfs... Questions...


Something interesting about the way rsync works is it will push everything in the folder, including hidden directories. Okay fine, but .gvfs is hidden in the home directory which is where remote locations can be mounted.

Problem is, when .gvfs is taken up with rsync, it syncs that data too, even though it's essentially a duplicate. That means I could be copying the same data over again, albeit, in a slightly different location in the home directory.

AKA - home folder has contents, 1 2 3 4.

rsync -a /home/frank /media/externalhdd

Then external hdd would contain:

1 2 3 4
.gvfs/1 2 3 4

Of course, I can --exclude=.gvfs, but I'm wondering about something else. I noticed the man page had a -x flag for "do not leave file system." With gvfs being a virtual file system, would the -x flag take away the need for --exclude=.gvfs?

In other words:

rsync -ax /home/frank /media/externalhdd

Would that prevent .gvfs from traveling over rsync?

EDIT - The answer? No. I realized there was an rsync IRC chat and asked in there. One of the users said the -x flag cannot read enough of .gvfs to realize it's a separate file system, so it won't get flagged and excluded as such when the -x flag is used. Easiest thing is to just use the --exclude=.gvfs command. The only question I have now is, in 12.04 Beta that I have on my laptop, /home/user/.gvfs was moved to /home/user/.cache/gvfs, so I wonder if that will be a permanent move. Do any other distros do this by chance?

Last edited by JaSauders; 03-19-2012 at 01:31 PM.
 
Old 03-25-2012, 01:59 PM   #2
Skaperen
Senior Member
 
Registered: May 2009
Location: WV, USA
Distribution: Slackware, Ubuntu, Amazon Linux
Posts: 1,850
Blog Entries: 21

Rep: Reputation: 119Reputation: 119
Normally the -x should work on any different filesystem. But, given the tricks that were used to do .gvfs, I can believe it might not be detected properly. Normally, once mounted, it should have a different filesystem index as seen in stat().

Also, if your rsync target already has .gvfs present, then --exclude=.gvfs might not be enough to block recursion. Try: --exclude=.gvfs{,'**'}
 
Old 03-25-2012, 02:02 PM   #3
JaSauders
Member
 
Registered: Oct 2011
Posts: 31

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Skaperen View Post
Normally the -x should work on any different filesystem. But, given the tricks that were used to do .gvfs, I can believe it might not be detected properly. Normally, once mounted, it should have a different filesystem index as seen in stat().

Also, if your rsync target already has .gvfs present, then --exclude=.gvfs might not be enough to block recursion. Try: --exclude=.gvfs{,'**'}
In some previous cases, I've even accidentally allowed .gvfs then later re-added it and it still resulted in the exclusion working properly the following time I used it. I don't see why it would somehow accidentally take it even if the exclude flag was present. These flags seem pretty robust, in my opinion. Once I read more about .gvfs I could understand how the -x flag didn't work, seeing as though .gvfs was designed to be a transparent as possible and all.
 
Old 03-25-2012, 04:28 PM   #4
Skaperen
Senior Member
 
Registered: May 2009
Location: WV, USA
Distribution: Slackware, Ubuntu, Amazon Linux
Posts: 1,850
Blog Entries: 21

Rep: Reputation: 119Reputation: 119
It can depend on whether it is detected as a directory, past or present, and previous copied as a directory. It can matter, for example, if it was mounted or not. This .gvfs stuff has been known to cause problems. Some programs abort when they get stat() errors from it.
 
Old 03-25-2012, 05:06 PM   #5
JaSauders
Member
 
Registered: Oct 2011
Posts: 31

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Skaperen View Post
It can depend on whether it is detected as a directory, past or present, and previous copied as a directory. It can matter, for example, if it was mounted or not. This .gvfs stuff has been known to cause problems. Some programs abort when they get stat() errors from it.
Right, I understand that. I just don't understand how rsync could get confused about .gvfs if you're excluding .gvfs to begin with. I would think (and it's operated as such in my experience) as rather clean and clear... unless I'm misunderstanding what you meant about potentially needing --exclude=.gvfs{,'**'} ???
 
Old 03-26-2012, 03:30 PM   #6
Skaperen
Senior Member
 
Registered: May 2009
Location: WV, USA
Distribution: Slackware, Ubuntu, Amazon Linux
Posts: 1,850
Blog Entries: 21

Rep: Reputation: 119Reputation: 119
Quote:
Originally Posted by JaSauders View Post
Right, I understand that. I just don't understand how rsync could get confused about .gvfs if you're excluding .gvfs to begin with. I would think (and it's operated as such in my experience) as rather clean and clear... unless I'm misunderstanding what you meant about potentially needing --exclude=.gvfs{,'**'} ???
If it were a directory AND if the target already has a directory, then the --exclude for just the directory is moot. It has no effect. Files in that directory at the source do not match that --exclude pattern, and can be copied. The --exclude option does NOT mean to exclude a whole tree. It just adds a pattern to a list (the additions are in the order of the options) of patterns used to compare a filesystem object name to see if it should be transfered or not. If the target already has the object, this check is not even performed since it is moot. The pattern check for include and exclude is performed only if a transfer would otherwise need to be done ... for that ONE object.

The option: --exclude=foo{./'**'}
will expand to: --exclude=foo --exclude=foo/'**'
The directory foo will match the first, while all things in that directory will match the second.

If you used: --exclude=foo --include=foo/'**'
then the effective mean of that is "transfer the subtree if and only if the directory already exists at the target, but don't transfer the directory itself if it does not already exist at the target" (and hence the tree cannot then be transferred). It's actually a nice logic trick I've used before.

Of course the ".gvfs" case is messier because of filesystem issues in how this object is defined. It may be a directory sometimes (like if something is mounted there). If an rsync run had been made in the past without the --exclude, it could have copied that directory to the target. That could change how things get handled when only ONE --exclude is used. If later, it is a directory again, AND it has files in it, then those files would be copied even if --exclude=.gvfs is coded (because it doesn't need to copy the directory itself, so it would never run that name through the exclude pattern check).
 
Old 03-26-2012, 05:07 PM   #7
JaSauders
Member
 
Registered: Oct 2011
Posts: 31

Original Poster
Rep: Reputation: Disabled
I see what you're saying. But from actual experience, I've witnessed this exact scenario more than once:

Ran rsync without excluding .gvfs. When I saw the super long transfer, I realized .gvfs was in the mix. I canceled rsync and ran rsync again with .gvfs excluded. It ignored .gvfs on the 2nd pass, even though .gvfs already existed on the destination.

Considering I've consistently seen the exact same results from having .gvfs on the destination, then excluding it, and running it again and it still excludes fine, I just wonder what would have to happen for it to fumble....
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
rsync questions jsteel Linux - General 2 07-05-2010 10:52 AM
rsync questions crazy8 Linux - Newbie 11 04-05-2008 01:59 PM
Rsync Questions progrock Linux - Networking 2 11-14-2007 12:41 PM
rsync questions slack66 Linux - General 4 11-05-2005 01:31 AM
rsync questions csross Linux - General 3 06-25-2004 11:10 AM

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

All times are GMT -5. The time now is 07:51 PM.

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