9

I have quite a lot of snapshot on some btrfs volume, an I would like to know how much each snapshot take as space, so I will know when and were there is important changes.

sudo btrfs subvolume show /home/ / Name: <FS_TREE> UUID: - Parent UUID: - Received UUID: - Creation time: - Subvolume ID: 5 Generation: 1181373 Gen at creation: 0 Parent ID: 0 Top level ID: 0 Flags: - Snapshot(s): .snapshot/_0 .snapshot/_1 .snapshot/_2 .snapshot/_3 .snapshot/_4 ... 

but if I use du they report the whole space

du -sh /home/.snapshot/* 1,2T /home/.snapshot/_0 1,2T /home/.snapshot/_1 1,2T /home/.snapshot/_2 

is there a way to discover which difference is there, in space, between _1 and _2

Edit: NB : I have been using btrfs-list successfully to simply show snapshot size

3

2 Answers 2

16

Enabling quota is not a recommended if you have lot of backups.

Instead, you can use btrfs filesystem du -s command:

# btrfs filesystem du -s @snapshot* Total Exclusive Set shared Filename 17.98GiB 13.05GiB 4.93GiB @snapshot_system_2022-01-22d 17.91GiB 2.66GiB 15.25GiB @snapshot_system_2023-01-22w 18.09GiB 2.08GiB 16.01GiB @snapshot_system_2023-01-29w 16.90GiB 2.05GiB 14.85GiB @snapshot_system_2023-02-05w 18.23GiB 1.96GiB 16.27GiB @snapshot_system_2023-02-12w 18.81GiB 2.07GiB 16.74GiB @snapshot_system_2023-02-19w 21.59GiB 4.90GiB 16.69GiB @snapshot_system_2023-02-26w 22.38GiB 172.61MiB 22.21GiB @snapshot_system_2023-03-18d 

See man btrfs-filesystem or BTRFS docs.

2
  • 2
    That's terribly slow, though. Commented Jan 27, 2024 at 13:44
  • 1
    It is, but is there a faster way? Commented Feb 6, 2024 at 15:17
1

In order to show usage data with your BTRFS subvolumes, you must enable quotas first, like this:

sudo btrfs quota enable /home 

Then, you can run commands like sudo btrfs subvol show /home/.snapshots/your_snapshot and get usage stats. Here's an example:

 sudo btrfs subvol show /.snapshots/1076/snapshot/ @/.snapshots/1076/snapshot Name: snapshot UUID: 3ba9ffa0-a355-d544-be10-1b1d0a3a321e Parent UUID: 5c0c4206-9b15-074f-83c3-65861366e318 Received UUID: - Creation time: 2022-02-01 00:00:09 -0800 Subvolume ID: 1445 Generation: 66371 Gen at creation: 66370 Parent ID: 275 Top level ID: 275 Flags: readonly Send transid: 0 Send time: 2022-02-01 00:00:09 -0800 Receive transid: 0 Receive time: - Snapshot(s): Quota group: 0/1445 Limit referenced: - Limit exclusive: - Usage referenced: 13.92GiB Usage exclusive: 8.25GiB 
1
  • Be very careful with enabling quotas - serious performance degradation on snapshot heavy filesystems is found with a quick search. Commented Apr 26 at 11:18

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.