TRIM support not enabled for SSDs

Bug #864051 reported by Eduard Hasenleithner on 2011-10-01
100
This bug affects 39 people
Affects Status Importance Assigned to Milestone
partman-target (Ubuntu)
Medium
Unassigned

Bug Description

When creating the fstab, the discard option is not activated for SSDs with TRIM support. But for performance reasons, it would be very important to be activated.

1) lsb_release -rd
Description: Ubuntu oneiric (development branch)
Release: 11.10

2) apt-cache policy partman-target
N: Unable to locate package partman-target

3) What you expected to happen
Partitions on disk devices with TRIM support entered in fstab with the 'discard' mount option

4) What happened instead
Partitions on disk devices are always entered without the 'discard' option in fstab

I hope this is the right package; I found no other package generating the fstab.

Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in partman-target (Ubuntu):
status: New → Confirmed
Changed in partman-target (Ubuntu):
importance: Undecided → Medium
SKIP981 (gregorylew) wrote :

This bug affects me too. What I expect to happen when I install Ubuntu 12.04 is that it will support the TRIM by automatically entering the 'discard' option in the fstab file. I know you can do this manually but a lot of end-users do not even know how to deal with a terminal. This is a CRITICAL bug, especially when you are a system builder who plans on putting SSDs for even the lowest end hardware. Unless a Newer file system supports this TRIM command automatically, Please (and I mean please for the sake of Linux) fix this. Thank You to all the developers that work on Ubuntu!!

SKIP981 (gregorylew) wrote :

The only reason we are asking this to be fixed is because some people are uncomfortable using the terminal to enable TRIM on their SSD.

areteichi (areteichi) wrote :

Yeah I hope the discard command will be enabled by default in 12.10.

How to reliably detect SSD?
Is there a performance impact on enabling TRIM for non-SSD drives?

areteichi (areteichi) wrote :

I don't have a concrete solution, but gnome-disk-utility (palimpsest), for instance, somehow recognizes that my hard drive is a SSD. This leads me to believe that there is an instruction set already available with which the type of a hard drive can be identified.

Mark East (feasty) wrote :

You can detect the disk type from the following file:

/sys/block/sda/queue/rotational

Just cat it. 1 means it's rotational, 0 means it is an SSD. Just change sda to be the disk you want to inspect. You will also need root privileges to view the file.

areteichi (areteichi) wrote :

> feasty
Ok, assuming that this command will detect an SSD with good accuracy, another question is whether enabling TRIM for all SSDs would cause problems for some (e.g. unsupported SSD or server/enterprise SSD).

Mark East (feasty) wrote :

I researched it about a year ago now for work and the kernel should probe the hardware to see if it supports TRIM. If it doesn't then it won't use it. It shouldn't cause any problems for people. If anyone knows differently then let me know.

I've run disks with the discard option on normal rotational disks without issue.

Slug (neilbyrne) wrote :

There is a negative performance using TRIM / DISCARD when deleting a folder with a load of small files

Mark East (feasty) wrote :

Looking at the initial commit for TRIM in the kernel I can see that it's calling ata_id_has_trim() and passing in the disks ID. This looks like it filters disks that don't support TRIM.

You can see the commit for trim in the 2.6.33 kernel here:

http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=18f0f97850059303ed73b1f02084f55ca330a80c

If you want to investigate the ata_id_has_trim function more closely you can find it in include/linux/ata.h.

Anders Aagaard (aagaande) wrote :

As #10 says, there is a negative performance impact of mounting with discard. Personally I use fstrim in crontab instead.

tags: added: precise
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers