I have a restic job backing up my entire hard drive running as root:
restic --quiet --cleanup-cache -r $REMOTE_URL backup /
Unfortunately, root
doesn’t have access to other users’ ~/.gvfs
directories and so restic always displays the following error message:
error for /home/francois/.gvfs: lstat /home/francois/.gvfs: permission denied
I thought I would be able to simply exclude that directory with the following:
restic --quiet --cleanup-cache -r $REMOTE_URL backup / --exclude-file $EXCLUDE_FILE
where the exclude file includes:
/home/*/.gvfs
/home/francois/.gvfs
but it doesn’t make the error message go away.
Next I tried the following:
restic --quiet --cleanup-cache -r $REMOTE_URL backup / --exclude=/home/francois/.gvfs --exclude-file $EXCLUDE_FILE
without success.
Am I misunderstanding what the --exclude
and --exclude-file
arguments do or should I file a bug?
(I am able to reproduce this 100% of the time on restic 0.8.3 and 0.9.6.)
Did you verify that the file is included in the snapshot? The error you are seeing probably comes from scanning the directory before doing the actual backup.
I went through all of my snapshots:
ID Date Host Tags Directory
----------------------------------------------------------------------
1c83ec45 2020-04-27 19:41:06 hostname /
33414a78 2020-05-31 09:58:26 hostname /
bd52dd98 2020-06-14 09:59:39 hostname /
23ccfe15 2020-06-20 09:59:21 hostname /
9ab8eb4a 2020-06-28 09:58:03 hostname /
fa6c7459 2020-06-29 09:52:25 hostname /
ce3c6777 2020-06-30 09:54:03 hostname /
c22ab498 2020-07-01 09:55:46 hostname /
f73ad9e4 2020-07-02 09:56:57 hostname /
620c72c2 2020-07-03 09:58:33 hostname /
cc448a2d 2020-07-04 10:01:30 hostname /
1ab9155b 2020-07-05 12:06:23 hostname /
3a38af64 2020-07-06 09:53:41 hostname /
----------------------------------------------------------------------
and for each of them, I extracted the list of files:
restic --quiet -r $REMOTE_URL ls 1c83ec45 > 1c83ec45.list
and then looked for .gvfs
in all of them:
$ grep "\\.gvfs" *.list
1ab9155b.list:/root/.gvfs
1ab9155b.list:/usr/share/glib-2.0/schemas/org.gnome.system.gvfs.enums.xml
1ab9155b.list:/var/lib/lightdm/.gvfs
1c83ec45.list:/root/.gvfs
1c83ec45.list:/usr/share/glib-2.0/schemas/org.gnome.system.gvfs.enums.xml
1c83ec45.list:/var/lib/lightdm/.gvfs
23ccfe15.list:/root/.gvfs
23ccfe15.list:/usr/share/glib-2.0/schemas/org.gnome.system.gvfs.enums.xml
23ccfe15.list:/var/lib/lightdm/.gvfs
33414a78.list:/root/.gvfs
33414a78.list:/usr/share/glib-2.0/schemas/org.gnome.system.gvfs.enums.xml
33414a78.list:/var/lib/lightdm/.gvfs
3a38af64.list:/root/.gvfs
3a38af64.list:/usr/share/glib-2.0/schemas/org.gnome.system.gvfs.enums.xml
3a38af64.list:/var/lib/lightdm/.gvfs
620c72c2.list:/root/.gvfs
620c72c2.list:/usr/share/glib-2.0/schemas/org.gnome.system.gvfs.enums.xml
620c72c2.list:/var/lib/lightdm/.gvfs
9ab8eb4a.list:/root/.gvfs
9ab8eb4a.list:/usr/share/glib-2.0/schemas/org.gnome.system.gvfs.enums.xml
9ab8eb4a.list:/var/lib/lightdm/.gvfs
bd52dd98.list:/root/.gvfs
bd52dd98.list:/usr/share/glib-2.0/schemas/org.gnome.system.gvfs.enums.xml
bd52dd98.list:/var/lib/lightdm/.gvfs
c22ab498.list:/root/.gvfs
c22ab498.list:/usr/share/glib-2.0/schemas/org.gnome.system.gvfs.enums.xml
c22ab498.list:/var/lib/lightdm/.gvfs
cc448a2d.list:/root/.gvfs
cc448a2d.list:/usr/share/glib-2.0/schemas/org.gnome.system.gvfs.enums.xml
cc448a2d.list:/var/lib/lightdm/.gvfs
ce3c6777.list:/root/.gvfs
ce3c6777.list:/usr/share/glib-2.0/schemas/org.gnome.system.gvfs.enums.xml
ce3c6777.list:/var/lib/lightdm/.gvfs
f73ad9e4.list:/root/.gvfs
f73ad9e4.list:/usr/share/glib-2.0/schemas/org.gnome.system.gvfs.enums.xml
f73ad9e4.list:/var/lib/lightdm/.gvfs
fa6c7459.list:/root/.gvfs
fa6c7459.list:/usr/share/glib-2.0/schemas/org.gnome.system.gvfs.enums.xml
fa6c7459.list:/var/lib/lightdm/.gvfs
but none of them include the problematic directory.
With that command line you are probably backing up a bunch of virtual filesystems that you should also skip, like /proc
, /dev
, and /sys
. If any of your users mount random fuse filesystems, you’ll also try to back those up when you probably shouldn’t.
Instead, consider adding --one-file-system
and explicitly listing the mount points of every volume you want to back up. This will solve all of these problems at once.