The Notebook Review forums were hosted by TechTarget, who shut down them down on January 31, 2022. This static read-only archive was pulled by NBR forum users between January 20 and January 31, 2022, in an effort to make sure that the valuable technical information that had been posted on the forums is preserved. For current discussions, many NBR forum users moved over to NotebookTalk.net after the shutdown.
Problems? See this thread at archive.org.

    ssd trim in ubuntu?

    Discussion in 'Linux Compatibility and Software' started by hemlok, Jan 20, 2010.

  1. hemlok

    hemlok Notebook Enthusiast

    Reputations:
    4
    Messages:
    47
    Likes Received:
    0
    Trophy Points:
    15
    Hi, I've been using ubuntu netbook remix 9.04 for a little while(I'm still a novice) on my 1810t with no problem but I just bought a intel X-25 V and I'm wondering if I got my trim working right (i'm not 100% sure what it does except boost performance)

    I'm sorry if there is a thread that covered the subject I scrolled quickly in the search tab and couldn't find one.

    I did some research and I think it only work on ext4 file system and I'm not sure if it's supported on 9.04 so i upgraded to a 9.10 netbook remix (wich caused me more trouble on the ui side then 9.04)

    I found some help via google and installed hdparm-9.27 and got a hold of a wiper-2.5 file that support intel ssd.

    I then run sudo ./wiper.sh --commit /
    in my hdparm folder and I get this

    Does this seem like working trim? If so how often should I run this (my guess is its automatic in w7) and what is a good way to test hd performance in ubuntu so I know if it actually works?

    Thanks alot for any help I can get :cool:
     

    Attached Files:

    • trim.png
      trim.png
      File size:
      90.1 KB
      Views:
      365
  2. Pitabred

    Pitabred Linux geek con rat flail!

    Reputations:
    3,300
    Messages:
    7,115
    Likes Received:
    3
    Trophy Points:
    206
    http://lwn.net/Articles/353411/

    That article might shed some light on things ;) Google for Linux trim instead of Ubuntu... it's more a function of the kernel than anything.
     
  3. DEagleson

    DEagleson Gamer extraordinaire

    Reputations:
    2,529
    Messages:
    3,107
    Likes Received:
    30
    Trophy Points:
    116
    I dont know for certain if Ubuntu 9.04 supports ssd trim, but maybe Ubuntu 10.04 LTS will since its based on a newer kernel.
     
  4. jasperjones

    jasperjones Notebook Evangelist

    Reputations:
    293
    Messages:
    427
    Likes Received:
    4
    Trophy Points:
    31
    I'm fairy sure 9.04 doesn't support ATA Trim. Neither does 9.10.

    Linux has full Trim support only since 2.6.32. (According to Wikipedia, Trim was prepared in 2.6.28 but not fully implemented.)

    Since 10.04 LTS will use 2.6.32, it should support Trim (it seems some of the necessary changes on the file system side have already been implemented with Karmic).
     
  5. jasperjones

    jasperjones Notebook Evangelist

    Reputations:
    293
    Messages:
    427
    Likes Received:
    4
    Trophy Points:
    31
    Just a quick update on this: while 2.6.32 supports the ATA TRIM command, it only does so for the btrfs file system. The 2.6.33 kernel released today now also supports it on ext4, nowadays the default file system in many distros.

    However, in the standard config, support for TRIM is not activated. Let's hope our favorite distros will enable it nevertheless during the upcoming release cycle.
     
  6. ALLurGroceries

    ALLurGroceries  Vegan Vermin Super Moderator

    Reputations:
    15,730
    Messages:
    7,146
    Likes Received:
    2,343
    Trophy Points:
    331
  7. Ayle

    Ayle Trailblazer

    Reputations:
    877
    Messages:
    3,707
    Likes Received:
    7
    Trophy Points:
    106
    Well it's not like the OP can't compile it's own kernel right? Unless they have changed the procedure, I'll I had to do was download a tarball, select whatever options I wanted to have on the kernel when creating the makefile, launch the build and go outside while the computer was crunching numbers... It is fairly straightforward.
     
  8. jasperjones

    jasperjones Notebook Evangelist

    Reputations:
    293
    Messages:
    427
    Likes Received:
    4
    Trophy Points:
    31
    ^^^ agreed, if OP doesn't mind grabbing a 2.6.33 vanilla and compiling it, there should be no problem.

    i'd be interested to hear if somebody knows more. all i figured is that trim must still be somewhat experimental since it's deactivated by default.
     
  9. mr_raider

    mr_raider Notebook Consultant

    Reputations:
    13
    Messages:
    160
    Likes Received:
    0
    Trophy Points:
    30
    Is the TRIM tool restricted to Intel SSDs?
     
  10. ALLurGroceries

    ALLurGroceries  Vegan Vermin Super Moderator

    Reputations:
    15,730
    Messages:
    7,146
    Likes Received:
    2,343
    Trophy Points:
    331
    No, TRIM is a (mostly) standard ATA command, so any drive that implements it (some need firmware updates, etc) should work given a filesystem (and kernel) that supports it.
     
  11. mr_raider

    mr_raider Notebook Consultant

    Reputations:
    13
    Messages:
    160
    Likes Received:
    0
    Trophy Points:
    30
    Just ordered a Kingston SSDnow snv-425 with the revised j micron controller. Not the fastest, but definitely a step up from 5400rpm notebook drive. We'll see how it goes. I think I'll just install Ubuntu 10.04 fresh when it comes out.

    Do we still need to "align partitions" on SSDs?
     
  12. ALLurGroceries

    ALLurGroceries  Vegan Vermin Super Moderator

    Reputations:
    15,730
    Messages:
    7,146
    Likes Received:
    2,343
    Trophy Points:
    331
    Yes you still need to align partitions, TRIM just speeds up writes to previously used space.

    Think of how you delete a file and you can still recover it later; it is still on the disk taking up space, it is just gone from the filesystem's records. The SSD sees a block of data and still thinks it is in use, which slows things down. With TRIM the filesystem tells the kernel which tells the controller that a block is no longer in use, and this speeds up writing to the drive.

    If you don't align the partitions you are ending up with more read/write/erase cycles than you need to, since the filesystem block size won't match the controller's block size.

    The performance difference will vary between controllers, but always will be better when aligned to the erase block size, and even better with TRIM, especially after you use the SSD for a while.
     
  13. mr_raider

    mr_raider Notebook Consultant

    Reputations:
    13
    Messages:
    160
    Likes Received:
    0
    Trophy Points:
    30
    Any guides to partition alignment under ubuntu?
     
  14. ALLurGroceries

    ALLurGroceries  Vegan Vermin Super Moderator

    Reputations:
    15,730
    Messages:
    7,146
    Likes Received:
    2,343
    Trophy Points:
    331
  15. mr_raider

    mr_raider Notebook Consultant

    Reputations:
    13
    Messages:
    160
    Likes Received:
    0
    Trophy Points:
    30
    He states that his first partition isn't aligned. But I want my first partition to be / not /boot, so I need it aligned. I like to have separate / and /home partitions.
     
  16. ALLurGroceries

    ALLurGroceries  Vegan Vermin Super Moderator

    Reputations:
    15,730
    Messages:
    7,146
    Likes Received:
    2,343
    Trophy Points:
    331
    I left my /boot unaligned as my first partition, but if you want only /home and root, leave some free space before the first partition to keep it aligned.
     
  17. leebingate

    leebingate Newbie

    Reputations:
    0
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    5
    Just a quick update on this: while 2.6.32 supports the ATA TRIM command, it only does so for the btrfs file system. The 2.6.33 kernel released today now also supports it on ext4, nowadays the default file system in many distros.

    However, in the standard config, support for TRIM is not activated. Let's hope our favorite distros will enable it nevertheless during the upcoming release cycle.
     
  18. mr_raider

    mr_raider Notebook Consultant

    Reputations:
    13
    Messages:
    160
    Likes Received:
    0
    Trophy Points:
    30
    My ssdnow has 8kbyte write page size, and 1MB erase page size. How would we align it?
     
  19. ALLurGroceries

    ALLurGroceries  Vegan Vermin Super Moderator

    Reputations:
    15,730
    Messages:
    7,146
    Likes Received:
    2,343
    Trophy Points:
    331
    Same way as in the guide from Ted Ts'o:
    Code:
    fdisk -H 224 -S 56 /dev/sdb
    As he says, this leaves the first partition unaligned. Create a first partition (or just leave it as empty space), doesn't have to be big, then create your other partitions.

    You will need to do this outside of the normal installer I'd suspect, since most installers have automated tools these days for partitioning, and fdisk is generally not an option. You can just hit alt+f2 in the Debian installer to get to a shell and use fdisk, I think you can on Ubuntu as well. Or you can run a livecd. Then when you get to the partitioning step in the installer you can use the manual partitioning option and make sure your mount points are set correctly for the partitions you already created.
     
  20. erple2

    erple2 Notebook Geek

    Reputations:
    0
    Messages:
    95
    Likes Received:
    0
    Trophy Points:
    15
    Less of the first, more or the second - ultimately, it takes a lot of time to "erase" a block in an SSD. Enough time that it's faster to simply write to a new, empty block than to read everything out of a block, and into a buffer, erase that block, merge the stuff you just read out of a block with the new stuff you want to write to the block, then write that block.

    In the SSD case, you can think of a "block" as a large chunk of space. The SSD reads and writes data to an entire block at a time, regardless of how much of the block is actually used up. So even if you only use up 25% of the block, you can't fill the next 25% of the block until you do the "Read - Erase - Write" cycle.

    The controller "knows" which blocks of data are already "used". So when writing new data, it just moves to the next unused block for much faster performance. What TRIM does is tells the controller to start going through (when it's not doing anything else) and "erasing" the blocks that are marked as "deleted" but still have something in them, thereby "zeroing out" that block, so it's fast to write to for the next time some data has to be written to it.
     
  21. ALLurGroceries

    ALLurGroceries  Vegan Vermin Super Moderator

    Reputations:
    15,730
    Messages:
    7,146
    Likes Received:
    2,343
    Trophy Points:
    331
    I don't follow you. In a nutshell what I said was: without trim once you fill a critical level of the disk it degrades since you are constantly doing erases before you can write... alignment is a separate issue, which you also quoted but did not address. Again, I don't follow you.