Update crypttab asks for Passphrase for fstrim

Anthony Fornito asked:

This is kind of a continuation of – How to get free space from mounted drive Redhat 7

The problem I am facing is when i run:

[[email protected] /]# fstrim -v /

I get the following error:

fstrim: /: the discard operation is not supported

Googling all day has always had one common theme.

Update the /etc/crypttab to something similar to this:

[[email protected] ~]# cat /etc/crypttab 
luks-2OHGU8-ir1w-LLGB-6v72-zZqN-CIaX-FjGImJ UUID=2OHGU8-ir1w-LLGB-6v72-zZqN-CIaX-FjGImJ none allow-discards

What happens is after I update this file and i run “dracut -f” as well as “dracut –force -I /etc/crypttab” then i reboot. The system will come up and ask for a passphrase, which it seems i can enter any random string and it will let me go through.

I did find an article about adding a key file but im not really sure about that.

I do not want to get locked out of the system, also i really have no idea what im doing.

Some information that might be helpful.

One of many articles I am following about how to enable fstrim


This looks good:

[[email protected] /]# cat /etc/fstab | grep root
/dev/mapper/rhel_x011dc01--rhtest-root /                       xfs     defaults,discard        1 2

[[email protected] /]# cat /etc/lvm/lvm.conf | grep 'issue_discards'
    # Configuration option devices/issue_discards.
    issue_discards = 1

Now even after i update the /etc/crypttab and update the system and reboot, when it asks for the passphrase I will enter it login and still I will get the same exact error.

fstrim: /: the discard operation is not supported

I have tried changing luks,discard to allow-discards no effect.

I am not against trying to configure a passphrase key thing, however if it is still not working i dont want to go through the trouble.

I have updated my

    [[email protected] /]# cat /etc/default/grub
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_CMDLINE_LINUX="rd.luks.allow-discards=luks-2OHGU8-ir1w-LLGB-6v72-zZqN-CIaX-FjGImJ rd.luks.uuid=luks-2OHGU8-ir1w-LLGB-6v72-zZqN-CIaX-FjGImJ vconsole.font=latarcyrheb-sun16 vconsole.keymap=us $([ -x /usr/sbin/rhcrashkernel-param ] && /usr/sbin/rhcrashkernel-param || :) rhgb quiet"

And then running this to….. do something:

grub2-mkconfig -o /boot/grub2/grub.cfg

Also probably worth noting what is going in my head.

[[email protected] /]# blkid
**/dev/block/8:2: UUID="2OHGU8-ir1w-LLGB-6v72-zZqN-CIaX-FjGImJ" TYPE="LVM2_member"**
/dev/block/253:1: UUID="ad872f09-5147-4252-af56-aa6244219515" TYPE="xfs"
/dev/block/8:1: UUID="83aac355-a443-4ff9-90fa-9f6da8e31cc2" TYPE="xfs"
/dev/block/253:0: UUID="dbe56f6a-2a4a-42da-82e2-bef9a73caafb" TYPE="swap"

[[email protected] /]# lsblk
NAME                           MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
fd0                              2:0    1    4K  0 disk
sda                              8:0    0   50G  0 disk
ââsda1                           8:1    0  500M  0 part /boot
**ââsda2**                           8:2    0 49.5G  0 part
  âârhel_x011dc01--rhtest-swap 253:0    0    2G  0 lvm  [SWAP]
  **âârhel_x011dc01--rhtest-root 253:1    0 47.5G  0 lvm  /**
sdb                              8:16   0   50G  0 disk
sr0                             11:0    1 1024M  0 rom

What i want to be able to do is run fstrim on the “/” only so i am using So i am using the UUID=”2OHGU8-ir1w-LLGB-6v72-zZqN-CIaX-FjGImJ”

[[email protected] /]# blkid /dev/sda2
/dev/sda2: UUID="2OHGU8-ir1w-LLGB-6v72-zZqN-CIaX-FjGImJ" TYPE="LVM2_member"

This is my fstab

[[email protected] /]# cat /etc/fstab

**/dev/mapper/rhel_x011dc01--rhtest-root /                       xfs     defaults,discard        1 2**
UUID=83aac355-a443-4ff9-90fa-9f6da8e31cc2 /boot                   xfs     defaults        0 0
/dev/mapper/rhel_x011dc01--rhtest-swap swap                    swap    defaults        0 0

Anthony else I can add that might be helpful please let me know.

My answer:

When storage is provided by a remote server across a SAN, you can only discard blocks if the storage is thin provisioned. If the storage is thick provisioned, it is always the same size, and discard makes no sense (and thus isn’t usable).

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.