Check out my first novel, midnight's simulacra!

SATA: Difference between revisions

From dankwiki
No edit summary
Line 4: Line 4:
==SSDs==
==SSDs==
* Under ext4, the <tt>discard</tt> mount option must be provided to issue the TRIM command.
* Under ext4, the <tt>discard</tt> mount option must be provided to issue the TRIM command.
* TRIM support can be verified using <tt>hdparm -I</tt> (look under "Commands/Features")
** Btrfs doesn't require any option, supposedly. I don't yet use btrfs.
** Btrfs doesn't require any option, supposedly. I don't yet use btrfs.
* GPT is recommended over MBR
* GPT is recommended over MBR
* The <tt>noop</tt> I/O scheduler is supposedly superior to CFQ for some SSD's
* The <tt>noop</tt> I/O scheduler is supposedly superior to CFQ for some SSD's
** <tt>echo noop | sudo tee /sys/block/sdX/queue/scheduler</tt>, but I find this highly dubious
** <tt>echo noop | sudo tee /sys/block/sdX/queue/scheduler</tt>, but I find this highly dubious
* Performance can drop after extensive use
** Use the security settings to reset the drive: see [http://forums.extremeoverclocking.com/showthread.php?t=333059 this link] at ExtremeOverclockers


==Power Management==
==Power Management==

Revision as of 09:43, 13 March 2012

Serial ATA is specified by the SATA International Organization; the most current revision as of 2009-12-31 is June 2009's SATA 3.0. Intel specifies the Advanced Host Controller Interface; as of 2009-12-31, the most recent revision is 1.3 (File:AHCIrev1_3.pdf).

SAS

An SFF-8087 connector can fan out to support up to 4 SATA devices.

SSDs

  • Under ext4, the discard mount option must be provided to issue the TRIM command.
  • TRIM support can be verified using hdparm -I (look under "Commands/Features")
    • Btrfs doesn't require any option, supposedly. I don't yet use btrfs.
  • GPT is recommended over MBR
  • The noop I/O scheduler is supposedly superior to CFQ for some SSD's
    • echo noop | sudo tee /sys/block/sdX/queue/scheduler, but I find this highly dubious
  • Performance can drop after extensive use
    • Use the security settings to reset the drive: see this link at ExtremeOverclockers

Power Management

SATA's Aggressive Link Power Management ALPM, specified in SATA 1.x (in conjunction with AHCI-compliant controllers), effects power savings at the serial link (this is independent of disk power management). There's both a "Partial" and "Suspend" mode; Suspend takes longer to enter/exit, and saves more power, than Partial.

hddtemp

hddtemp seems to handle SATA devices just fine:

[recombinator](0) $ sudo hddtemp /dev/sd?
/dev/sda: WDC WD10EACS-00ZJB0: 34°C
/dev/sdb: : S.M.A.R.T. not available
/dev/sdc: ST31000340AS: 41°C
/dev/sdd: WDC WD10EACS-00ZJB0: 40°C
/dev/sde: WDC WD10EACS-00ZJB0: 40°C
/dev/sdf: ST3500630AS: 37°C
/dev/sdg: ST3500630AS: 39°C
/dev/sdh: ST3750640AS: 42°C
[recombinator](0) $ 

lsscsi

lsscsi seems to handle SATA devices just fine:

[recombinator](0) $ lsscsi -l
[0:0:0:0]    disk    ATA      WDC WD10EACS-00Z 01.0  /dev/sda
  state=running queue_depth=31 scsi_level=6 type=0 device_blocked=0 timeout=30
[1:0:0:0]    disk    ATA      WDC WD10EACS-00Z 01.0  /dev/sdb
  state=running queue_depth=31 scsi_level=6 type=0 device_blocked=0 timeout=30
[2:0:0:0]    disk    ATA      ST31000340AS     SD15  /dev/sdc
  state=running queue_depth=31 scsi_level=6 type=0 device_blocked=0 timeout=30
[3:0:0:0]    disk    ATA      WDC WD10EACS-00Z 01.0  /dev/sdd
  state=running queue_depth=31 scsi_level=6 type=0 device_blocked=0 timeout=30
[4:0:0:0]    disk    ATA      WDC WD10EACS-00Z 01.0  /dev/sde
  state=running queue_depth=31 scsi_level=6 type=0 device_blocked=0 timeout=30
[6:0:0:0]    disk    ATA      ST3500630AS      3.AA  /dev/sdf
  state=running queue_depth=1 scsi_level=6 type=0 device_blocked=0 timeout=30
[7:0:0:0]    disk    ATA      ST3500630AS      3.AA  /dev/sdg
  state=running queue_depth=1 scsi_level=6 type=0 device_blocked=0 timeout=30
[8:0:0:0]    disk    ATA      ST3750640AS      3.AA  /dev/sdh
  state=running queue_depth=1 scsi_level=6 type=0 device_blocked=0 timeout=30
[9:0:0:0]    cd/dvd  TSSTcorp CD/DVDW SH-S183L SB01  /dev/scd0
  state=running queue_depth=1 scsi_level=6 type=5 device_blocked=0 timeout=0
[recombinator](0) $ lsscsi -H -v
[0]    ahci          
  dir: /sys/class/scsi_host/host0
  device dir: /sys/devices/pci0000:00/0000:00:1f.2/host0
[1]    ahci          
  dir: /sys/class/scsi_host/host1
  device dir: /sys/devices/pci0000:00/0000:00:1f.2/host1
[2]    ahci          
  dir: /sys/class/scsi_host/host2
  device dir: /sys/devices/pci0000:00/0000:00:1f.2/host2
[3]    ahci          
  dir: /sys/class/scsi_host/host3
  device dir: /sys/devices/pci0000:00/0000:00:1f.2/host3
[4]    ahci          
  dir: /sys/class/scsi_host/host4
  device dir: /sys/devices/pci0000:00/0000:00:1f.2/host4
[5]    ahci          
  dir: /sys/class/scsi_host/host5
  device dir: /sys/devices/pci0000:00/0000:00:1f.2/host5
[6]    sata_promise  
  dir: /sys/class/scsi_host/host6
  device dir: /sys/devices/pci0000:00/0000:00:1e.0/0000:06:02.0/host6
[7]    sata_promise  
  dir: /sys/class/scsi_host/host7
  device dir: /sys/devices/pci0000:00/0000:00:1e.0/0000:06:02.0/host7
[8]    sata_promise  
  dir: /sys/class/scsi_host/host8
  device dir: /sys/devices/pci0000:00/0000:00:1e.0/0000:06:02.0/host8
[9]    sata_promise  
  dir: /sys/class/scsi_host/host9
  device dir: /sys/devices/pci0000:00/0000:00:1e.0/0000:06:02.0/host9
[10]    pata_marvell  
  dir: /sys/class/scsi_host/host10
  device dir: /sys/devices/pci0000:00/0000:00:1c.1/0000:02:00.0/host10
[11]    pata_marvell  
  dir: /sys/class/scsi_host/host11
  device dir: /sys/devices/pci0000:00/0000:00:1c.1/0000:02:00.0/host11
[recombinator](0) $ lsscsi  -v
[0:0:0:0]    disk    ATA      WDC WD10EACS-00Z 01.0  /dev/sda
  dir: /sys/bus/scsi/devices/0:0:0:0  [/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0]
[1:0:0:0]    disk    ATA      WDC WD10EACS-00Z 01.0  /dev/sdb
  dir: /sys/bus/scsi/devices/1:0:0:0  [/sys/devices/pci0000:00/0000:00:1f.2/host1/target1:0:0/1:0:0:0]
[2:0:0:0]    disk    ATA      ST31000340AS     SD15  /dev/sdc
  dir: /sys/bus/scsi/devices/2:0:0:0  [/sys/devices/pci0000:00/0000:00:1f.2/host2/target2:0:0/2:0:0:0]
[3:0:0:0]    disk    ATA      WDC WD10EACS-00Z 01.0  /dev/sdd
  dir: /sys/bus/scsi/devices/3:0:0:0  [/sys/devices/pci0000:00/0000:00:1f.2/host3/target3:0:0/3:0:0:0]
[4:0:0:0]    disk    ATA      WDC WD10EACS-00Z 01.0  /dev/sde
  dir: /sys/bus/scsi/devices/4:0:0:0  [/sys/devices/pci0000:00/0000:00:1f.2/host4/target4:0:0/4:0:0:0]
[6:0:0:0]    disk    ATA      ST3500630AS      3.AA  /dev/sdf
  dir: /sys/bus/scsi/devices/6:0:0:0  [/sys/devices/pci0000:00/0000:00:1e.0/0000:06:02.0/host6/target6:0:0/6:0:0:0]
[7:0:0:0]    disk    ATA      ST3500630AS      3.AA  /dev/sdg
  dir: /sys/bus/scsi/devices/7:0:0:0  [/sys/devices/pci0000:00/0000:00:1e.0/0000:06:02.0/host7/target7:0:0/7:0:0:0]
[8:0:0:0]    disk    ATA      ST3750640AS      3.AA  /dev/sdh
  dir: /sys/bus/scsi/devices/8:0:0:0  [/sys/devices/pci0000:00/0000:00:1e.0/0000:06:02.0/host8/target8:0:0/8:0:0:0]
[9:0:0:0]    cd/dvd  TSSTcorp CD/DVDW SH-S183L SB01  /dev/scd0
  dir: /sys/bus/scsi/devices/9:0:0:0  [/sys/devices/pci0000:00/0000:00:1e.0/0000:06:02.0/host9/target9:0:0/9:0:0:0]
[recombinator](0) $ 

SMART

There's more general info on the SMART page. Generally, '-d ata' is a sufficient descriptor of a device for smartd to handle it. Determine SMART capability with smartctl -i:

[recombinator](0) $ sudo smartctl -i /dev/sdc
smartctl version 5.38 [x86_64-unknown-linux-gnu] Copyright (C) 2002-8 Bruce Allen
Home page is http://smartmontools.sourceforge.net/

=== START OF INFORMATION SECTION ===
Model Family:     Seagate Barracuda 7200.11
Device Model:     ST31000340AS
Serial Number:    9QJ0YTFN
Firmware Version: SD15
User Capacity:    1,000,204,886,016 bytes
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   8
ATA Standard is:  ATA-8-ACS revision 4
Local Time is:    Tue Sep 30 05:29:37 2008 EDT
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

[recombinator](0) $ sudo smartctl -i /dev/sda
smartctl version 5.38 [x86_64-unknown-linux-gnu] Copyright (C) 2002-8 Bruce Allen
Home page is http://smartmontools.sourceforge.net/

=== START OF INFORMATION SECTION ===
Device Model:     WDC WD10EACS-00ZJB0
Serial Number:    WD-WCASJ0911338
Firmware Version: 01.01B01
User Capacity:    1,000,204,886,016 bytes
Device is:        Not in smartctl database [for details use: -P showall]
ATA Version is:   8
ATA Standard is:  Exact ATA specification draft version not indicated
Local Time is:    Tue Sep 30 05:29:39 2008 EDT
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

[recombinator](0) $

Determine if the specific hard drive model is known via -P show (this is not necessary for SMART to be used):

[recombinator](0) $ sudo smartctl -a /dev/sdc -P show
smartctl version 5.38 [x86_64-unknown-linux-gnu] Copyright (C) 2002-8 Bruce Allen
Home page is http://smartmontools.sourceforge.net/

Drive found in smartmontools Database.  Drive identity strings:
MODEL:              ST31000340AS
FIRMWARE:           SD15
match smartmontools Drive Database entry:
MODEL REGEXP:       ^ST3(500[368]2|750[36]3|1000[36]4)0AS?$
FIRMWARE REGEXP:    .*
MODEL FAMILY:       Seagate Barracuda 7200.11
ATTRIBUTE OPTIONS:  None preset; no -v options are required.
[recombinator](0) $ 

To check SMART statistics for a drive, try smartctl -a:

[recombinator](2) $ sudo smartctl -a /dev/sdc
smartctl version 5.38 [x86_64-unknown-linux-gnu] Copyright (C) 2002-8 Bruce Allen
Home page is http://smartmontools.sourceforge.net/

=== START OF INFORMATION SECTION ===
Model Family:     Seagate Barracuda 7200.11
Device Model:     ST31000340AS
Serial Number:    9QJ0YTFN
Firmware Version: SD15
User Capacity:    1,000,204,886,016 bytes
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   8
ATA Standard is:  ATA-8-ACS revision 4
Local Time is:    Tue Sep 30 05:17:48 2008 EDT
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

General SMART Values:
Offline data collection status:  (0x82)	Offline data collection activity
					was completed without error.
					Auto Offline Data Collection: Enabled.
Self-test execution status:      (   0)	The previous self-test routine completed
					without error or no self-test has ever 
					been run.
Total time to complete Offline 
data collection: 		 ( 642) seconds.
Offline data collection
capabilities: 			 (0x7b) SMART execute Offline immediate.
					Auto Offline data collection on/off support.
					Suspend Offline collection upon new
					command.
					Offline surface scan supported.
					Self-test supported.
					Conveyance Self-test supported.
					Selective Self-test supported.
SMART capabilities:            (0x0003)	Saves SMART data before entering
					power-saving mode.
					Supports SMART auto save timer.
Error logging capability:        (0x01)	Error logging supported.
					General Purpose Logging supported.
Short self-test routine 
recommended polling time: 	 (   1) minutes.
Extended self-test routine
recommended polling time: 	 ( 232) minutes.
Conveyance self-test routine
recommended polling time: 	 (   2) minutes.
SCT capabilities: 	       (0x103b)	SCT Status supported.
					SCT Feature Control supported.
					SCT Data Table supported.

SMART Attributes Data Structure revision number: 10
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate     0x000f   112   099   006    Pre-fail  Always       -       45299905
  3 Spin_Up_Time            0x0003   091   091   000    Pre-fail  Always       -       0
  4 Start_Stop_Count        0x0032   100   100   020    Old_age   Always       -       42
  5 Reallocated_Sector_Ct   0x0033   100   100   036    Pre-fail  Always       -       0
  7 Seek_Error_Rate         0x000f   055   054   030    Pre-fail  Always       -       154630173860
  9 Power_On_Hours          0x0032   098   098   000    Old_age   Always       -       2447
 10 Spin_Retry_Count        0x0013   100   100   097    Pre-fail  Always       -       0
 12 Power_Cycle_Count       0x0032   100   100   020    Old_age   Always       -       42
184 Unknown_Attribute       0x0032   100   100   099    Old_age   Always       -       0
187 Reported_Uncorrect      0x0032   100   100   000    Old_age   Always       -       0
188 Unknown_Attribute       0x0032   100   100   000    Old_age   Always       -       0
189 High_Fly_Writes         0x003a   100   100   000    Old_age   Always       -       0
190 Airflow_Temperature_Cel 0x0022   060   052   045    Old_age   Always       -       40 (Lifetime Min/Max 35/46)
194 Temperature_Celsius     0x0022   040   048   000    Old_age   Always       -       40 (0 20 0 0)
195 Hardware_ECC_Recovered  0x001a   018   018   000    Old_age   Always       -       45299905
197 Current_Pending_Sector  0x0012   100   100   000    Old_age   Always       -       0
198 Offline_Uncorrectable   0x0010   100   100   000    Old_age   Offline      -       0
199 UDMA_CRC_Error_Count    0x003e   200   200   000    Old_age   Always       -       0

SMART Error Log Version: 1
No Errors Logged

SMART Self-test log structure revision number 1
Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
# 1  Extended offline    Completed without error       00%      2315         -
# 2  Extended offline    Completed without error       00%      2146         -
# 3  Extended offline    Completed without error       00%      1978         -
# 4  Extended offline    Interrupted (host reset)      70%      1808         -
# 5  Extended offline    Interrupted (host reset)      40%      1641         -
# 6  Extended offline    Interrupted (host reset)      00%      1305         -
# 7  Extended offline    Completed without error       00%      1139         -
# 8  Extended offline    Completed without error       00%       997         -
# 9  Extended offline    Interrupted (host reset)      50%       827         -
#10  Extended offline    Completed without error       00%       661         -
#11  Extended offline    Completed without error       00%       470         -
#12  Extended offline    Completed without error       00%       302         -
#13  Extended offline    Interrupted (host reset)      50%       143         -

SMART Selective self-test log data structure revision number 1
 SPAN  MIN_LBA  MAX_LBA  CURRENT_TEST_STATUS
    1        0        0  Not_testing
    2        0        0  Not_testing
    3        0        0  Not_testing
    4        0        0  Not_testing
    5        0        0  Not_testing
Selective self-test flags (0x0):
  After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.

[recombinator](0) $ 

hdparm

SATA drive information on Linux can be acquired with hdparm -I:

[recombinator](0) $ sudo hdparm -I /dev/sda

/dev/sda:

ATA device, with non-removable media
	Model Number:       WDC WD10EACS-00ZJB0                     
	Serial Number:      WD-WCASJ0911338
	Firmware Revision:  01.01B01
	Transport:          Serial, SATA 1.0a, SATA II Extensions, SATA Rev 2.5
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:  268435455
	LBA48  user addressable sectors: 1953525168
	device size with M = 1024*1024:      953869 MBytes
	device size with M = 1000*1000:     1000204 MBytes (1000 GB)
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 = 0
	Recommended acoustic management value: 128, current value: 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
	    	Power-Up In Standby feature set
	   *	SET_FEATURES required to spinup after power up
	    	SET_MAX security extension
	    	Automatic Acoustic Management feature set
	   *	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
	   *	64-bit World wide name
	   *	{READ,WRITE}_DMA_EXT_GPL commands
	   *	Segmented DOWNLOAD_MICROCODE
	   *	SATA-I signaling speed (1.5Gb/s)
	   *	SATA-II signaling speed (3.0Gb/s)
	   *	Native Command Queueing (NCQ)
	   *	Host-initiated interface power management
	   *	Phy event counters
	    	DMA Setup Auto-Activate optimization
	   *	Software settings preservation
	   *	SMART Command Transport (SCT) feature set
	   *	SCT Long Sector Access (AC1)
	   *	SCT LBA Segment Access (AC2)
	   *	SCT Error Recovery Control (AC3)
	   *	SCT Features Control (AC4)
	   *	SCT Data Tables (AC5)
	    	unknown 206[12] (vendor specific)
	    	unknown 206[13] (vendor specific)
Security: 
	Master password revision code = 65534
		supported
	not	enabled
	not	locked
	not	frozen
	not	expired: security count
		supported: enhanced erase
	284min for SECURITY ERASE UNIT. 284min for ENHANCED SECURITY ERASE UNIT.
Logical Unit WWN Device Identifier: 50014ee256448a45
	NAA		: 5
	IEEE OUI	: 14ee
	Unique ID	: 256448a45
Checksum: correct
[recombinator](0) $

Here's an older one:

[recombinator](0) $ sudo hdparm -I /dev/sdf

/dev/sdf:

ATA device, with non-removable media
	Model Number:       ST3500630AS                             
	Serial Number:      9QG043LY
	Firmware Revision:  3.AAJ   
Standards:
	Supported: 7 6 5 4 
	Likely used: 7
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:  976773168
	device size with M = 1024*1024:      476940 MBytes
	device size with M = 1000*1000:      500107 MBytes (500 GB)
Capabilities:
	LBA, IORDY(can be disabled)
	Queue depth: 32
	Standby timer values: spec'd by Standard, no device specific minimum
	R/W multiple sector transfer: Max = 16	Current = ?
	Recommended acoustic management value: 254, current value: 0
	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
	   *	DOWNLOAD_MICROCODE
	    	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
	   *	SATA-I signaling speed (1.5Gb/s)
	   *	Native Command Queueing (NCQ)
	   *	Phy event counters
	    	Device-initiated interface power management
	   *	Software settings preservation
Security: 
	Master password revision code = 65534
		supported
	not	enabled
	not	locked
	not	frozen
	not	expired: security count
	not	supported: enhanced erase
Checksum: correct
[recombinator](0) $ 

See also