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 846949 - TRIM doesn't work on EXT4
Summary: TRIM doesn't work on EXT4
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: kernel
Version: 6.3
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Red Hat Kernel Manager
QA Contact: Red Hat Kernel QE team
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-08-09 08:40 UTC by Mykola Ulianytskyi
Modified: 2012-08-10 03:11 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-08-10 01:28:56 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Mykola Ulianytskyi 2012-08-09 08:40:11 UTC
Description of problem:
TRIM doesn't work on EXT4

Version-Release number of selected component (if applicable):
kernel-2.6.32-279.2.1.el6.x86_64

How reproducible:
Always


/etc/fstab:
UUID=ea113042-48a8-4ca7-9b12-2d147ec0adf9  /            ext4    defaults,noatime,nodiratime,discard        1 1

# hdparm -I /dev/sda | grep -i trim
* Data Set Management TRIM supported (limit 8 blocks)

# smartctl -i /dev/sda | grep Model
Device Model:     Corsair Performance Pro


TEST TRIM:
1. Create test file

# seq 1 1000 > testfile
# sync

2. Read sector

# hdparm --fibmap testfile
 filesystem blocksize 4096, begins at LBA 63; assuming 512 byte sectors.
 byte_offset  begin_LBA    end_LBA    sectors
           0   46403743   46403750          8

# hdparm --read-sector 46403743 /dev/sda
reading sector 46403743: succeeded
0a31 0a32 0a33 0a34 0a35 0a36 0a37 0a38
...

3. Remove file

# rm -f testfile
# sync
# sleep 10

4. Verify TRIM:
# hdparm --read-sector 46403743 /dev/sda

/dev/sda:
reading sector 46403743: succeeded
0a31 0a32 0a33 0a34 0a35 0a36 0a37 0a38
...

Result: TRIM doesn't work. All values should be zeros:
reading sector 46403743: succeeded
0000 0000 0000 0000 0000 0000 0000 0000
...


fstrim doesn't TRIM data too (values are not zeros).

# fstrim -v /
/: 90123654612 bytes were trimmed

# fstrim -v /
/: 0 bytes were trimmed



Test TRIM howtos with screenshots:
* http://nedoboi.wordpress.com/2011/11/12/tiny-tips-ssd-and-linux-enable-trim-and-check-if-it-works/
* http://techgage.com/article/enabling_and_testing_ssd_trim_support_under_linux/2

Has anybody had this problem or TRIM clean data as expected?

kernel-ml-3.5.0-2.el6.elrepo.x86_64 from ELrepo doesn't fix the problem.

Comment 2 Ric Wheeler 2012-08-09 17:00:43 UTC
If you want to verify TRIM, you need to be consistent in which level you test at (block level using hdparm or via the file system).

Also note that the behavior of each device can vary - TRIM commands can be ignored by a target.

If you are a RH customer, please open an official support ticket so we can track and escalate properly.

If you don't have a RH support contract, I would suggest taking this report to linux-ext4 mailing list or possible linux-ide.org.

Comment 3 Mykola Ulianytskyi 2012-08-09 18:01:31 UTC
Hi, Ric

It seems to be the SSD firmware bug.

I just tested other SSD PLEXTOR PX-256M3 with the same Marvell chipset - TRIM works perfectly on RHEL kernel and on vanilla kernel 3.5.

Thank you

Comment 4 Mykola Ulianytskyi 2012-08-09 18:02:28 UTC
Please close as not_a_bug.

Comment 5 Ric Wheeler 2012-08-10 01:28:56 UTC
Hi Nikolay,

Please note that the specification has various options in it - devices have a specific option to return "0" or not for trimmed regions (not sure if Martin Peterson's doc covers this, but have a look in google for linux-advanced-storage-6.0.pdf for some details).

The device might be compliant with the spec and return you garbage after a TRIM command (although that is not really useful!).


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