Kim Hansen - 2012-05-13

Hi all,

I have just gotten a new Toshiba Z830 with SSD drive and I am trying to validate that the TRIM functionality is working on it. I am following the instructions on http://techgage.com/article/enabling_and_testing_ssd_trim_support_under_linux/2 but I don't see that rm ends up clearing the block on the disc.

It should support TRIM according to this:

root@robert:~# hdparm -I /dev/sda
/dev/sda:
ATA device, with non-removable media
    Model Number:       TOSHIBA THNSNB128GMCJ                   
    Serial Number:      222S113JTTEZ
    Firmware Revision:  AJTA0202
    Transport:          Serial, ATA8-AST, SATA 1.0a, SATA II Extensions, SATA Rev 2.5, SATA Rev 2.6
Standards:
    Supported: 8 7 6 5 
    Likely used: 8
Configuration:
    Logical     max current
    cylinders   16383   16383
    heads       16  16
    sectors/track   63  63
    --
    CHS current addressable sectors:   16514064
    LBA    user addressable sectors:  250069680
    LBA48  user addressable sectors:  250069680
    Logical  Sector size:                   512 bytes
    Physical Sector size:                   512 bytes
    Logical Sector-0 offset:                  0 bytes
    device size with M = 1024*1024:      122104 MBytes
    device size with M = 1000*1000:      128035 MBytes (128 GB)
    cache/buffer size  = unknown
    Form Factor: less than 1.8 inch
    Nominal Media Rotation Rate: Solid State Device
Capabilities:
    LBA, IORDY(can be disabled)
    Standby timer values: spec'd by Standard, no device specific minimum
    R/W multiple sector transfer: Max = 16  Current = 16
    Advanced power management level: 128
    DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 *udma5 
         Cycle time: min=120ns recommended=120ns
    PIO: pio0 pio1 pio2 pio3 pio4 
         Cycle time: no flow control=120ns  IORDY flow control=120ns
Commands/features:
    Enabled Supported:
       *    SMART feature set
            Security Mode feature set
       *    Power Management feature set
       *    Write cache
       *    Look-ahead
       *    Host Protected Area feature set
       *    WRITE_BUFFER command
       *    READ_BUFFER command
       *    DOWNLOAD_MICROCODE
       *    Advanced Power Management feature set
            SET_MAX security extension
       *    48-bit Address feature set
       *    Device Configuration Overlay feature set
       *    Mandatory FLUSH_CACHE
       *    FLUSH_CACHE_EXT
       *    SMART error logging
       *    SMART self-test
       *    General Purpose Logging feature set
       *    WRITE_{DMA|MULTIPLE}_FUA_EXT
       *    IDLE_IMMEDIATE with UNLOAD
       *    Disable Data Transfer After Error Detection
       *    WRITE_UNCORRECTABLE_EXT command
       *    Segmented DOWNLOAD_MICROCODE
       *    Gen1 signaling speed (1.5Gb/s)
       *    Gen2 signaling speed (3.0Gb/s)
       *    Host-initiated interface power management
       *    Phy event counters
            Device-initiated interface power management
       *    Software settings preservation
       *    Data Set Management TRIM supported (limit unknown)
Security: 
    Master password revision code = 65534
        supported
    not enabled
    not locked
        frozen
    not expired: security count
        supported: enhanced erase
    2min for SECURITY ERASE UNIT. 2min for ENHANCED SECURITY ERASE UNIT.
Checksum: correct
root@robert:~#

I have done some testing directly with hdparm -trim-sector-ranges:

root@robert:~# hdparm --read-sector 237690883 /dev/sda | head -8
/dev/sda:
reading sector 237690883: succeeded
93f5 3e19 b579 c83d 7506 2608 da47 18a9
1429 6831 8dda 85de ad4d 5a7b 114c 4b62
a619 552a b829 a88e 8001 0134 4733 d3e9
a805 98c5 4e3a 0d65 197a cc61 2f93 dab6
cdaf 33bc ba85 02a3 5f35 1ee4 565b 038a
root@robert:~# hdparm --trim-sector-ranges 237690883:1 /dev/sda
/dev/sda:
trimming 1 sectors from 1 ranges
succeeded
root@robert:~# hdparm --read-sector 237690883 /dev/sda | head -8
/dev/sda:
reading sector 237690883: succeeded
93f5 3e19 b579 c83d 7506 2608 da47 18a9
1429 6831 8dda 85de ad4d 5a7b 114c 4b62
a619 552a b829 a88e 8001 0134 4733 d3e9
a805 98c5 4e3a 0d65 197a cc61 2f93 dab6
cdaf 33bc ba85 02a3 5f35 1ee4 565b 038a
root@robert:~#

Shouldn't the second read show a cleared block with only zeros?

Is the disc lying when it tells me that it supports TRIM or is my way to detect it flawed?

Regards,
Kim Hansen