crypttab options are ignored
Hello, it seems that udisks can't understand discard option in crypttab
bitlk-12d663c1-e3ff-44ff-9c88-c0d4c2b20624 UUID=40C85337C8532A84 none discard,allow_discards
bitlk-12d663c1-e3ff-44ff-9c88-c0d4c2b20624 UUID=12d663c1-e3ff-44ff-9c88-c0d4c2b20624 none discard,allow_discards
bitlk-12d663c1-e3ff-44ff-9c88-c0d4c2b20624 PARTUUID=95527122-430a-4646-a747-f5aa68b8cbe4 none discard,allow_discards
bitlk-12d663c1-e3ff-44ff-9c88-c0d4c2b20624 LABEL=OS none discard,allow_discards
bitlk-12d663c1-e3ff-44ff-9c88-c0d4c2b20624 LABEL=ZENBOOK-S-16\x20OS\x2016\x2f06\x2f2025 none discard,allow_discards
bitlk-12d663c1-e3ff-44ff-9c88-c0d4c2b20624 UUID=CRYPT-BITLK-bitlk-12d663c1-e3ff-44ff-9c88-c0d4c2b20624 none discard,allow_discards
bitlk-12d663c1-e3ff-44ff-9c88-c0d4c2b20624 PARTLABEL=Basic\040data\040partition none discard,allow_discards
bitlk-12d663c1-e3ff-44ff-9c88-c0d4c2b20624 /dev/nvme0n1p3 none discard,allow_discards
bitlk-12d663c1-e3ff-44ff-9c88-c0d4c2b20624 PARTLABEL=Basic\x20data\x20partition none discard,allow_discards
sudo lsblk -D
Password:
NAME DISC-ALN DISC-GRAN DISC-MAX DISC-ZERO
nvme0n1 0 4K 2T 0
├─nvme0n1p1 0 4K 2T 0
├─nvme0n1p2 0 4K 2T 0
├─nvme0n1p3 0 4K 2T 0
│ └─bitlk-12d663c1-e3ff-44ff-9c88-c0d4c2b20624
│ 0 0B 0B 0
├─nvme0n1p4 0 4K 2T 0
├─nvme0n1p5 0 4K 2T 0
├─nvme0n1p6 0 4K 2T 0
└─nvme0n1p7
The bitlk-12d663c1-e3ff-44ff-9c88-c0d4c2b20624 entry is clearly shown to have DISC-MAX of 0, which means discard is not enabled. If I use cryptsetup manually sudo cryptsetup --allow-discards open --type=bitlk --allow-discards /dev/nvme0n1p3 windows, discards will work, and lsblk -D will show correct discard info.
All mounted LUKS devices by udisks does not enable discard:
# dmsetup table luks-7d54b477-c994-4081-ae19-f63882342c37
0 466909184 crypt aes-xts-plain64 :64:logon:cryptsetup:7d54b477-c994-4081-ae19-f63882342c37-d0 0 259:2 4096
Here is no option for LUKS allow_discards in udisks2.conf
workaround:
cryptsetup --allow-discards --persistent refresh luks
workaround:
cryptsetup --allow-discards --persistent refresh luks
Unfortunately, not an option for bitlocker
Yes, we are currently ignoring options from crypttab, unfortunately it's not as easy to support these as fstab options, where we can just take the string a pass it to (lib)mount. With crypttab some of the options are crypttab/systemd specific options and only a small subset is actually something we can use/set when opening the device with (lib)cryptsetup. discard is one of the options (the only other one is probably read-only) we can support and pass as flag to cryptsetup. This will unfortunately require change in libblockdev so it will take some time to implement.