Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Will a standard fresh linux (Ubuntu 11.10 to be exact) install and drive re-format (full) successfully TRIM my SSD, or do I need to do something extra?

I know that ext4 will TRIM blocks on erase when I specify the discard option, but I want to start with a completely TRIMmed drive if possible.

share|improve this question

3 Answers 3

up vote 3 down vote accepted

TRIM is a command that needs to be sent for individual blocks. I have asked the question before (What is the recommended way to empty a SSD?) and it is suggested to use ATA Secure Erase, a command that is sent to the device to clear all data.

share|improve this answer

Quick steps and results (summarised from the ATA Secure Erase page) follow: If the output is not what is expected, see the full page. Replace /dev/X with your device.

  1. hdparm -I /dev/X should include "not frozen" - if frozen (see notes below on what went wrong for me):
    • Suspend the computer, complete the rest of these steps then power off (see notes)
    • or try printf mem > /sys/power/state (from the comments; didn't work for me - permission denied)
  2. hdparm --user-master u --security-set-pass password /dev/X
  3. hdparm -I /dev/X should include "enabled"
  4. hdparm --user-master u --security-erase password /dev/X
  5. hdparm -I /dev/X should include "not enabled"

From the page's results, it seems that these steps should be able to be done in a couple of minutes on an Intel X25-M 80GB SSD. Correction: On my Intel X25-M, I was done in just over a minute: step 2 is instant.

Notes on unfreezing via suspend: Suspending my computer to unfreeze the disk worked for me. I:

  1. installed Ubuntu
  2. booted it
  3. added graphics drivers
  4. Rebooted - but it froze on shutdown
  5. Reset power, and found an unbootable system.

Re-launching the install showed that there were no partitions on my drive. It seems that bypassing the BIOS security left my partitions in memory of some kind.

share|improve this answer
    
If it's frozen, you may want to try unfreezing it by suspending the system to memory. printf mem > /sys/power/state usually does the trick. –  Chris Down Feb 23 '12 at 19:40

mkfs.ext4 has an extra option -E discard to send TRIM for appropriate blocks when creating the filesystem.

I can't tell whether the installer uses this option, or whether it is used by mkfs.ext4 by default, but at least you can explicitly use it when creating the filesystems on your own.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.