Bug 1390148 - discard operation is not supported on SSD disk
Summary: discard operation is not supported on SSD disk
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: kernel
Version: 7.2
Hardware: Unspecified
OS: Linux
unspecified
medium
Target Milestone: rc
: ---
Assignee: LVM and device-mapper development team
QA Contact: Storage QE
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-10-31 10:21 UTC by Maurizio Lombardi
Modified: 2016-10-31 11:43 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-10-31 11:43:12 UTC
Target Upstream Version:


Attachments (Terms of Use)

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.


Note You need to log in before you can comment on or make changes to this bug.