Full backup, but exclude remote and virtual filesystems

restic does not offer a backup restriction to specific filesystems, like IBM Spectrum Protect does.
One cannot automatically exclude NFS, fusefs, tmpfs etc filesystems.
This is especially a problem in case of a / fullback.

As a workaround I wrote “restic-backup” which scans /proc/mount and excludes all mount points which do not contain ext* xfs or btrfs filesystems:

https://fex.rus.uni-stuttgart.de/fop/hrYit9iR/restic-backup.txt

Maybe there is another/better solution?

“–one-file-system” flag …?

I want a full system backup for ALL local file systens, not only / !
And –one-file-system also excludes btrfs subvolumes!

Indeed you have a bit special case. BTRFS or ZFS require a bit of manual treatment.

Thank you for sharing your script - can be useful for others in similar situation.

what does findmnt --fstab -o TARGET -n --submounts get you on a btrfs system?

Other than btrfs (which I don’t have) this seems to work fine on my machine

Does not list subvolumes:

root@fex:~# findmnt --fstab -o TARGET -n --submounts /
/

Also df does not list subvolumes:

root@fex:~# df -TH | grep btrfs
/dev/sdd1                     btrfs        69G   16G   53G  23% /
/dev/sde1                     btrfs       1.1T   91G  1.1T   9% /local
/dev/sdf1                     btrfs       1.1T  361G  736G  33% /backup
/dev/loop0                    btrfs        16T  1.2T   15T   8% /mnt/spool
/dev/mapper/nfsbackup         btrfs       1.1T  116G  974G  11% /mnt/nfsbackup

But:

root@fex:~# restic backup -h | grep -- -x
  -x, --one-file-system                        exclude other file systems, don't cross filesystem boundaries and subvolumes

Same is true for “find -xdev” and “du -x”

==> It is difficult to backup btrfs / with subvolumes, but exclude other filesystems

why did you add a “/” at the end? Can you try without it? Notice my example does not.

To restrict it to the / filesystem

root@fex:~# findmnt --fstab -o TARGET -n --submounts
/proc
/
none
/backup
/local
/iscsi/spool
/nfs/rusnas/sw
/nfs/rusnas/scr
/nfs/rusnas/software
/nfs/rusnas/fex
/backup/belwue
/nfs/tiknfs
/nfs/sas/backup
/nfs/nfstest