You are not logged in.

#1 2018-03-26 20:45:55

esauvisky
Member
Registered: 2014-06-23
Posts: 11

[SOLVED] Is my continuous trim on a luks encrypted partition working?

So, I've set up a new system on my laptop after purchasing a new SSD. Everything works wonderfully, but I'm wondering if the continuous trim is actually working...

The reason for me to be inclined to thinking that my filesystem is not actually continuously trimming is because when I do a fstrim / after a fresh boot I always get something like:

/: 429,4 GiB (461036777472 bytes) trimmed

My current setup is just 2 partitions a non-encrypted /boot and an encrypted /. This is my /etc/fstab:

# /dev/sda1
UUID=6BE1-2DC5                              /boot    vfat     rw,noatime,utf8                    0  2

# /dev/mapper/cryptroot
UUID=0d73fd89-bc3b-4759-80eb-135ddbb33022   /        ext4     rw,noatime,discard                 0  1

I'm also passing the correct arguments via the kernel parameters, as indicated by Flags in cryptsetup luksDump /dev/sda2:

LUKS header information
Version:       	2
Epoch:         	4
Metadata area: 	12288 bytes
UUID:          	81f38daa-9632-4817-b237-0de941cafff8
Label:         	(no label)
Subsystem:     	(no subsystem)
Flags:       	allow-discards

AFAIK there's no easy way for me to test if the continuous trim is working, because I cannot do the common procedure of writing to a file, running hdparm --fibmap [file], deleting the file and checking with hdparm --read-sector, as hdparm doesn't work with device-mappers.

Does anyone knows of an alternative way to check if my ext4 filesystem is actually doing the continuous trim? If it is, why is that I always get a positive result when running fstrim then?

Last edited by esauvisky (2018-03-27 20:24:04)

Offline

#2 2018-03-27 18:30:19

R00KIE
Forum Fellow
From: Between a computer and a chair
Registered: 2008-09-14
Posts: 4,734

Re: [SOLVED] Is my continuous trim on a luks encrypted partition working?

esauvisky wrote:

So, I've set up a new system on my laptop after purchasing a new SSD. Everything works wonderfully, but I'm wondering if the continuous trim is actually working...

The reason for me to be inclined to thinking that my filesystem is not actually continuously trimming is because when I do a fstrim / after a fresh boot I always get something like:

/: 429,4 GiB (461036777472 bytes) trimmed

That's supposed to do that AFAIK, ext4 does not save the information about what has been trimmed between reboots so it will always trim the free space.

I guess that if luks was not passing the trim request down to the disk you might get an error instead of the space that has been trimmed, I haven't checked though so it might just fail silently.


R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K

Offline

#3 2018-03-27 19:12:16

frostschutz
Member
Registered: 2013-11-15
Posts: 1,409

Re: [SOLVED] Is my continuous trim on a luks encrypted partition working?

You can test it: https://unix.stackexchange.com/a/85880/30851

There is no problem with fstrim, either: https://unix.stackexchange.com/a/371665/30851

On discard vs. fstrim vs. no trim at all: https://unix.stackexchange.com/a/218083/30851

Online

#4 2018-03-27 20:23:44

esauvisky
Member
Registered: 2014-06-23
Posts: 11

Re: [SOLVED] Is my continuous trim on a luks encrypted partition working?

Wow, thanks a lot! I could confirm my continuous trim is working! smile

As as a bonus I'm also now aware of fstrim's output meaning (or lack thereof) and the differences between each method.

As always, Arch Linux and its awesome community making me learn more and more.

Offline

Board footer

Powered by FluxBB