Why empty ext4, btrfs and xfs partitions have different free space?

I formatted an 80GB external hard drive with ext4, btrfs and xfs to compare how much storage is used by these filesystems



All I know for sure is that ext4 reserves 5% of the space to the super-user which you can change with the command:

sudo tune2fs -m 1 /dev/*device*

to 1%

The arch wiki says the following concerning btrfs:

General linux userspace tools such as df will inaccurately report free space on a Btrfs partition. It is recommended to use `btrfs filesystem usage` to query Btrfs partitions. For example, for a full breakdown of device allocation and usage stats:

# btrfs filesystem usage /
2 Likes

Which is very important feature and sane defaults, because it fights a good fight with fragmentation (very useful for HDDs):

By default, 5% of the filesystem blocks will be reserved for the super-user, to avoid fragmentation and “allow root-owned daemons to continue to function correctly after non-privileged processes are prevented from writing to the filesystem”

3 Likes

Is it of less importance when using a SSD or even not necessary at all?

In terms of fragmentation strictly speaking - less to none importance…

However i believe all SSDs should benefit from leaving around 30% of it’s capacity free, in terms of extending it’s lifetime because of how controllers work. It leads to less writes at least that was the case for Samsung SSD drives all along.

2 Likes

I was wondering what was that “lost+found” directory that was always created on “ext4”, took almost 200MiB out of 25GiB. No matter how many times I reformatted it stayed. :man_facepalming:

← still has a lot to learn about Linux

I don’t think lost+found has anything to do with the subject, it’s directory used by fsck strictly for recovery after catastrophic failures (although it pre-allocates some blocks).


That’s also interesting read:

https://wiki.archlinux.org/title/ext4#Reserved_blocks

1 Like