* [gentoo-user] SSDs, ext4, fstrim, discard ...
@ 2011-10-11 20:56 Stefan G. Weichinger
2011-10-11 22:05 ` Alan McKinnon
2011-10-11 22:05 ` Neil Bothwick
0 siblings, 2 replies; 8+ messages in thread
From: Stefan G. Weichinger @ 2011-10-11 20:56 UTC (permalink / raw
To: gentoo-user
As mentioned in the systemd-posting I migrated back to an SSD today (on
my main rig, the thinkpad uses an SSD happily for a long time now).
A feature in a local magazine updated my knowledge of how to make use of
the TRIM-command.
It told me not to use the mount-option "discard" anymore, but run fstrim
on the mountpoint frequently.
OK, I learn ;-)
But, AFAI understand, after trimming sectors/bytes on the
filesystem/partition, they should be trimmed. I expect X bytes to be
trimmed at first and if I repeat the command, I expect 0 (or something
pretty low) bytes to be trimmed then, ok?
This is what I wonder about:
~ # fstrim -v /
/: 6195433472 bytes were trimmed
~ # fstrim -v /
/: 6195433472 bytes were trimmed
~ # fstrim -v /
/: 6195433472 bytes were trimmed
I tested it with "discard" on and off.
/ is ext4, yes, and on an SSD, yup.
Do I misunderstand things here?
Thanks, Stefan
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [gentoo-user] SSDs, ext4, fstrim, discard ...
2011-10-11 20:56 [gentoo-user] SSDs, ext4, fstrim, discard Stefan G. Weichinger
@ 2011-10-11 22:05 ` Alan McKinnon
2011-10-11 22:28 ` Stefan G. Weichinger
2011-10-11 22:05 ` Neil Bothwick
1 sibling, 1 reply; 8+ messages in thread
From: Alan McKinnon @ 2011-10-11 22:05 UTC (permalink / raw
To: gentoo-user
On Tue, 11 Oct 2011 22:56:31 +0200
"Stefan G. Weichinger" <lists@xunil.at> wrote:
>
> As mentioned in the systemd-posting I migrated back to an SSD today
> (on my main rig, the thinkpad uses an SSD happily for a long time
> now).
>
> A feature in a local magazine updated my knowledge of how to make use
> of the TRIM-command.
>
> It told me not to use the mount-option "discard" anymore, but run
> fstrim on the mountpoint frequently.
>
> OK, I learn ;-)
>
> But, AFAI understand, after trimming sectors/bytes on the
> filesystem/partition, they should be trimmed. I expect X bytes to be
> trimmed at first and if I repeat the command, I expect 0 (or something
> pretty low) bytes to be trimmed then, ok?
>
> This is what I wonder about:
>
> ~ # fstrim -v /
> /: 6195433472 bytes were trimmed
> ~ # fstrim -v /
> /: 6195433472 bytes were trimmed
> ~ # fstrim -v /
> /: 6195433472 bytes were trimmed
>
>
> I tested it with "discard" on and off.
>
> / is ext4, yes, and on an SSD, yup.
>
> Do I misunderstand things here?
Yes, you misunderstand how fstrim works. It's not up to you to say what
it does exactly, it's up to the drive firmware and possibly the kernel.
It's actually fully described in the man page right there in the part
for option -v :-)
A convenient on-line copy of the man page:
http://www.vdmeulen.net/cgi-bin/man/man2html?fstrim+8
--
Alan McKinnnon
alan.mckinnon@gmail.com
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [gentoo-user] SSDs, ext4, fstrim, discard ...
2011-10-11 20:56 [gentoo-user] SSDs, ext4, fstrim, discard Stefan G. Weichinger
2011-10-11 22:05 ` Alan McKinnon
@ 2011-10-11 22:05 ` Neil Bothwick
2011-10-11 22:26 ` Stefan G. Weichinger
1 sibling, 1 reply; 8+ messages in thread
From: Neil Bothwick @ 2011-10-11 22:05 UTC (permalink / raw
To: gentoo-user
[-- Attachment #1: Type: text/plain, Size: 1475 bytes --]
On Tue, 11 Oct 2011 22:56:31 +0200, Stefan G. Weichinger wrote:
>
> As mentioned in the systemd-posting I migrated back to an SSD today (on
> my main rig, the thinkpad uses an SSD happily for a long time now).
>
> A feature in a local magazine updated my knowledge of how to make use of
> the TRIM-command.
>
> It told me not to use the mount-option "discard" anymore, but run fstrim
> on the mountpoint frequently.
>
> OK, I learn ;-)
>
> But, AFAI understand, after trimming sectors/bytes on the
> filesystem/partition, they should be trimmed. I expect X bytes to be
> trimmed at first and if I repeat the command, I expect 0 (or something
> pretty low) bytes to be trimmed then, ok?
>
> This is what I wonder about:
>
> ~ # fstrim -v /
> /: 6195433472 bytes were trimmed
> ~ # fstrim -v /
> /: 6195433472 bytes were trimmed
> ~ # fstrim -v /
> /: 6195433472 bytes were trimmed
>
>
> I tested it with "discard" on and off.
>
> / is ext4, yes, and on an SSD, yup.
>
> Do I misunderstand things here?
>
> Thanks, Stefan
>
This seems in accordance with the fstrim man page:
"fstrim will report the same potential discard bytes each time, but only
sectors which had been written to between the discards would actually be
discarded by the storage device."
What is the benefit of running fstrim manually over mounting with discard?
--
Neil Bothwick
PCMCIA: People Can't Memorize Computer Industry Acronyms
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [gentoo-user] SSDs, ext4, fstrim, discard ...
2011-10-11 22:05 ` Neil Bothwick
@ 2011-10-11 22:26 ` Stefan G. Weichinger
2011-10-13 21:12 ` Stefan G. Weichinger
0 siblings, 1 reply; 8+ messages in thread
From: Stefan G. Weichinger @ 2011-10-11 22:26 UTC (permalink / raw
To: gentoo-user; +Cc: Neil Bothwick
Am 12.10.2011 00:05, schrieb Neil Bothwick:
> This seems in accordance with the fstrim man page:
>
> "fstrim will report the same potential discard bytes each time,
> but only sectors which had been written to between the discards
> would actually be discarded by the storage device."
Didn't see this so far. Gotta check once more.
> What is the benefit of running fstrim manually over mounting with
> discard?
discard seems to slow down the fs by trimming all the time.
I only report what I read. No tests done so far.
S
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [gentoo-user] SSDs, ext4, fstrim, discard ...
2011-10-11 22:05 ` Alan McKinnon
@ 2011-10-11 22:28 ` Stefan G. Weichinger
2011-10-11 23:17 ` Alan McKinnon
0 siblings, 1 reply; 8+ messages in thread
From: Stefan G. Weichinger @ 2011-10-11 22:28 UTC (permalink / raw
To: gentoo-user; +Cc: Alan McKinnon
Am 12.10.2011 00:05, schrieb Alan McKinnon:
> Yes, you misunderstand how fstrim works. It's not up to you to say what
> it does exactly, it's up to the drive firmware and possibly the kernel.
> It's actually fully described in the man page right there in the part
> for option -v :-)
So it only tells me "something"?
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [gentoo-user] SSDs, ext4, fstrim, discard ...
2011-10-11 22:28 ` Stefan G. Weichinger
@ 2011-10-11 23:17 ` Alan McKinnon
2011-10-12 7:59 ` Stefan G. Weichinger
0 siblings, 1 reply; 8+ messages in thread
From: Alan McKinnon @ 2011-10-11 23:17 UTC (permalink / raw
To: gentoo-user
On Wed, 12 Oct 2011 00:28:03 +0200
"Stefan G. Weichinger" <lists@xunil.at> wrote:
> Am 12.10.2011 00:05, schrieb Alan McKinnon:
>
> > Yes, you misunderstand how fstrim works. It's not up to you to say
> > what it does exactly, it's up to the drive firmware and possibly
> > the kernel. It's actually fully described in the man page right
> > there in the part for option -v :-)
>
> So it only tells me "something"?
No, it's giving you a fact (and slightly misrepresenting it in the
output).
You asked the drive firmware for a favour - to please check if anything
can be discarded and if so to discard it.
<cue Mafia voice a la GodFather>
The firmware checked that it *could* discard X bytes and then figured
well, maybe it will, maybe it won't, maybe it'll do it on it's own
good time, but what the heck - tell the user anyway how many bytes X
is. Maybe that'll make the user happy so he'll stfu and go away......
The command leads you to believe the discard was actually done, but
that's not necessarily true :-)
It's probably a case of the drive knows much better than you what it
should do.
--
Alan McKinnnon
alan.mckinnon@gmail.com
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [gentoo-user] SSDs, ext4, fstrim, discard ...
2011-10-11 23:17 ` Alan McKinnon
@ 2011-10-12 7:59 ` Stefan G. Weichinger
0 siblings, 0 replies; 8+ messages in thread
From: Stefan G. Weichinger @ 2011-10-12 7:59 UTC (permalink / raw
To: gentoo-user; +Cc: Alan McKinnon
Am 2011-10-12 01:17, schrieb Alan McKinnon:
> You asked the drive firmware for a favour - to please check if anything
> can be discarded and if so to discard it.
>
> <cue Mafia voice a la GodFather>
>
> The firmware checked that it *could* discard X bytes and then figured
> well, maybe it will, maybe it won't, maybe it'll do it on it's own
> good time, but what the heck - tell the user anyway how many bytes X
> is. Maybe that'll make the user happy so he'll stfu and go away......
>
> The command leads you to believe the discard was actually done, but
> that's not necessarily true :-)
>
> It's probably a case of the drive knows much better than you what it
> should do.
Ah, ok, Mafia implemented now ... ;-)
Thanks, Stefan
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [gentoo-user] SSDs, ext4, fstrim, discard ...
2011-10-11 22:26 ` Stefan G. Weichinger
@ 2011-10-13 21:12 ` Stefan G. Weichinger
0 siblings, 0 replies; 8+ messages in thread
From: Stefan G. Weichinger @ 2011-10-13 21:12 UTC (permalink / raw
To: gentoo-user
Am 12.10.2011 00:26, schrieb Stefan G. Weichinger:
>> What is the benefit of running fstrim manually over mounting with
>> discard?
>
> discard seems to slow down the fs by trimming all the time.
> I only report what I read. No tests done so far.
Shouldn't "discard" be set to make TRIM work anyway, even with fstrim?
man mount says for "discard":
"Controls whether ext4 should issue discard/TRIM commands to the
underlying block device when blocks are freed."
Sounds like TRIM-commands wouldn't get through to the SSD when "discard"
is not set.
Still wondering.
Stefan
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2011-10-13 21:14 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-11 20:56 [gentoo-user] SSDs, ext4, fstrim, discard Stefan G. Weichinger
2011-10-11 22:05 ` Alan McKinnon
2011-10-11 22:28 ` Stefan G. Weichinger
2011-10-11 23:17 ` Alan McKinnon
2011-10-12 7:59 ` Stefan G. Weichinger
2011-10-11 22:05 ` Neil Bothwick
2011-10-11 22:26 ` Stefan G. Weichinger
2011-10-13 21:12 ` Stefan G. Weichinger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox