public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
From: tuxic@posteo.de
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] "Amount" of fstrim? (curiosity driven, no paranoia :)
Date: Sun, 26 Apr 2020 18:15:51 +0200	[thread overview]
Message-ID: <20200426161551.fmzwvoepd2tzbrrr@solfire> (raw)
In-Reply-To: <CAGfcS_=t5uABf69+PfZ4qtyMSvPYWqatWRb5ghZdB7PKJ6M1KQ@mail.gmail.com>

On 04/26 11:20, Rich Freeman wrote:
> On Sun, Apr 26, 2020 at 10:52 AM <tuxic@posteo.de> wrote:
> >
> > Fstrim reports about 200 GiB of trimmed data.
> >
> > From the gut this looks quite a lot -- the whole
> > partition is 256 GB in size.
> >
> > Smartclt report for the drive:
> > Data Units Written:                 700,841 [358 GB]
> >
> > Each week 200 GiB fstrimmed data for a partition of
> > 256 GB in size and since the beginning I have written
> > only 358 GB to it.
> >
> > How does this all fit together?
> 
> It doesn't fit together, because the amount of space trimmed has
> nothing to do with the amount of data written.
> 
> How much free space is there?  I would think that fstrim would just
> trim all unused blocks on the filesystem.  Unless it maintained state
> it would have no idea what has changed since the last time it was run,
> so if you ran it 10 times in a row it would trim 200GiB each time.
> 
> Unless your NVMe is brain-dead the only real downside to running it
> more often is the IO.  If you trim 200GiB of data 100x in a row the
> 99x after the first one should all be no-ops if the drive is
> well-designed.  An fstrim should just be a metadata operation.
> 
> Now, not all flash storage is equally well-implemented, and I suspect
> the guidelines to avoid running it often or using discard settings are
> from those who either have really cheap drives, or ones from a long
> time ago.  A lot of linux advice tends to be based on what people did
> 10+years ago, and a lot of linux design decisions get made to
> accommodate the guy who wants everything to work fine on his 386+ISA
> and SGI Indigo in his basement.
> 
> My suggestion would be to run fstrim twice in a row and see how fast
> it operates and what the results are.  If the second one completes
> very quickly that suggests that the drive is sane.  I'd probably just
> run it daily in that case, but weekly is probably fine especially if
> the drive isn't very full.
> 
> -- 
> Rich
> 

Hi Rich, 

thanks for explanation.

My observations does not fit with your explanation, though.

Early in the morning I did a fstrim, which results in the
200GiB of freed data.

Base on you posting I did a fstrim now with no
wait in between:

host:/root>fstrim -v /        
/: 3.3 GiB (3578650624 bytes) trimmed
host:/root>fstrim -v /
/: 0 B (0 bytes) trimmed

This time the first fstrim reports a small mount of trimmed
data and second one no fstrimmed data at all.

The SSD is a 
ADATA Technology Co., Ltd. XPG SX8200 Pro PCIe Gen3x4 M.2 2280 Solid State Drive (rev 03)
(cut'n'paste from `lspci`)

host:/root>df -h /
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       246G   45G  189G  20% /


Cheers!
Meino





  reply	other threads:[~2020-04-26 16:15 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-26 14:52 [gentoo-user] "Amount" of fstrim? (curiosity driven, no paranoia :) tuxic
2020-04-26 15:20 ` Rich Freeman
2020-04-26 16:15   ` tuxic [this message]
2020-04-26 19:29     ` Rich Freeman
2020-04-27  1:43       ` tuxic
2020-04-27  1:58         ` Rich Freeman
2020-04-27  3:14           ` tuxic
2020-04-27  8:22             ` William Kenworthy
2020-04-27 10:32       ` Alan Mackenzie
2020-04-27 15:12     ` Kent Fredric
2020-04-27 16:20       ` tuxic
2020-04-27 16:59         ` Rich Freeman
2020-04-27 19:07           ` antlists
2020-04-27 19:17             ` Rich Freeman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200426161551.fmzwvoepd2tzbrrr@solfire \
    --to=tuxic@posteo.de \
    --cc=gentoo-user@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox