Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1390148

Summary: discard operation is not supported on SSD disk
Product: Red Hat Enterprise Linux 7 Reporter: Maurizio Lombardi <mlombard>
Component: kernelAssignee: LVM and device-mapper development team <lvm-team>
kernel sub component: Device Mapper QA Contact: Storage QE <storage-qe>
Status: CLOSED NOTABUG Docs Contact:
Severity: medium    
Priority: unspecified CC: agk, msnitzer
Version: 7.2   
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-10-31 11:43:12 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Maurizio Lombardi 2016-10-31 10:21:17 UTC
Description of problem:

fstrim fails despite the fact the SSD disk supports TRIM.

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

$ sudo hdparm -I /dev/sda | grep TRIM
*	Data Set Management TRIM supported (limit 8 blocks)

$ lsblk 
NAME                                          MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda                                             8:0    0 465.8G  0 disk  
├─sda1                                          8:1    0   500M  0 part  /boot
└─sda2                                          8:2    0 465.3G  0 part  
  └─luks-87671703-29ad-4572-a663-bda2d7bb1ac7 253:0    0 465.3G  0 crypt 
    ├─rhel_dhcp--27--244-root                 253:1    0    50G  0 lvm   /
    └─rhel_dhcp--27--244-home                 253:2    0 415.3G  0 lvm   /home

$ dmesg |grep SSD
[    1.423002] ata1.00: ATA-9: Samsung SSD 850 EVO 500GB, EMT02B6Q, max UDMA/133
[    1.424294] scsi 0:0:0:0: Direct-Access     ATA      Samsung SSD 850  2B6Q PQ: 0 ANSI: 5

$ uname -a
Linux annapurna 3.10.0-327.36.2.el7.x86_64 #1 SMP Tue Sep 27 16:01:21 EDT 2016 x86_64 x86_64 x86_64 GNU/Linux

Comment 1 Ondrej Kozina 2016-10-31 10:36:33 UTC
Hi Maurizio,

dm-crypt doesn't enable discard by default and this is not going to change (in kernel). First due to security reasons and secondly due to fact that you may destroy existing hidden volume in legacy true-crypt containers with discard enabled by default. Single fstrim on such volumes and hidden volume is gone for good:)

On the other hand starting with cryptsetup 2.0 we will change the userspace so that any LUKSv2 containers is by default activated with discard enabled.

Wrt to LUKSv1 you may change the default by adding appropriate discard option in /etc/crypttab.