enabling TRIM for your SSD on Ubuntu 10.10

I put in an Intel SSDSA2MP040G2K5 into my Lenovo X100e, and did a clean install of Ubuntu 10.10 with the default ext4 settings.

I wanted to check whether TRIM was enabled and working. Here’s the guide to check that. Turns out TRIM was not turned on by default on my install. Here’s the guide to turn it on.

Short version: add “discard” to your ext4 mount options.

Here’s the description of the mount options for ext4: http://www.mjmwired.net/kernel/Documentation/filesystems/ext4.txt

Here’s what my system has in the kernel log after enabling TRIM:

root@x100e:~# dmesg | grep EXT4
[ 1.862448] EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts: (null)
[ 2.412732] EXT4-fs (sda1): re-mounted. Opts: discard,errors=remount-ro
[ 7.271710] EXT4-fs (sda1): re-mounted. Opts: discard,errors=remount-ro,commit=0
[ 9.685766] EXT4-fs (sda1): re-mounted. Opts: discard,errors=remount-ro,commit=0

“commit=0″ is the same as “commit=5″ (default)

I didn’t make any other changes to the mount options. “noatime” and “data=writeback” could provide a bit of a performance boost, but I like having the access time information for my files, and I’ve already had a few hard lockups with this machine, so I’d rather not risk any data loss or fs corruption with the writeback mode.

Leave a Reply

You must be logged in to post a comment.