3

I've noticed some issues with rsync and .gvfs over the years. Typically I just --exclude=.gvfs in my rsync command and call it a day.

Recently I decided to read the rsync man page top to bottom left to right. After all, what better way to learn? Man pages are quicker than Googling, if you ask me. I had noticed the -x flag, which was cited to not cross other file systems. I began to wonder what exactly that meant and thought... would -x also ignore .gvfs, being a virtual file system?

That said, would:

rsync -a --exclude=.gvfs /home/jason /media/externalhdd

(be kind of the same as)

rsync -ax /home/jason /media/externalhdd

????

2 Answers 2

1

Yes, it should be the same.

To check for sure: run stat on your two directories: /home/jason and /home/jason/.gvfs. The stat output will show a "device" entry:

[jk@pecola ~]$ stat $HOME
  File: `/home/jk'
  Size: 4096        Blocks: 8          IO Block: 4096   directory
Device: 803h/2051d  Inode: 5242881     Links: 65
Access: (0755/drwxr-xr-x)  Uid: ( 1000/      jk)   Gid: ( 1000/      jk)
Access: 2012-03-19 11:53:31.209584100 +0800
Modify: 2012-03-19 11:50:42.941630852 +0800
Change: 2012-03-19 11:50:42.941630852 +0800
 Birth: -

-- it's the first item in the third line. The number is shown twice: in hex ('h' suffix), and in decimal ('d' suffix).

If these numbers are different between the two directories, they're considered to be on different device, so the -x option will prevent rsync from traversing to this directory.

7
  • Thanks for the info. I'll likely just leave the --exclude tag in there, but I was curious if -x by nature handled the very task I was accomplishing with --exclude=.gvfs. Now help me out here. I'm trying to understand what happens when you rsync .gvfs. Last I looked, in .gvfs were the contents of my backup server. Yet, I'm rsyncing to my backup server. So, rsyncing .gvfs to my backup server was duplicating my data, because I had my data there already, as well as in .gvfs that was synced. Am I correct in saying that it essentially duplicated, albeit in different locations on the backup server?
    – JaSauders
    Mar 19, 2012 at 4:01
  • That's correct; by rsyncing the contents of .gvfs, you're copying stuff that's already on the backup server to the backup server. Next time, you'll be copying the same stuff again, so you end up with three copies of the data, ad infinitum. Mar 19, 2012 at 5:23
  • Keep in mind that -x may be more reliable that --exclude=.gvfs, as the directory may move - my machine (a precise install) has it in ~/.cache/gvfs. Mar 19, 2012 at 5:26
  • Jeremy, thank you very much for clarifying this. What baffles me more is if this is the case, why is it in 99% of the cases when I hear other users talk about how to set up rsync that they don't include -x. More often than not, it's -azn at most. I think I'll be editing my scripts tonight to rsync -axn and call it a day.
    – JaSauders
    Mar 19, 2012 at 12:51
  • 2
    Cancel that. The -x flag will not detect .gvfs as being a different file system. One of the rsync devs just confirmed it, along with a quick bench test I did here on my desktop. In order to avoid .gvfs, --exclude tag must be used. At any rate, still dead simple, but good to be aware of. Thanks for the insight!
    – JaSauders
    Mar 19, 2012 at 17:33
0

I did a quick test on Ubuntu 18.04 and -x does not exclude .gvfs.

2
  • 1
    the question: >would -x also ignore .gvfs, being a virtual file system?
    – qwr
    Nov 4, 2019 at 1:32
  • Indeed, that was my mistake.
    – guntbert
    Nov 6, 2019 at 7:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .