K
K
Kasheftin2014-04-09 23:42:19
Solid State Drives
Kasheftin, 2014-04-09 23:42:19

Can't enable trim on ssd?

Can't enable trim on ssd.
Ubuntu Server 12.04, Linux 3.11.0-15-generic.
Trim is enabled via discard in /etc/fstab. However, it doesn't work through fstrim either.
I check like this:

# for i in {1..100000}; do echo "1" >> tempfile; done
#sudo hdparm --fibmap tempfile
#sudo hdparm --read-sector 293865512 /dev/sda
#rm tempfile
#sync

After that, the command #sudo hdparm --read-sector 293865512 /dev/sda gives everything like the first time.
Result of #sudo fstrim -v /:
/: 0 bytes were trimmed
Output of sudo hdparm -i /dev/sda

Model=KINGSTON SV300S37A240G, FwRev=520ABBF0, SerialNo=50026B7243004D3E
Config={ HardSect NotMFM HdSw>15uSec Fixed DTR>10Mbs RotSpdTol>.5% }
RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=4
BuffType=unknown, BuffSize=unknown, MaxMultSect=16, MultSect=1
CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=468862128
IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}
PIO modes:  pio0 pio1 pio2 pio3 pio4 
DMA modes:  mdma0 mdma1 mdma2 
UDMA modes: udma0 udma1 udma2 udma3 udma4 udma5 *udma6 
AdvancedPM=yes: unknown setting WriteCache=disabled
Drive conforms to: unknown:  ATA/ATAPI-2,3,4,5,6,7


Output of sudo hdparm -I /dev/sda

/dev/sda:

ATA device, with non-removable media
  Model Number:       KINGSTON SV300S37A240G                  
  Serial Number:      50026B7243004D3E    
  Firmware Revision:  520ABBF0
  Transport:          Serial, ATA8-AST, SATA 1.0a, SATA II Extensions, SATA Rev 2.5, SATA Rev 2.6, SATA Rev 3.0
Standards:
  Used: unknown (minor revision code 0x0110) 
  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:  268435455
  LBA48  user addressable sectors:  468862128
  Logical  Sector size:                   512 bytes
  Physical Sector size:                   512 bytes
  Logical Sector-0 offset:                  0 bytes
  device size with M = 1024*1024:      228936 MBytes
  device size with M = 1000*1000:      240057 MBytes (240 GB)
  cache/buffer size  = unknown
  Nominal Media Rotation Rate: Solid State Device
Capabilities:
  LBA, IORDY(can be disabled)
  Queue depth: 32
  Standby timer values: spec'd by Standard, with device specific minimum
  R/W multiple sector transfer: Max = 16	Current = 1
  Advanced power management level: 254
  DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 udma5 *udma6 
       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
     *	NOP cmd
     *	DOWNLOAD_MICROCODE
     *	Advanced Power Management feature set
      	Power-Up In Standby feature set
     *	SET_FEATURES required to spinup after power up
      	SET_MAX security extension
     *	48-bit Address feature set
     *	Mandatory FLUSH_CACHE
     *	FLUSH_CACHE_EXT
     *	SMART error logging
     *	SMART self-test
     *	General Purpose Logging feature set
     *	WRITE_{DMA|MULTIPLE}_FUA_EXT
     *	64-bit World wide name
     *	IDLE_IMMEDIATE with UNLOAD
      	Write-Read-Verify feature set
     *	{READ,WRITE}_DMA_EXT_GPL commands
     *	Segmented DOWNLOAD_MICROCODE
      	unknown 119[6]
     *	Gen1 signaling speed (1.5Gb/s)
     *	Gen2 signaling speed (3.0Gb/s)
     *	Gen3 signaling speed (6.0Gb/s)
     *	Native Command Queueing (NCQ)
     *	Phy event counters
     *	NCQ priority information
     *	unknown 76[15]
     *	DMA Setup Auto-Activate optimization
      	Device-initiated interface power management
     *	Software settings preservation
     *	SMART Command Transport (SCT) feature set
     *	SCT LBA Segment Access (AC2)
     *	SCT Data Tables (AC5)
     *	reserved 69[3]
     *	DOWNLOAD MICROCODE DMA command
     *	SET MAX SETPASSWORD/UNLOCK DMA commands
     *	WRITE BUFFER DMA command
     *	READ BUFFER DMA command
     *	Data Set Management TRIM supported (limit 1 block)
Security: 
  Master password revision code = 65534
    supported
  not	enabled
  not	locked
  not	frozen
  not	expired: security count
    supported: enhanced erase
  4min for SECURITY ERASE UNIT. 2min for ENHANCED SECURITY ERASE UNIT.
Logical Unit WWN Device Identifier: 50026b7243004d3e
  NAA		: 5
  IEEE OUI	: 0026b7
  Unique ID	: 243004d3e
Checksum: correct


dmesg output | grep discard

[    6.417350] EXT4-fs (sda1): re-mounted. Opts: discard,errors=remount-ro
[    6.471628] EXT4-fs (sdb1): mounted filesystem with ordered data mode. Opts: discard


Output from cat /etc/mtab |grep discard

/dev/sda1 / ext4 rw,noatime,nodiratime,discard,errors=remount-ro 0 0
/dev/sdb1 /home/backup ext4 rw,noatime,nodiratime,discard 0 0


On two other machines with the same system but different ssds, trim works via discard in /etc/fstab.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question