Option --one-file-system

What the option --one-file-system really does?

On OSes that support the flag (Linux does, OS X should (I don’t use it so I can’t say), Windows does not) it will prevent restic from crossing filesystem boundaries when performing a backup. For example, if you backup / with this flag but you have external media mounted under /media/usb then restic will not back up /media/usb at all because it is a different filesystem.

Note that this does not prevent you from specifying multiple filesystems on the command line, e.g. restic backup --one-file-system / /media/usb would back up both / and /media/usb filesystems, but would not descend into virtual filesystems like /sys and /proc.

I would strongly advise using this flag on all systems that support it, precisely to avoid backing up virtual filesystems.

(Windows generally doesn’t need this flag since filesystems have designated drive letters. That is, everything under C:\ is typically on the same filesystem. This is not always true, though – NTFS does support junction points but these are not used on typical desktop systems.)

2 Likes

I have / mount to a disk and /storage mount to other disk. If I use --one-file-system will not backup the /storage?

Not unless you explicitly specify /storage.

  • restic backup --one-file-system / will not back up /storage.
  • restic backup --one-file-system / /storage will back up /storage.
2 Likes