LVM Thin Volumes Fstrim Operation Not Supported

Home » CentOS » LVM Thin Volumes Fstrim Operation Not Supported
CentOS 3 Comments

Hi All

I’m trying to setup my LVM thin pool to support discards so that the pool can reclaim space even if the underlying device doesn’t support trim. It is my understanding that all thin pools should support trim even if the underlying device doesn’t. (please correct me if I’m wrong here)

I have one CentOS server that does support trim and everything is working correctly but any new servers and thin pools throw the error below.

# fstrim -v /mnt/data00
fstrim: /mnt/data00: the discard operation is not supported

I can’t find any differences in the LVM configuration between the two servers, they both have the lv discards set to passthough.

Can anyone tell me if I’m missing something when creating the thin pool that would allow me to perform the fstrim.

I’m using xfs on all of the lvs.

Thanks, Tim

3 thoughts on - LVM Thin Volumes Fstrim Operation Not Supported

  • My guess? The passthrough is causing the error when the command passes through to the actual device, which doesn’t support Trim.

    I don’t know how it actually works, but you can try to poke it with this stick: copy a large file to this LV. Check the LV with lvdisplay. Delete the file. Fstrim. Lvdisplay. Now compare the two lvdisplay results.

    It should show the PEs used are less after fstrim.

    Chris Murphy

  • I still get the “the discard operation is not supported” fstrim error when the LVs are set to “nopassdown”

    Seems that when I use ext4 the fstrim reports that it worked but the LVs Data% does not decrease after the fstrim. xfs just throws the error.

    I’ve also been looking at the output of lsblk -D

    # lsblk -D
    NAME DISC-ALN DISC-GRAN DISC-MAX DISC-ZERO
    xvdb 0 0B 0B 0
    ├─data-pool00_tmeta 0 0B 0B 0
    │ └─data-pool00-tpool 0 0B 0B 0
    │ ├─data-pool00 0 0B 0B 0
    │ └─data-data 0 0B 0B 0
    └─data-pool00_tdata 0 0B 0B 0
    └─data-pool00-tpool 0 0B 0B 0
    ├─data-pool00 0 0B 0B 0
    └─data-data 0 0B 0B 0

    I expect the DISC-GRAN and DISC-MAX to be greater than 0B.