public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] Misunderstanding fstrim...
@ 2020-04-26 15:26 Alan Mackenzie
  2020-04-26 16:07 ` tuxic
  0 siblings, 1 reply; 2+ messages in thread
From: Alan Mackenzie @ 2020-04-26 15:26 UTC (permalink / raw
  To: gentoo-user

Hello, Gentoo.

Seeing that I've had my "new" box for three years, now, I'm thinking
it's about time to run fstrim.  But how?

I've got a pair of NVMe drives in a RAID 1 configuration.  On the main
partition, /dev/md126, I've got several LVM2 things.  In the volume
group(s?) I've got things like /dev/mapper/vg-home mounted on /home.
Most of my partitions are ext4.

When I try things like

    # fstrim --dry-run /home

, I get the response:

    /home: 0 B (dry run) trimmed

.  What does this mean, in particular the "0 B" bit?  Does it mean that
if I let it rip, it would trim 0 Bytes?

Will I do any damage if I let it go ahead (without the --dry-run)?  Will
this actually do any good?  Will fstrim work together with LVM volumes?

Thanks for any help!

-- 
Alan Mackenzie (Nuremberg, Germany).


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [gentoo-user] Misunderstanding fstrim...
  2020-04-26 15:26 [gentoo-user] Misunderstanding fstrim Alan Mackenzie
@ 2020-04-26 16:07 ` tuxic
  0 siblings, 0 replies; 2+ messages in thread
From: tuxic @ 2020-04-26 16:07 UTC (permalink / raw
  To: gentoo-user

On 04/26 03:26, Alan Mackenzie wrote:
> Hello, Gentoo.
> 
> Seeing that I've had my "new" box for three years, now, I'm thinking
> it's about time to run fstrim.  But how?
> 
> I've got a pair of NVMe drives in a RAID 1 configuration.  On the main
> partition, /dev/md126, I've got several LVM2 things.  In the volume
> group(s?) I've got things like /dev/mapper/vg-home mounted on /home.
> Most of my partitions are ext4.
> 
> When I try things like
> 
>     # fstrim --dry-run /home
> 
> , I get the response:
> 
>     /home: 0 B (dry run) trimmed
> 
> .  What does this mean, in particular the "0 B" bit?  Does it mean that
> if I let it rip, it would trim 0 Bytes?
> 
> Will I do any damage if I let it go ahead (without the --dry-run)?  Will
> this actually do any good?  Will fstrim work together with LVM volumes?
> 
> Thanks for any help!
> 
> -- 
> Alan Mackenzie (Nuremberg, Germany).
> 

Hi Alan,

NOW I am no longer feel alone with all my fstrim/SSD related
questions! :)

I exactly fall over this before.

It looks like fstrim would take its "dry run" really seriously
and does NOTHING - it even does not communicate with the SSD.
Therefore there is no responds from the SSD how much has been
trimmed...or "0 bytes" in other words.

If you start it with no "dry run", it will send the the SSD
informations, what parts, which still keep data, can be freed,
because this data is no longer linked to anything.

Fstrimming "does harm" ;) in the first place. It will cause
some kind of writing, which is -- in the purest sense of
the word -- "bad" to the SSD. 

But fstrimming is good for the SSD in the more global context, since
all freed blocks now are available for wear leveling to the SSD
controller again.

I cannot say anything in the context of LVM, since I 
don't use it.

But I don't *think* (read: don't know for sure), that
it would harm, since you are dealing with data, which
already has been flagged for "can be overwritte" by
the filesystem.

Since the SSD controller handles chunks of data one
level lower (the controller does not know anything
about filesystems), fstrim tells it, which data
can be overwritten from the filesystems point 
of view.

BUT: Any undelete operation is made impossible
after a fstrim.

Some inside view to the status of the ssd can be taken
by this command:

    sudo smartctl -a <your ssd device here>

This command only reads from the SSD.

Cheers!
Meino






^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-04-26 16:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-26 15:26 [gentoo-user] Misunderstanding fstrim Alan Mackenzie
2020-04-26 16:07 ` tuxic

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox