As @dalto mentions, you need a subvolume to make a snapshot, and it needs to be a read-only snapshot to do
btrfs send. Both source and destination need the same snapshot to do an incremental send (using
Note that btrfs snapshots are not recursive, i.e. it will exclude nested subvolumes (snapshots are also subvolumes). Instead of creating a directory you can create a subvolume and it’ll mostly behave like a directory, except you can snapshot it. For example:
btrfs sub create Tax2
mv Tax/* Tax2
rm -rf Tax
mv Tax2 Tax
And now you can snapshot it, and send/receive.
btrfs sub snap -r Tax Tax.20220126
sudo btrfs send Tax.20220126 | sudo btrfs receive /run/media/solomon/backup
The snapshot can be anywhere on the same Btrfs filesystem, it doesn’t have to be in ~/Documents, that’s up to you. The flexibility can be confusing because there are many conventions. Likewise, the commands can be shortened, like I’m doing above, so long as they aren’t ambiguous. This is built-in, not special configuration needed.
btrfs fi sh is the same as
btrfs filesystem show and each user figures out their own shortening convention.
To do an incremental backup, first make some changes inside of Tax/, then:
btrfs sub snap -r Tax Tax.20220126-2
btrfs send -p Tax.20220126 Tax.20220126-2 | sudo btrfs receive /run/media/solomon/backup
Make more changes to Tax, do an incremental backup…
btrfs sub snap -r Tax Tax.20220126-3
btrfs send -p Tax.20220126-2 Tax.20220126-3 | sudo btrfs receive /run/media/solomon/backup
You can choose to keep or discard older snapshots, but you probably want to keep the most recent snapshot on both btrfs file sytsems, so that you can continue to do incremental backups. The cost is quite small, a couple hundred KiB of metadata plus whatever exclusive data is in the snapshot.
Let’s say you replace ~/Documents directory with a ~/Documents subvolume. And further say you’ve got LOT of stuff in ~/Documents, but it’s not changing much over time. This is a great use case for send/receive because Btrfs is already tracking the changes, so it doesn’t need to do deep traversal of either source or destination to know what files have chanced since the last snapshot.
You can see this in action with
btrfs subvolume find-new - see
man btrfs subvolume and check out the
list commands. Point the
find-new command at the subvolume you’re actively using, but use the generation number from a previous snapshot of that subvolume. You’ll see a file listing of all files added/modified since the previous snapshot. This even works without snapshots, just use a lower generation number than the current value for the subvolume you’re looking at. Generations don’t represent a fixed amount of time, they can get updated quickly if the workload involves frequent fsync, otherwise the generation is incremented once every 30 seconds.