0
  • Ubuntu 14.04.4 LTS
  • SSD is only drive (/dev/sda)
  • /dev/sda1 is boot partition
  • /dev/sda5 is encrypted LUKS partition
  • logical volumes sit on top of the LUKS partition

Reverting to snapshots seems to work (the reverted system appears as it should), but the process yields a BLKDISCARD fail. In the following terminal, I run lvconvert --merge from a live ISO session.

xubuntu@xubuntu:~$ sudo lvconvert --merge /dev/vg1/lvsnapshot14
Merging of volume lvsnapshot14 started.
lvroot: Merged: 92.7%
lvroot: Merged: 100.0%
Merge of snapshot into logical volume lvroot has finished.
/dev/mapper/sda5_crypt: BLKDISCARD ioctl at offset 121333874688 size 3221225472 failed: Operation not supported.
Logical volume "lvsnapshot14" successfully removed
xubuntu@xubuntu:~$ 

I thought this might be related to TRIM, but I do have TRIM enabled at all levels:

  • filesystem via /etc/cron.weekly/fstrim
  • lvm via /etc/lvm/lvm.conf
  • dm-crypt via /etc/crypttab

And manually running trim is successful.

Any ideas on what's driving the failure?

0

Figured it out. The problem is that while I have TRIM support enabled at the encryption level in the system, I did not have it enabled in the live session.

I was using cryptsetup luksOpen /dev/sda5 sda5_crypt prior to running lvconvert --merge as described in the question. Trim support is not enabled here, thus when BLKDISCARD runs after the snapshot is merged, it fails.

The solution is to use cryptsetup luksOpen --allow-discards /dev/sda5 sda5_crypt. This enables TRIM support at the encryption level. This can be verified with dmsetup table /dev/mapper/sda5_crypt --showkeys - the result should show "allow_discards" at the end.

Executing lvconvert --merge after this works fine:

xubuntu@xubuntu:~$ sudo lvconvert --merge /dev/vg1/lvsnapshot14
Merging of volume lvsnapshot14 started.
lvroot: Merged: 95.6%
lvroot: Merged: 100.0%
Merge of snapshot into logical volume lvroot has finished.
Logical volume "lvsnapshot14" successfully removed
xubuntu@xubuntu:~$ 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.