On Wed, Nov 25, 2020 at 2:48 PM Ed Greshko <ed.greshko@greshko.com> wrote:

The difference here is the "thin-provisioned" lvm.  In this case the Trim/Discard isn't being used
to extend or improve the performance of the underlying hardware.  It is being used to free/return
unused blocks to the "pool".

The question is how do I enable it ?

I don't think TRIM is supported since 'hdparm' gives me the following output:

$  hdparm -I /dev/sda

Capabilities:
        LBA, IORDY(can be disabled)
        Queue depth: 32
        Standby timer values: spec'd by Standard, no device specific minimum
        R/W multiple sector transfer: Max = 16  Current = 16
        Advanced power management level: 128
        DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 udma5 *udma6
             Cycle time: min=120ns recommended=120ns
        PIO: pio0 pio1 pio2 pio3 pio4
             Cycle time: no flow control=120ns  IORDY flow control=120ns
Commands/features:
        Enabled Supported:
           *    SMART feature set
                Security Mode feature set
           *    Power Management feature set
           *    Write cache
           *    Look-ahead
           *    WRITE_BUFFER command
           *    READ_BUFFER command
           *    NOP cmd
           *    DOWNLOAD_MICROCODE
           *    Advanced Power Management feature set
                Power-Up In Standby feature set
           *    SET_FEATURES required to spinup after power up
           *    48-bit Address feature set
           *    Device Configuration Overlay feature set
           *    Mandatory FLUSH_CACHE
           *    FLUSH_CACHE_EXT
           *    SMART error logging
           *    SMART self-test
           *    General Purpose Logging feature set
           *    64-bit World wide name
           *    IDLE_IMMEDIATE with UNLOAD
           *    WRITE_UNCORRECTABLE_EXT command
           *    {READ,WRITE}_DMA_EXT_GPL commands
           *    Segmented DOWNLOAD_MICROCODE
           *    Gen1 signaling speed (1.5Gb/s)
           *    Gen2 signaling speed (3.0Gb/s)
           *    Gen3 signaling speed (6.0Gb/s)
           *    Native Command Queueing (NCQ)
           *    Phy event counters
           *    Idle-Unload when NCQ is active
           *    READ_LOG_DMA_EXT equivalent to READ_LOG_EXT
           *    DMA Setup Auto-Activate optimization
           *    Device-initiated interface power management
           *    Software settings preservation
           *    SMART Command Transport (SCT) feature set
           *    SCT Write Same (AC2)
           *    SCT Error Recovery Control (AC3)
           *    SCT Features Control (AC4)
           *    SCT Data Tables (AC5)
           *    reserved 69[3]


As you can see there is no TRIM support.

Also :

$  lsblk --discard
NAME                                          DISC-ALN DISC-GRAN DISC-MAX DISC-ZERO
sda                                                  0        0B       0B         0
├─sda1                                               0        0B       0B         0
├─sda2                                               0        0B       0B         0
└─sda3                                               0        0B       0B         0
  └─luks-2ec7f1ae-6f9b-4896-a7b2-be7809e9d2f4        0        0B       0B         0
    ├─vgfedora-pool00_tmeta                          0        0B       0B         0
    │ └─vgfedora-pool00-tpool                        0        0B       0B         0
    │   ├─vgfedora-fedora                            0      512K      16G         0
    │   └─vgfedora-pool00                            0        0B       0B         0
    └─vgfedora-pool00_tdata                          0        0B       0B         0
      └─vgfedora-pool00-tpool                        0        0B       0B         0
        ├─vgfedora-fedora                            0      512K      16G         0
        └─vgfedora-pool00                            0        0B       0B         0
sdb                                                  0        0B       0B         0
├─sdb1                                               0        0B       0B         0
└─sdb2                                               0        0B       0B         0
sr0                                                  0        0B       0B         0



As you can see there is no non-zero value for DISC-GRAN and DISC-MAX.

Also during boot I get the following info: 

                                     device-mapper: thin: Data device (dm-2) discard unsupported: Disabling discard passdown.

So what do I do now ?

I hope my system is suited for thin volumes.
--
Regards,
Sreyan Chakravarty