LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices

Reply
 
Search this Thread
Old 09-06-2012, 10:48 PM   #1
jas0n
LQ Newbie
 
Registered: Feb 2011
Distribution: Ubuntu 10.04
Posts: 4

Rep: Reputation: 0
Enabling TRIM on ssd


I just installed Squeeze on a 128 gb ssd and am trying to enable TRIM on the drive's partitions. I added the discard option in /etc/fstab and rebooted.

I had mixed verifying whether TRIM is enabled according to the directions I found in a couple guides on the subject.

Running the following indicated it is enabled:

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

But testing according to the following article indicates TRIM is not working:

http://techgage.com/article/enabling..._under_linux/2

To summarize, I created a test file; checked to see if data was present at the sector where the file started; deleted the file; and checked to see if the sector was zeroed out.

Is there a better, definitive way of checking whether this is working?
 
Old 09-07-2012, 01:22 AM   #2
qrange
Member
 
Registered: Jul 2006
Location: Belgrade, Yugoslavia
Distribution: Debian
Posts: 717

Rep: Reputation: 29
I think that is a bad test because physical sectors/blocks are much larger than logical. and TRIM probably works with physical ones.
some ssd drives (controlers) don't support TRIM, or you need to update controler firmware.
SandForce version 5.x for eg. has problems with TRIM.
 
Old 09-07-2012, 04:00 AM   #3
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Gentoo
Posts: 15,399
Blog Entries: 2

Rep: Reputation: 3993Reputation: 3993Reputation: 3993Reputation: 3993Reputation: 3993Reputation: 3993Reputation: 3993Reputation: 3993Reputation: 3993Reputation: 3993Reputation: 3993
We need more information:
Which file-system are you using? For TRIM support you need to use ext4 or btrfs.
The hdparm command only tells you if TRIM is supported by the drive, not if you have activated it on a specific partition.
To test if TRIM works you can also do a manual test (as root) with
Code:
fstrim -v /
This will only work on ext4 partitions.
 
1 members found this post helpful.
Old 09-07-2012, 04:02 PM   #4
jas0n
LQ Newbie
 
Registered: Feb 2011
Distribution: Ubuntu 10.04
Posts: 4

Original Poster
Rep: Reputation: 0
I am using ext4. The drive is a Samsung 128 gb 830.

I ran fstrim on both the root and home partitions. In both instances the output indicated that it did trim blocks on the file system. It seems that the test I linked to is invalid, at least on my system, because the blocks the deleted file used are not trimmed immediately.

Do I need to manually run fstrim every so often or set up a cron job for it, or is this something that is handled automatically?
 
Old 09-07-2012, 08:59 PM   #5
Cheesesteak
Member
 
Registered: Jun 2008
Distribution: Slackware
Posts: 100

Rep: Reputation: 24
Are you running the default 2.6.32 kernel with Squeeze? Trim isn't supported until 2.6.33+.
 
Old 09-08-2012, 09:42 AM   #6
jas0n
LQ Newbie
 
Registered: Feb 2011
Distribution: Ubuntu 10.04
Posts: 4

Original Poster
Rep: Reputation: 0
I beg your pardon. I installed Wheezy (I have Squeeze running on two other boxes). The kernel is 3.2.
 
Old 09-08-2012, 02:18 PM   #7
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 1,357

Rep: Reputation: 582Reputation: 582Reputation: 582Reputation: 582Reputation: 582Reputation: 582
Quote:
Originally Posted by jas0n View Post
But testing according to the following article indicates TRIM is not working:

http://techgage.com/article/enabling..._under_linux/2

To summarize, I created a test file; checked to see if data was present at the sector where the file started; deleted the file; and checked to see if the sector was zeroed out.
I wouldn't attach much significance to that test result. The drive isn't going to erase anything until the entire erase block (which is much larger than that little 4KB test file) is released by TRIM, or until a write somewhere else in that erase block forces the entire block to be reallocated. If it so happened that the test file was the only part of that erase block currently in use, then the drive might perform the erase immediately, but that action is something the drive's controller does at its leisure, and you can't control when it happens other than by triggering a (correctly working) secure erase of the entire drive.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ntfs-3g SSD TRIM? qrange Linux - Software 4 07-05-2012 10:00 PM
[SOLVED] RAID 1 SSD drives with TRIM grolendaves Linux - Hardware 2 06-05-2011 08:44 AM
[SOLVED] TRIM on SSD mira.mikes Linux - Kernel 8 01-08-2011 06:36 PM
[SOLVED] Fedora 13 SSD TRIM Support Potatos Linux - Hardware 6 06-14-2010 03:17 PM
SSD TRIM support on Linux Thoreau Linux - Kernel 2 03-25-2009 04:05 AM


All times are GMT -5. The time now is 02:54 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration