Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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


share|improve this question

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.

share|improve this answer
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 '12 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. – Jeremy Kerr Mar 19 '12 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. – Jeremy Kerr Mar 19 '12 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 '12 at 12:51
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 '12 at 17:33

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.