Gentoo Archives: gentoo-user

From: Alan McKinnon <alan.mckinnon@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] SSDs, ext4, fstrim, discard ...
Date: Tue, 11 Oct 2011 22:08:02
Message-Id: 20111012000538.2ee0d7de@rohan.example.com
In Reply to: [gentoo-user] SSDs, ext4, fstrim, discard ... by "Stefan G. Weichinger"
1 On Tue, 11 Oct 2011 22:56:31 +0200
2 "Stefan G. Weichinger" <lists@×××××.at> wrote:
3
4 >
5 > As mentioned in the systemd-posting I migrated back to an SSD today
6 > (on my main rig, the thinkpad uses an SSD happily for a long time
7 > now).
8 >
9 > A feature in a local magazine updated my knowledge of how to make use
10 > of the TRIM-command.
11 >
12 > It told me not to use the mount-option "discard" anymore, but run
13 > fstrim on the mountpoint frequently.
14 >
15 > OK, I learn ;-)
16 >
17 > But, AFAI understand, after trimming sectors/bytes on the
18 > filesystem/partition, they should be trimmed. I expect X bytes to be
19 > trimmed at first and if I repeat the command, I expect 0 (or something
20 > pretty low) bytes to be trimmed then, ok?
21 >
22 > This is what I wonder about:
23 >
24 > ~ # fstrim -v /
25 > /: 6195433472 bytes were trimmed
26 > ~ # fstrim -v /
27 > /: 6195433472 bytes were trimmed
28 > ~ # fstrim -v /
29 > /: 6195433472 bytes were trimmed
30 >
31 >
32 > I tested it with "discard" on and off.
33 >
34 > / is ext4, yes, and on an SSD, yup.
35 >
36 > Do I misunderstand things here?
37
38 Yes, you misunderstand how fstrim works. It's not up to you to say what
39 it does exactly, it's up to the drive firmware and possibly the kernel.
40 It's actually fully described in the man page right there in the part
41 for option -v :-)
42
43 A convenient on-line copy of the man page:
44
45 http://www.vdmeulen.net/cgi-bin/man/man2html?fstrim+8
46
47
48 --
49 Alan McKinnnon
50 alan.mckinnon@×××××.com

Replies

Subject Author
Re: [gentoo-user] SSDs, ext4, fstrim, discard ... "Stefan G. Weichinger" <lists@×××××.at>