1 |
On 04/26 03:29, Rich Freeman wrote: |
2 |
> On Sun, Apr 26, 2020 at 12:15 PM <tuxic@××××××.de> wrote: |
3 |
> > |
4 |
> > On 04/26 11:20, Rich Freeman wrote: |
5 |
> > > On Sun, Apr 26, 2020 at 10:52 AM <tuxic@××××××.de> wrote: |
6 |
> > > > |
7 |
> > > > Fstrim reports about 200 GiB of trimmed data. |
8 |
> > > > |
9 |
> > > |
10 |
> > > My suggestion would be to run fstrim twice in a row and see how fast |
11 |
> > > it operates and what the results are. If the second one completes |
12 |
> > > very quickly that suggests that the drive is sane. I'd probably just |
13 |
> > > run it daily in that case, but weekly is probably fine especially if |
14 |
> > > the drive isn't very full. |
15 |
> > > |
16 |
> > |
17 |
> > host:/root>fstrim -v / |
18 |
> > /: 3.3 GiB (3578650624 bytes) trimmed |
19 |
> > host:/root>fstrim -v / |
20 |
> > /: 0 B (0 bytes) trimmed |
21 |
> > |
22 |
> > This time the first fstrim reports a small mount of trimmed |
23 |
> > data and second one no fstrimmed data at all. |
24 |
> > |
25 |
> |
26 |
> Ok, I became a bit less lazy and started looking at the source. |
27 |
> |
28 |
> All fstrim does is send an FITRIM ioctl to the kernel for the device. |
29 |
> This is implemented in a filesystem-dependent manner, and I couldn't |
30 |
> actually find any documentation on it (actual documentation on the |
31 |
> ioctl - not the fstrim manpage/etc). A quick glimpse at the ext4 |
32 |
> source suggests that ext4 has a flag that can track whether a group of |
33 |
> blocks has been trimmed yet or not since it was last deallocated. So |
34 |
> ext4 will make repeated fstrim runs a no-op and the drive won't see |
35 |
> these. |
36 |
> |
37 |
> At least, that was what I got after about 5-10min of browsing. I |
38 |
> didn't take the time to grok how ext4 tracks free space and so on. |
39 |
> |
40 |
> Incidentally, in the other thread the reason that dry-run didn't |
41 |
> report anything to be trimmed is that this is hard-coded: |
42 |
> printf(_("%s: 0 B (dry run) trimmed on %s\n"), path, devname); |
43 |
> https://github.com/karelzak/util-linux/blob/master/sys-utils/fstrim.c#L109 |
44 |
> |
45 |
> Otherwise the ioctl returns how much space was trimmed, and fstrim outputs this. |
46 |
> |
47 |
> -- |
48 |
> Rich |
49 |
> |
50 |
|
51 |
Hi Rich, |
52 |
|
53 |
thank you very much for digging into the depth of the sources and for |
54 |
explaining it!!! Very appreciated !!! :) :) |
55 |
|
56 |
To implement a dry run with a printf() is new to me... ;) |
57 |
|
58 |
Cheers! |
59 |
Meino |