You are not logged in.

#1 2024-04-13 21:22:00

webcapcha
Member
Registered: 2019-02-14
Posts: 136

Trim with LVM on Luks still confused (I've read the wiki and searched)

I did search the forum. Here is a pretty lot of topics but it's still confused for me and topics remain not fully explored.

For example this one https://bbs.archlinux.org/viewtopic.php?id=291981 or https://bbs.archlinux.org/viewtopic.php?id=282759 I feel they don't cover all aspects.

I have LVM on Luks setup. Here is the setup

❯ lsblk -l
NAME               MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINTS
cryptlvm           254:0    0 951.9G  0 crypt
HynixVolGroup-swap 254:1    0     8G  0 lvm   [SWAP]
HynixVolGroup-root 254:2    0    80G  0 lvm   /
HynixVolGroup-home 254:3    0 863.6G  0 lvm   /home
nvme0n1            259:0    0 953.9G  0 disk
nvme0n1p1          259:1    0     2G  0 part  /boot
nvme0n1p2          259:2    0 951.9G  0 part

How to properly setup trim. Here is my possible steps.

1. Add to the

/boot/loader/entries/arch.conf

hook like this

options cryptdevice=UUID=********12c9128:cryptlvm:[b]allow-discards[/b] root=/dev/HynixVolGroup/root

This will trim on / partition correct?

Because on wiki page I see

Besides the kernel option, it is also required to periodically run fstrim or mount the filesystem (e.g. /dev/mapper/root in this example) with the discard option in /etc/fstab. For details, please refer to the TRIM page.

For LUKS devices unlocked via /etc/crypttab use option discard, e.g.:

The question is do I need to add something to /etc/crypttab? This file is empty now on my setup. Or should I add something to /etc/fstab?

2. Enable fstrim.timer with systemctl enable fstrim.timer. This will trim on /boot partition, correct?

3. For non root filesystem the wiki says https://wiki.archlinux.org/title/Solid_ … e#dm-crypt

For non-root filesystems, configure /etc/crypttab to include discard in the list of options for encrypted block devices located on an SSD (see dm-crypt/System configuration#crypttab).

This is completely non-understandable for me. Because discard option it's continuous trim. Should I use it instead of periodical trim?

Last edited by webcapcha (2024-04-13 21:29:07)


Ukrainian

Offline

Board footer

Powered by FluxBB