Can you create a snapshot of a btrfs subvolume that contains another btrfs snapshot?

Hello!

I’ve decided to use btrfs snapshots as a way to back-up my Fedora 35 to an external drive (related article: Incremental backups with Btrfs snapshots - Fedora Magazine).
My intent is to create a full system backup (the backup of my / directory).

First backup

Yesterday, I ran the following commands and everything worked as expected:

  1. Create a snapshot of / in /.snapshots/
    sudo btrfs subvolume snapshot -r / /.snapshots/day1
  2. Send the snapshot to an external btrfs-formatted drive:
    sudo btrfs send /.snapshots/day1 | sudo btrfs receive /run/media/rk/mydisk/bk

Subsequent backups

Now, let’s say that I want to create another snapshot of my entire system / and save it in /.snapshots again.

I’m a little bit concerned about creating another / snapshot because the /.snapshots directory contains my first snapshot (described in the “First backup” section).

Questions

  • Is it okay to take snapshots of btrfs subvolumes that contain other btrfs snapshots?
  • Will snapshots that contain other snapshots occupy lots of disk space?
  • Do you have any suggestions regarding alternative snapshotting scenarios?
    • How about creating a snapshot directly in another subvolume?
      btrfs subvolume snapshot / /run/media/rk/mydisk/bk
2 Likes

Yes. More than being OK, it is what virtually everyone who uses snapshots does.

Err…the snapshot won’t contain the other snapshot.

But to answer your question, multiple snapshots of the same data only use space based on the unique data in that snapshot plus a small amount of overhead for the snapshot itself.

Snapshots can be sent incrementally to your backup filesystem so it is actually quite efficient to take multiple snapshots and then send them to another device.

A snapshot is a subvolume. That being said, if you are thinking about taking a snapshot of one system directly to another btrfs filesystem, that isn’t possible. The snapshots refer to data in the existing filesystem. That is why they take up so little disk space.

6 Likes

Thank you for your quick and comprehensive answer!

2 Likes