You are not logged in.
Pages: 1
Hello everyone.
I am the very freshman to the archlinux and today I would like to ask a question that bothers me a lot.
Actually I want to do
sudo fstrim -v /
but it won't works because I encrypt the disk with LUKS and it will return
fstrim: /: the discard operation is not supported
So I refer to this site https://wiki.archlinux.org/title/Dm-cry … ives_(SSD), and following is my config based on it:
First I input
sudo nano /etc/fstab
and I edit it and add a line like this:
/dev/disk/by-uuid/My LUKS UUID / ext4 defaults,discard 0 1
Then I use this command:
sudo nano /etc/crypttab
And I edit it and add a line like this:
cryptroot UUID=My LUKS UUID none luks,discard
At last I save all of them and use this command
sudo mkinitcpio -P
then I reboot the computer. Unfortunately after the reboot I am still not be able to run fstrim on LUKS and it still return with
fstrim: /: the discard operation is not supported
Offline
First I input
sudo nano /etc/fstab
and I edit it and add a line like this:
/dev/disk/by-uuid/My LUKS UUID / ext4 defaults,discard 0 1
You don't need to mount with the discard option to use fstrim.
Then I use this command:
sudo nano /etc/crypttab
And I edit it and add a line like this:
cryptroot UUID=My LUKS UUID none luks,discard
The LUKS container with the root file system is unlocked in early userspace (in the initramfs stage). That's long before /etc/crypttab on real root gets parsed.
You should either use the method with kernel parameters or enable discards persistently by setting the allow-discards flag in the LUKS2 header. Both of those things are described in https://wiki.archlinux.org/title/Dm-cry … ives_(SSD) (which you linked).
Offline
Oh, I just found that
cryptsetup --allow-discards --persistent refresh root
can just makes me able to trim the SSD
Last edited by OIhfes (2024-01-18 02:58:40)
Offline
Pages: 1