I don't have a good understanding of COW-snapshots mechanics but expect they contain the diffs and shared data among all of those which have one parent subvolume.
I made a script to check btrfs snapshots disk space consumption.
#!/usr/bin/zsh
for i in {1..2000}
do
echo 'line'$i >> /btrfs/test-volume/btrfs-doc.txt
/usr/bin/time -f "execution time: %E" btrfs subvolume snapshot /btrfs/test-volume /btrfs/snapshots/test-volume-snap$i
done
After running i displayed their dirs size and what i got:
❯ btrfs filesystem df /btrfs
Data, single: total=8.00MiB, used=6.84MiB
System, DUP: total=8.00MiB, used=16.00KiB
Metadata, DUP: total=102.38MiB, used=33.39MiB
GlobalReserve, single: total=3.25MiB, used=0.00B
❯ btrfs filesystem du -s /btrfs
Total Exclusive Set shared Filename
18.54MiB 6.74MiB 36.00KiB /btrfs
❯ df -h /btrfs
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vgstoragebox-btrfs 2.0G 77M 1.8G 5% /btrfs
❯ du -sh /btrfs
20M /btrfs
❯ ll /btrfs/test-volume/btrfs-doc.txt
-rw-r--r-- 1 root root 17K Jul 6 14:50 /btrfs/test-volume/btrfs-doc.txt
❯ tree -hU /btrfs/snapshots
/btrfs/snapshots
├── [ 26] test-volume-snap1
│ └── [ 6] btrfs-doc.txt
├── [ 26] test-volume-snap2
│ └── [ 12] btrfs-doc.txt
├── [ 26] test-volume-snap3
│ └── [ 18] btrfs-doc.txt
...
├── [ 26] test-volume-snap1998
│ └── [ 16K] btrfs-doc.txt
├── [ 26] test-volume-snap1999
│ └── [ 16K] btrfs-doc.txt
└── [ 26] test-volume-snap2000
└── [ 16K] btrfs-doc.txt
2000 directories, 2000 files
All the utils calculated size differently, i can't say how much disk space /btrfs/snapshots
dir consumed actually, but i see it's much bigger than at least a double size of the file /btrfs/test-volume/btrfs-doc.txt
. At the moment i think it should be around the double size in case the btrfs snapshots contain the diffs and shared data is linking.
In comparison, i made the same test with LVM snapshots and small disk space was consumed by them.