You are not logged in.
Hello. I just bought a new PC and installed Arch linux.
It has one HDD 500GB(sdb) and 120GB SSD (sda). Both of them are encrypted using LUKS system on LVM.
On the SSD there is :
a boot partition (sda1)
and a lvm pool (sda2) which contains swap and /
The HDD contains another lvm pool which contains only the home.
So now i want to setup the TRIM for the SSD and i have some Qs.
1) I enable fstrim timer by running
systemctl enable fstrim.timer
At wiki page says that
Enabling the timer will activate the service weekly, which will then trim all mounted filesystems on devices that support the discard operation
Fstrim understands on its own which devices supports the discard operation or i have to label it on fstab file ?
2) TRIM for LVM level
I just change the value of issue_discards option from 0 to 1 in /etc/lvm/lvm.conf as wiki says.
Does the other HDD (sdb) will be affected from this configuration ? Am i gonna loose data from that disk ?
I'm asking because there is no specification on which lvm-pool discard issue should take effect on.
3)Crypttab level
What's going here ? I'm little bit confused.
a)
For non-root filesystems, configure /etc/crypttab to include discard in the list of options for encrypted block devices located on a SSD
At my /etc/crypttab file, i have only one line activated and that's the line which says at crypttab to decrypt the HDD (sdb) using a specific key file. Nothing else.
What's gonna happen with the lvm pool (sda2) which contains swap and / ?
b) For root filesystem i have to change the cryptdevice option.
I have to say that i'm using systemd-boot/gummiboot and the /boot/loader/entries/arch.conf file looks like that
title Arch Linux Encrypted
linux /vmlinuz-linux
initrd /initramfs-linux.img
options cryptdevice=UUID=<UUID>:<mapped-name> root=UUID=<luks-UUID> quiet rw
Where i suppose to add the
:allow-discards
here
options cryptdevice=UUID=<UUID>:<mapped-name>:allow-discards root=UUID=<luks-UUID> quiet rw
or here
options cryptdevice=UUID=<UUID>:<mapped-name> root=UUID=<luks-UUID>:allow-discards quiet rw
Finally, is there any way to understand that all went good and the TRIM is actually working ?
Thank you.
Last edited by netpumber (2015-07-14 11:39:53)
Offline
Fstrim understands on its own which devices supports the discard operation
Yes.
is there any way to understand that all went good and the TRIM is actually working ?
If set to "weekly", it runs at 12:00 on Sunday or the first boot after that time -- you can tell when it's running 'cos the drive light stays on even if the drive isn't being accessed by you and the SSD runs like a slow spinning rust drive.
Offline
2) TRIM for LVM level
I just change the value of issue_discards option from 0 to 1 in /etc/lvm/lvm.conf as wiki says.
Trim always works with LVM, there is no setting that would disable trim. (Unlike LUKS which needs --allow-discards).
issue_discards is about trimming on lvremove. You can do that manually with blkdiscard instead.
Finally, is there any way to understand that all went good and the TRIM is actually working ?
Offline
Thank you very much. What about the third one ? Any idea about that?
Offline
' dmsetup table ' will show you all device mappings. ' dmsetup table | grep crypt ' will show all device mappings which are involved in encryption, i.e. your LUKS containers.
a LUKS container with allow discards enabled should show as thus:
luksSSD1: 0 125034496 crypt aes-xts-plain64 0 0 9:0 4096 1 allow_discards
note the allow_discards at the end of the line. in comparison a container opened w/o allow_discards:
luksHDD1: 0 2930235392 crypt aes-xts-plain64 0 0 9:1 4096
if your LUKS containers as are backed by SSD storage have this allow_discards in the dmsetup table, everything is fine ...
Offline
There is no allow_dicards flag in SSD
This is how it looks like the output
lvmRootPool: 0 233385984 crypt aes-xts-plain64 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0 8:17 4096
As i said in my first post i didn't add the allow-discards flag on cryptdevice option at bootloader because i coudn't understood where to add it.
Where i suppose to add the
:allow-discards
here
options cryptdevice=UUID=<UUID>:<mapped-name>:allow-discards root=UUID=<luks-UUID> quiet rw
or here
options cryptdevice=UUID=<UUID>:<mapped-name> root=UUID=<luks-UUID>:allow-discards quiet rw
Edit:
Ok did the first one and now allow-discards appears on dmsetup table command.
Last edited by netpumber (2015-07-14 11:17:44)
Offline