btrfs

Readup

General

good.

COW

moo.

Subvols

Like directories, but can be manipulated like file systems, have snapshots and such. This stuff is kinda like bind mounts,

Commands:

Options

Nested vs. flat

There are several basic schemas to layout subvolumes (and snapshots). $ Flat All subvols are children of root and later mounted into appropriate directories. E.g. you can create all your subvolumes in /subvolumes - a directory, with parent root, and use /snapshots - directory, - for snapshots.

$ Nested Subvols are located anywhere in file hierarchy - typically in their desired locations.

Comparison:

Subvolume ID's

Displayed by doas btrfs subvolume list <path>. Start at 256 and increase by 1 for every new subvol. FS root always has subvol name / and id 5. When a btrfs partition is mounted without an explicit subvolume, subvolid=5 is assumed. list shows top level id, most often it's 5 - root.

Snapshots

Snapshots are a diff vcs on a fs level. $ Snapshot is a subvolume with added content: it holds references to current and/or past versions of files (inodes). See COW for how this is possible. Subvol snapshot won't contain children - so with subvols / and /home snapshoting / won't copy /home. Snapshots are created with btrfs subvolume snapshot <opts> <from> <to>. Benefit of snapshots over simple copying is COW - small changes to files will cause small changes to disk usage. This can be verified with compsize.

Backups

Storing snapshots on a single fs is convenient but not really secure - fs failure will cascade to snapshots. Remedying this requires efficiently exchanging information about snapshots between btrfs (or between btrfs and non-btrfs) file systems.

To back up a subvolume

To utilize shared nodes between sent snapshots

To restore a subvolume from a snapshot

Compression

Can only be applied on a filesystem-wide level. blah blah.

Tools