Today I had the idea to mount my root filesystem in a (bound, “mount -o bind,ro”) subdirectory. This way I wouldn’t need to exclude special filesystems (like /proc, /sys, /run, /dev/pts) that restic has trouble with. However, I haven’t seen anyone else suggest this, and I’m wondering if there’s some good reason I shouldn’t do it.
The consequences of this that come to mind are that the backup path won’t be “/” anymore (unless I chroot), and that I’ll need to (bind) mount any additional directories that I do want to backup (like /boot). Am I missing anything?
If you’ve done this while your root is mounted writable somewhere else (I’m assuming this since you’ve used
bind), mounting read only won’t rescue you from the case of “changed while backing up”.
If that’s the case, you might as well backup the root partition directly with
-x option, it should accomplish the same.
As @gurkan mentioned,
-x (also called
--one-file-system) accomplishes this same thing without the bind-mount hack.
Backing up a mount can still be useful, for example if using some type of filesystem or block-level snapshot (btrfs, ZFS, LVM, etc.) as you can back up a totally consistent point-in-time view of the filesystem.