SSDのSMARTによる温度取得

とりあえず,TLで話題になってたので.

一言で言うと,温度表示が0の場合もあれば,フィールド自体が無かったりするので危険.

毎朝,HDDの温度をメールするようなスクリプトを組んでるんだけど,接続の構成が変わった時,SSDにも温度取得を試みるようになって,0℃を返してくれるやつは報告する温度が異常になるだけだけど,フィールドがないやつでエラーになってて,焦ったことがある.

温度のフィールドが存在しないこともある前提でスクリプトを組まないとだめらしい.こういうの規格とかあるのかな?

Crucial C300

$ sudo /usr/local/sbin/smartctl -a /dev/ada1
smartctl 5.40 2010-10-16 r3189 [FreeBSD 9.0-CURRENT amd64] (local build)
Copyright (C) 2002-10 by Bruce Allen, http://smartmontools.sourceforge.net

=== START OF INFORMATION SECTION ===
Device Model:     C300-CTFDDAC128MAG
Serial Number:    00000000103102FC610B
Firmware Version: 0002
User Capacity:    128,035,676,160 bytes
Device is:        Not in smartctl database [for details use: -P showall]
ATA Version is:   8
ATA Standard is:  ATA-8-ACS revision 6
Local Time is:    Wed May  4 18:54:02 2011 JST
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:  (0x00)	Offline data collection activity
					was never started.
					Auto Offline Data Collection: Disabled.
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: 		 ( 595) 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: 	 (   2) minutes.
Extended self-test routine
recommended polling time: 	 (   9) minutes.
Conveyance self-test routine
recommended polling time: 	 (   3) minutes.
SCT capabilities: 	       (0x003d)	SCT Status supported.
					SCT Error Recovery Control supported.
					SCT Feature Control supported.
					SCT Data Table supported.

SMART Attributes Data Structure revision number: 16
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate     0x002f   100   100   000    Pre-fail  Always       -       0
  5 Reallocated_Sector_Ct   0x0033   100   100   000    Pre-fail  Always       -       0
  9 Power_On_Hours          0x0032   100   100   000    Old_age   Always       -       4224
 12 Power_Cycle_Count       0x0032   100   100   000    Old_age   Always       -       13
170 Unknown_Attribute       0x0033   100   100   000    Pre-fail  Always       -       8819
171 Unknown_Attribute       0x0032   100   100   000    Old_age   Always       -       0
172 Unknown_Attribute       0x0032   100   100   000    Old_age   Always       -       0
173 Unknown_Attribute       0x0033   100   100   000    Pre-fail  Always       -       48
174 Unknown_Attribute       0x0032   100   100   000    Old_age   Always       -       0
181 Program_Fail_Cnt_Total  0x0022   100   100   000    Old_age   Always       -       7907034792506
183 Runtime_Bad_Block       0x0032   100   100   000    Old_age   Always       -       0
184 End-to-End_Error        0x0033   100   100   000    Pre-fail  Always       -       0
187 Reported_Uncorrect      0x0032   100   100   000    Old_age   Always       -       0
188 Command_Timeout         0x0032   100   100   000    Old_age   Always       -       0
189 High_Fly_Writes         0x000e   100   100   000    Old_age   Always       -       204
195 Hardware_ECC_Recovered  0x003a   100   100   000    Old_age   Always       -       0
196 Reallocated_Event_Count 0x0032   100   100   000    Old_age   Always       -       0
197 Current_Pending_Sector  0x0032   100   100   000    Old_age   Always       -       0
198 Offline_Uncorrectable   0x0030   100   100   000    Old_age   Offline      -       0
199 UDMA_CRC_Error_Count    0x0032   100   100   000    Old_age   Always       -       0
202 Data_Address_Mark_Errs  0x0018   100   100   000    Old_age   Offline      -       0
206 Flying_Height           0x000e   100   100   000    Old_age   Always       -       0

SMART Error Log Version: 1
No Errors Logged

SMART Self-test log structure revision number 1
No self-tests have been logged.  [To run self-tests, use: smartctl -t]


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.

ADATA SSD 300(悪名高いJM族の廉価版SSD

$ sudo /usr/local/sbin/smartctl -a /dev/ada0
smartctl 5.40 2010-10-16 r3189 [FreeBSD 9.0-CURRENT amd64] (local build)
Copyright (C) 2002-10 by Bruce Allen, http://smartmontools.sourceforge.net

=== START OF INFORMATION SECTION ===
Device Model:     A-DATA SSD 300 Series
Serial Number:    AD_0123456866
Firmware Version: 080826
User Capacity:    32,044,482,560 bytes
Device is:        Not in smartctl database [for details use: -P showall]
ATA Version is:   7
ATA Standard is:  ATA/ATAPI-7 T13 1532D revision 4a
Local Time is:    Wed May  4 18:56:40 2011 JST
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:  (0x00)	Offline data collection activity
					was never started.
					Auto Offline Data Collection: Disabled.
Total time to complete Offline 
data collection: 		 (   0) seconds.
Offline data collection
capabilities: 			 (0x00) 	Offline data collection not supported.
SMART capabilities:            (0x0003)	Saves SMART data before entering
					power-saving mode.
					Supports SMART auto save timer.
Error logging capability:        (0x00)	Error logging NOT supported.
					No General Purpose Logging support.

SMART Attributes Data Structure revision number: 1280
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
 12 Power_Cycle_Count       0x0032   100   100   000    Old_age   Always       -       1474
  9 Power_On_Hours          0x0032   100   100   000    Old_age   Always       -       0
194 Temperature_Celsius     0x0007   032   100   000    Pre-fail  Always       -       0
229 Unknown_Attribute       0x0002   100   000   000    Old_age   Always       -       259986015180268
232 Available_Reservd_Space 0x0002   100   048   000    Old_age   Always       -       9037419786552
233 Media_Wearout_Indicator 0x0002   100   000   000    Old_age   Always       -       0
234 Unknown_Attribute       0x0002   100   000   000    Old_age   Always       -       554201789961
235 Unknown_Attribute       0x0002   100   000   000    Old_age   Always       -       134407199

Warning: device does not support Error Logging
(pass0:ahcich0:0:0:0): SMART. ACB: b0 d5 01 4f c2 40 00 00 00 00 01 00
(pass0:ahcich0:0:0:0): CAM status: ATA Status Error
(pass0:ahcich0:0:0:0): ATA status: 51 (DRDY SERV ERR), error: 04 (ABRT )
(pass0:ahcich0:0:0:0): RES: 51 04 01 4f c2 40 00 00 00 01 00
Error SMART Error Log Read failed
Smartctl: SMART Error Log Read Failed
Warning: device does not support Self Test Logging
(pass0:ahcich0:0:0:0): SMART. ACB: b0 d5 06 4f c2 40 00 00 00 00 01 00
(pass0:ahcich0:0:0:0): CAM status: ATA Status Error
(pass0:ahcich0:0:0:0): ATA status: 51 (DRDY SERV ERR), error: 04 (ABRT )
(pass0:ahcich0:0:0:0): RES: 51 04 06 4f c2 40 00 00 00 01 00
Error SMART Error Self-Test Log Read failed
Smartctl: SMART Self Test Log Read Failed
Device does not support Selective Self Tests/Logging