Public bug reported:

With a LUKS > LVM > EXT4 rootfs the update-initramfs hooks scripts do
not include the "allow-discards" option in the generated

/conf/conf.d/cryptroot

This prevents all file-systems contained in the LVM VG LVs from using
the mount option 'discard'.

$ journalctl | grep -B3 'Mounted /'
Sep 01 19:48:08 hephaestion.lan.iam.tj systemd-fsck[547]: 14.04_var: recovering 
journal
Sep 01 19:48:08 hephaestion.lan.iam.tj kernel: EXT4-fs (dm-3): mounting with 
"discard" option, but the device does not support discard
Sep 01 19:48:08 hephaestion.lan.iam.tj kernel: EXT4-fs (dm-3): mounted 
filesystem with ordered data mode. Opts: discard
Sep 01 19:48:08 hephaestion.lan.iam.tj systemd[1]: Mounted /usr/local.
--
Sep 01 19:48:08 hephaestion.lan.iam.tj systemd[1]: Started Cryptography Setup 
for LUKS_OS.
Sep 01 19:48:08 hephaestion.lan.iam.tj kernel: EXT4-fs (dm-2): mounting with 
"discard" option, but the device does not support discard
Sep 01 19:48:08 hephaestion.lan.iam.tj kernel: EXT4-fs (dm-2): mounted 
filesystem with ordered data mode. Opts: discard
Sep 01 19:48:08 hephaestion.lan.iam.tj systemd[1]: Mounted /var.
--
Sep 01 19:48:11 hephaestion.lan.iam.tj systemd[1]: Mounting /boot...
Sep 01 19:48:11 hephaestion.lan.iam.tj kernel: EXT4-fs (dm-4): mounting ext3 
file system using the ext4 subsystem
Sep 01 19:48:11 hephaestion.lan.iam.tj kernel: EXT4-fs (dm-4): mounted 
filesystem with ordered data mode. Opts: discard
Sep 01 19:48:11 hephaestion.lan.iam.tj systemd[1]: Mounted /boot.
--
Sep 01 19:48:11 hephaestion.lan.iam.tj systemd[1]: Mounting /home...
Sep 01 19:48:11 hephaestion.lan.iam.tj kernel: EXT4-fs (dm-6): mounted 
filesystem with ordered data mode. Opts: discard
Sep 01 19:48:11 hephaestion.lan.iam.tj systemd[1]: Mounted /home.

Any encrypted VG that is unlocked by the init system later on correctly
uses 'allow-discards'

kernel: Command line: BOOT_IMAGE=/vmlinuz-4.1.0-3-lowlatency
root=/dev/mapper/VG_OS-ubuntu_15.10_rootfs ro pci=use_crs

$ cat /etc/crypttab 
LUKS_OS   UUID=f7175e39-2594-4cb9-b842-de2e1c208f61 /path/to/key.file 
luks,allow-discards,keyscript=/usr/local/sbin/luks_keyfile.sh

$ cat /tmp/initrd/conf/conf.d/cryptroot 
target=LUKS_OS,source=UUID=f7175e39-2594-4cb9-b842-de2e1c208f61,key=/path/to/key.file,rootdev,lvm=VG_OS-ubuntu_14.04_rootfs,keyscript=/lib/cryptsetup/scripts/luks_keyfile.sh

$ sudo dmsetup table | grep LUKS
LUKS_DATA: 0 706482157 crypt aes-xts-plain64 0...0 0 8:5 4096 1 allow_discards
LUKS_BOOT: 0 1568768 crypt aes-xts-plain64 0..0 0 8:3 4096 1 allow_discards
LUKS_OS: 0 268431360 crypt aes-xts-plain64 0...0 0 8:4 4096

$ grep discard /etc/fstab
UUID=6a718a43-2187-49f4-99fd-3f696cb36c4c / ext4 
defaults,errors=remount-ro,discard 0 1
UUID=bd28407f-1ba5-412e-949d-230dab13437a /boot ext3 defaults,discard 0 2
UUID=fa6d6717-2464-4250-9ba3-0a5cb14a7253 /var ext4 defaults,discard 0 2
UUID=1d3fa07a-8200-4dd0-99b5-6a598a2636c2 /usr/local ext4 defaults,discard 0 2
UUID=48a00384-04dc-4ea3-a753-7c68ab306cc7 /home ext4 defaults,discard 0 2

$ apt-cache policy cryptsetup
cryptsetup:
  Installed: 2:1.6.6-5ubuntu2

** Affects: cryptsetup (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1491150

Title:
  15.10: No SSD TRIM (allow-discards) support in update-initramfs

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/cryptsetup/+bug/1491150/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to