Skip to content

Why is "Metadata,DUP" almost 5x bigger now? #69

Description

@JohnRobson

I bought a new HDD (same model and size) to back up my 1-year-old current disk. I decided to format it and RSync all the data, but the new disk "Metadata,DUP" is almost 5x bigger (222GB vs 50GB). Why? Is there some change in the BTRFS that makes this huge difference?

I ran "btrfs filesystem balance start --full-balance" twice, which did not decrease the Metadata, keeping the same size. I did not perform a scrub, but I think this won't change the metadata size.

The OLD Disk was formatted +- 1 year ago and has +- 40 snapshots (more data): $ mkfs.btrfs --data single --metadata dup --nodiscard --features no-holes,free-space-tree --csum crc32c --nodesize 16k /dev/sdXy

$ sudo btrfs filesystem usage -T /dev/sdd2
Device size: 15.37TiB
Device allocated: 14.09TiB
Device unallocated: 1.28TiB
Device missing: 0.00B
Device slack: 3.50KiB
Used: 14.08TiB
Free (estimated): 1.29TiB (min: 660.29GiB)
Free (statfs, df): 1.29TiB
Data ratio: 1.00
Metadata ratio: 2.00
Global reserve: 512.00MiB (used: 0.00B)
Multiple profiles: no
Data Metadata System
Id Path single DUP DUP Unallocated Total Slack
-- --------- -------- -------- -------- ----------- -------- -------
1 /dev/sdd2 14.04TiB 50.00GiB 16.00MiB 1.28TiB 15.37TiB 3.50KiB
-- --------- -------- -------- -------- ----------- -------- -------
Total 14.04TiB 25.00GiB 8.00MiB 1.28TiB 15.37TiB 3.50KiB
Used 14.04TiB 24.58GiB 1.48MiB

The NEW Disk was formatted now and I performed just 1 snapshot: $ mkfs.btrfs --data single --metadata dup --nodiscard --features no-holes,free-space-tree --csum blake2b --nodesize 16k /dev/sdXy

$ btrfs --version
btrfs-progs v6.16
-EXPERIMENTAL -INJECT -STATIC +LZO +ZSTD +UDEV +FSVERITY +ZONED CRYPTO=libgcrypt

Device size: 15.37TiB
Device allocated: 12.90TiB
Device unallocated: 2.47TiB
Device missing: 0.00B
Device slack: 3.50KiB
Used: 12.90TiB
Free (estimated): 2.47TiB (min: 1.24TiB)
Free (statfs, df): 2.47TiB
Data ratio: 1.00
Metadata ratio: 2.00
Global reserve: 512.00MiB (used: 0.00B)
Multiple profiles: no
Data Metadata System
Id Path single DUP DUP Unallocated Total Slack
-- --------- -------- --------- -------- ----------- -------- -------
1 /dev/sdd2 12.68TiB 222.00GiB 16.00MiB 2.47TiB 15.37TiB 3.50KiB
-- --------- -------- --------- -------- ----------- -------- -------
Total 12.68TiB 111.00GiB 8.00MiB 2.47TiB 15.37TiB 3.50KiB
Used 12.68TiB 110.55GiB 1.36MiB

The nodesize is the same 16k, and only the checksum algorithm is different (but they use the same 32 bytes per node, this won't change the size). I also tested the nodesize 32k and the "Metadata,DUP" increased from 222GB to 234GiB. Both were mounted with "compress-force=zstd:5"

The OLD disk has More data because of the 40 snapshots, and even with more data, the Metatada is "only" 50GB compared to 222+GB from the new disk. Some changes in BTRFS code during this 1-year created this huge difference? Or does having +-40 snapshots decreases the Metadata size?

Only the metadata is bigger, I did an "ncdu" and all folders have the same size on both disks. In fact, the old HDD contains even more data that wasn’t copied (the .snapshots folder), yet its metadata usage is only about 50 GB, compared with 222+ GB on the new HDD. I suspect that a change in the mkfs.btrfs code or defaults is responsible for this metadata bloat.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions