You are not logged in.

#1 2022-12-03 15:00:11

lightstream
Member
From: Britain
Registered: 2011-10-30
Posts: 64

fstrim - what does it actually do?

From what I read, I got the impression that fstrim tells the drive firmware which blocks are no longer in use by the OS. However, after running it on my root filesystem, the results have confused me.

Here's the drive usage reported by df:

Filesystem      Size  Used Avail Use% Mounted on
/dev/nvme1n1p2  457G  415G   20G  96% /

And here's the output of fstrim:

# fstrim -v /
/: 42.7 GiB (45901381632 bytes) trimmed

How come this number is so much larger than the free space actually on the disk? (df reports the same amount of free space after running fstrim as it did before)

Offline

#2 2022-12-03 15:53:42

mpan
Member
Registered: 2012-08-01
Posts: 1,208
Website

Re: fstrim - what does it actually do?

Did you take into account space reserved for root? Unless you have used a different value, it’s 5% by default and it fits perfectly:

42.7 ≈ 20 + 5% · 457


Sometimes I seem a bit harsh — don’t get offended too easily!

Offline

#3 2022-12-03 15:53:46

seth
Member
Registered: 2012-09-03
Posts: 51,229

Offline

#4 2022-12-03 16:47:50

lightstream
Member
From: Britain
Registered: 2011-10-30
Posts: 64

Re: fstrim - what does it actually do?

mpan wrote:

Did you take into account space reserved for root? Unless you have used a different value, it’s 5% by default and it fits perfectly:

42.7 ≈ 20 + 5% · 457

No I didn't, that'll be what it is, thank you! TIL

Offline

Board footer

Powered by FluxBB