#author("2023-07-20T11:49:05+09:00","default:kuji","kuji")
#author("2023-07-20T11:58:12+09:00","default:kuji","kuji")
[[Rsync de backup]]
#contents
*smartd[5262]: [#y57fd282]
 Jul 23 15:07:55 G7 smartd[5262]: Device: /dev/ada1, WARNING: There are known problems with these drives,
 Jul 23 15:07:55 G7 smartd[5262]: see the following Seagate web pages:
 Jul 23 15:07:55 G7 smartd[5262]: http://knowledge.seagate.com/articles/en_US/FAQ/207931en
 Jul 23 15:07:55 G7 smartd[5262]: http://knowledge.seagate.com/articles/en_US/FAQ/207963en
 Jul 23 15:07:56 G7 smartd[5262]: Device: /dev/ada3, WARNING: There are known problems with these drives,
 Jul 23 15:07:56 G7 smartd[5262]: THIS DRIVE MAY OR MAY NOT BE AFFECTED,
 Jul 23 15:07:56 G7 smartd[5262]: see the following web pages for details:
 Jul 23 15:07:56 G7 smartd[5262]: http://knowledge.seagate.com/articles/en_US/FAQ/207931en
 Jul 23 15:07:56 G7 smartd[5262]: http://knowledge.seagate.com/articles/en_US/FAQ/207951en
 Jul 23 15:07:56 G7 smartd[5262]: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=632758

*** portinstall sysutils/smartmontools [#z1a915a8]

 Installing smartmontools-7.3_1...
 smartmontools has been installed
 
 To check the status of drives, use the following:
 
        /usr/local/sbin/smartctl -a /dev/ad0    for first ATA/SATA drive
        /usr/local/sbin/smartctl -a /dev/da0    for first SCSI drive
        /usr/local/sbin/smartctl -a /dev/ada0   for first SATA drive
 
 To include drive health information in your daily status reports,
 add a line like the following to /etc/periodic.conf:
        daily_status_smart_devices="/dev/ad0 /dev/da0"
 substituting the appropriate device names for your SMART-capable disks.
 
 To enable drive monitoring, you can use /usr/local/sbin/smartd.
 A sample configuration file has been installed as
 / usr/local/etc/smartd.conf.sample
 Copy this file to /usr/local/etc/smartd.conf and edit appropriately
 
 To have smartd start at boot
         echo 'smartd_enable="YES"' >> /etc/rc.conf
 
 ===>  Cleaning for smartmontools-7.3_1
 
https://www.kkaneko.jp/tools/freebsd/smartmontoolsfreebsd.html
 
http://nhh.mo-blog.jp/ttt/2006/06/smartmontools_0720.html

http://www.kkaneko.com/rinkou/freebsd/smartmontoolsfreebsd.html
***         echo 'smartd_enable="YES"' >> /etc/rc.conf [#va21e2b9]
↑する

**接続されているHDDのデバイスを調べる [#b36ac451]
# camcontrol devlist
 <ST3000DM007-1WY10G 0001>          at scbus0 target 0 lun 0 (ada0,pass0)
 <HL-DT-ST DVDROM DH40N NP02>       at scbus2 target 0 lun 0 (cd0,pass1)

# camcontrol identify ada0
 pass0: <ST3000DM007-1WY10G 0001> ACS-3 ATA SATA 3.x device
 pass0: 300.000MB/s transfers (SATA 2.x, UDMA5, PIO 8192bytes)
 
 protocol              ACS-3 ATA SATA 3.x
 device model          ST3000DM007-1WY10G
 firmware revision     0001
 serial number         ZFN0VVYY
 WWN                   5000c500a5dc6e76
 additional product id
 cylinders             16383
 heads                 16
 sectors/track         63
 sector size           logical 512, physical 4096, offset 0
 LBA supported         268435455 sectors
 LBA48 supported       5860533168 sectors
 PIO supported         PIO4
 DMA supported         WDMA2 UDMA6
 media RPM             5425
 Zoned-Device Commands no
 
 Feature                      Support  Enabled   Value           Vendor
 read ahead                     yes      yes
 write cache                    yes      yes
 flush cache                    yes      yes
 Native Command Queuing (NCQ)   yes              32 tags
 NCQ Priority Information       no
 NCQ Non-Data Command           no
 NCQ Streaming                  no
 Receive & Send FPDMA Queued    no
 NCQ Autosense                  yes
 SMART                          yes      yes
 security                       yes      no
 power management               yes      yes
 microcode download             yes      yes
 advanced power management      no       no
 automatic acoustic management  no       no
 media status notification      no       no
 power-up in Standby            yes      no
 write-read-verify              no       no
 unload                         no       no
 general purpose logging        yes      yes
 free-fall                      no       no
 sense data reporting           yes      no
 extended power conditions      yes      yes
 device statistics notification no       no
 Data Set Management (DSM/TRIM) no
 Trusted Computing              no
 encrypts all user data         no
 Sanitize                       yes              overwrite,
 Sanitize - commands allowed    yes
 Sanitize - antifreeze lock     yes
 Host Protected Area (HPA)      yes      no      5860533168/5860533168
 HPA - Security                 yes      no
 Accessible Max Address Config  no

  # /usr/local/sbin/smartctl -a /dev/ada0
 smartctl 7.3 2022-02-28 r5338 [FreeBSD 13.2-RELEASE amd64] (local build)
 Copyright (C) 2002-22, Bruce Allen, Christian Franke, www.smartmontools.org
 
 === START OF INFORMATION SECTION ===
 Model Family:     Seagate BarraCuda 3.5 (SMR)
 Device Model:     ST3000DM007-1WY10G
 Serial Number:    ZFN0VVYY
 LU WWN Device Id: 5 000c50 0a5dc6e76
 Firmware Version: 0001
 User Capacity:    3,000,592,982,016 bytes [3.00 TB]
 Sector Sizes:     512 bytes logical, 4096 bytes physical
 Rotation Rate:    5425 rpm
 Device is:        In smartctl database 7.3/5319
 ATA Version is:   ACS-3 T13/2161-D revision 5
 SATA Version is:  SATA 3.1, 6.0 Gb/s (current: 3.0 Gb/s)
 Local Time is:    Thu Jul 20 08:50:38 2023 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:  (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:                (    0) 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:        ( 366) minutes.
 Conveyance self-test routine
 recommended polling time:        (   2) minutes.
 SCT capabilities:              (0x30a5) SCT Status 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
この↓先頭行の数値は0で有ることが望まれていてこの状態だと早晩クラッシュするであろうw~
https://www.kishiro.com/FreeBSD/hdd_malfunction_forcast.html
   1 Raw_Read_Error_Rate     0x000f   075   064   006    Pre-fail  Always       -       31965756

   3 Spin_Up_Time            0x0003   096   096   000    Pre-fail  Always       -       0
   4 Start_Stop_Count        0x0032   100   100   020    Old_age   Always       -       86
   5 Reallocated_Sector_Ct   0x0033   100   100   010    Pre-fail  Always       -       0
   7 Seek_Error_Rate         0x000f   091   060   045    Pre-fail  Always       -       1286183340
   9 Power_On_Hours          0x0032   054   054   000    Old_age   Always       -       40902h+59m+19.091s
  10 Spin_Retry_Count        0x0013   100   100   097    Pre-fail  Always       -       0
  12 Power_Cycle_Count       0x0032   100   100   020    Old_age   Always       -       85
 183 Runtime_Bad_Block       0x0032   100   100   000    Old_age   Always       -       0
 184 End-to-End_Error        0x0032   100   100   099    Old_age   Always       -       0
 187 Reported_Uncorrect      0x0032   100   100   000    Old_age   Always       -       0
 188 Command_Timeout         0x0032   100   100   000    Old_age   Always       -       0 0 0
 189 High_Fly_Writes         0x003a   100   100   000    Old_age   Always       -       0
 190 Airflow_Temperature_Cel 0x0022   066   058   040    Old_age   Always       -       34 (Min/Max 32/36)
 191 G-Sense_Error_Rate      0x0032   100   100   000    Old_age   Always       -       0
 192 Power-Off_Retract_Count 0x0032   100   100   000    Old_age   Always       -       1367
 193 Load_Cycle_Count        0x0032   097   097   000    Old_age   Always       -       6215
 194 Temperature_Celsius     0x0022   034   042   000    Old_age   Always       -       34 (0 23 0 0 0)
 195 Hardware_ECC_Recovered  0x001a   075   064   000    Old_age   Always       -       31965756
 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
 240 Head_Flying_Hours       0x0000   100   253   000    Old_age   Offline      -       33569h+47m+50.153s
 241 Total_LBAs_Written      0x0000   100   253   000    Old_age   Offline      -       24679577279
 242 Total_LBAs_Read         0x0000   100   253   000    Old_age   Offline      -       343846914545
 
 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  Short offline       Completed without error       00%     40849         -
 # 2  Short offline       Completed without error       00%     40825         -
 # 3  Short offline       Completed without error       00%     40801         -
 # 4  Extended offline    Completed without error       00%     40787         -
 # 5  Short offline       Completed without error       00%     40777         -
 # 6  Short offline       Completed without error       00%     40753         -
 # 7  Short offline       Completed without error       00%     40729         -
 # 8  Short offline       Completed without error       00%     40705         -
 # 9  Short offline       Completed without error       00%     40681         -
 #10  Short offline       Completed without error       00%     40657         -
 #11  Short offline       Completed without error       00%     40633         -
 #12  Extended offline    Completed without error       00%     40620         -
 #13  Short offline       Completed without error       00%     40609         -
 #14  Short offline       Completed without error       00%     40585         -
 #15  Short offline       Completed without error       00%     40561         -
 #16  Short offline       Completed without error       00%     40537         -
 #17  Short offline       Completed without error       00%     40513         -
 #18  Short offline       Completed without error       00%     40489         -
 #19  Short offline       Completed without error       00%     40465         -
 #20  Extended offline    Completed without error       00%     40451         -
 #21  Short offline       Completed without error       00%     40441         -
 
 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.


***(オプション)/etc/periodic.conf の設定 [#o0685287]
smartctl コマンドで表示される状況レポートに, 日毎レポート (dairy status reports) を含めたいときは, /etc/periodic.conf に次のような1行を含めておく. 「/dev/ad0 /dev/ada0」の部分は監視したいドライブ名に設定すること.

/etc/periodic.conf
 daily_status_smart_devices="/dev/ad0 /dev/ada0"
G7だと
 daily_status_smart_devices="/dev/ada0 /dev/ada1 /dev/ada2 /dev/ada3"


ドライブの監視 (monitoring) を行いたいときは,設定ファイル /usr/local/etc/smartd.conf を作成すること. 

※ サンプルが /usr/local/etc/smartd.conf.sample にある


** smartmontoolsの設定 [#h7e8a3e6]
http://nhh.mo-blog.jp/ttt/2006/06/smartmontools_0720.html
/usr/local/etc/smartd.conf.sample という設定ファイルがあるので、smartd.confというファイル名でコピーして、中身を書き換えます。

 # cd /usr/local/etc/
 # cp smartd.conf.sample smartd.conf
 # ls -l smartd.conf
 -r--r--r--  1 root  wheel  4890 Jun 12 22:59 smartd.conf
 # chmod +w smartd.conf
 # vi smartd.conf
 
 # cp /usr/local/etc/smartd.conf.sample /usr/local/etc/smartd.conf

smartd.confに、ぎっしりと、いろんな情報が書いてあるので、それを読めば、だいたい、どう設定すればいいのかわかります。また、「man smartd.conf」でマニュアルも見られます。

smartd.confで設定すべきポイントは、2つくらいかな。

*** 「DEVICESCAN」という行をコメントアウトする [#jadba409]

DEVICESCANという行以降に書いてある内容は、無視されるそうです。

 # The word DEVICESCAN will cause any remaining lines in this
 # configuration file to be ignored:

*** ディスクドライブごとにチェック項目を書いていく [#v0e418a1]

実はよくわかってないのですが(無責任ですみません)、smartd.confの中にサンプルがたくさん書かれているので、それをまねして、以下のように書きました。

guard の場合は
 /dev/ad4 -a -o on -S on -s (S/../.././03|L/../../6/07) -H -m root
 guard# /usr/local/etc/rc.d/smartd start
G7だと、
 /dev/ada0 -a -o on -S on -s (S/../.././03|L/../../6/07) -H -m root
 /dev/ada1 -a -o on -S on -s (S/../.././04|L/../../6/08) -H -m root
 /dev/ada2 -a -o on -S on -s (S/../.././05|L/../../6/09) -H -m root
 /dev/ada3 -a -o on -S on -s (S/../.././06|L/../../6/10) -H -m root

&ref(IMG_20120626_144826.jpg{, [zoom], [50%]});
&ref(IMG_20120626_144826.jpg,{[zoom], [50%]});
&ref(http://piano2nd.smb.net/~kuji/pukiwiki-1.4.7/index.php?plugin=attach&pcmd=open&file=IMG_20120626_144826.jpg&refer=HDD%E7%AE%A1%E7%90%86%20sysutils%2Fsmartmontools);



SATAのハードディスクが4台つながっていて、ada0~ada3として認識されてるので、4行書いているのですが、1台だけなら/dev/ada0の行だけで十分。

「-s」で、自己診断テスト(self-test)を定期的に行うように指定する。short testとか、longテストとか、いろいろあるらしい。
「-m root」で、エラーが発生したら、rootあてにメールを送る。
というような意味らしいです。
*** smartctlコマンドで、ドライブの情報を読み出す [#jce36a73]

# smartctl -a /dev/ada6

*areca raid board [#v198872f]

 # smartctl -a /dev/ada0
 smartctl 6.4 2015-06-04 r4109 [FreeBSD 9.3-RELEASE-p24 amd64] (local build)
 Copyright (C) 2002-15, Bruce Allen, Christian Franke, www.smartmontools.org
 
 === START OF INFORMATION SECTION ===
 Vendor:               Areca
 Product:              ARC-1210-VOL#00
 Revision:             R001
 User Capacity:        239,999,647,744 bytes [239 GB]
 Logical block size:   512 bytes
 Rotation Rate:        10000 rpm
 Logical Unit id:      0x0004d927fffff800
 Serial number:        0000000442740780
 Device type:          disk
 Transport protocol:   Fibre channel (FCP-2)
 Local Time is:        Thu Sep  3 17:09:51 2015 JST
 SMART support is:     Available - device has SMART capability.
 SMART support is:     Enabled
 Temperature Warning:  Disabled or Not Supported
 
 === START OF READ SMART DATA SECTION ===
 SMART Health Status: OK
 
 Current Drive Temperature:     30 C
 Drive Trip Temperature:        25 C
 
 Manufactured in week 30 of year 2002
 Specified cycle count over device lifetime:  4278190080
 Accumulated start-stop cycles:  256
 Elements in grown defect list: 0
 
 Error counter log:
            Errors Corrected by           Total   Correction     Gigabytes    Total
                ECC          rereads/    errors   algorithm      processed    uncorrected
            fast | delayed   rewrites  corrected  invocations   [10^9 bytes]  errors
 read:          0        0         0         0          0          0.000           0
 write:         0        0         0         0          0          0.000           0
 
 Non-medium error count:        0
 
 Device does not support Self Test logging


https://www.freebsd.org/cgi/man.cgi?query=smartctl&sektion=8&manpath=FreeBSD+Ports+9.2-RELEASE

 areca,N  -  [FreeBSD, Linux, Windows and Cygwin only] the	device
	      consists of one or more SATA disks connected to  an  Areca  SATA
	      RAID controller.	The positive integer N (in the range from 1 to
	      24 inclusive) denotes which disk on the controller is monitored.
	      On FreeBSD use syntax such as:
	      smartctl -a -d areca,2 /dev/arcmsr1
	      smartctl -a -d areca,3 /dev/arcmsr2
	      The  first  line	above  addresses  the second disk on the first
	      Areca RAID controller.  The second line addresses	the third disk
	      on the second Areca RAID controller.
 
	      Important:  the Areca controller must have firmware version 1.46
	      or later.	 Lower-numbered	firmware versions will give (harmless)
	      SCSI error messages and no SMART information.
 
	      areca,N/E	 -  [FreeBSD,  Linux,  Windows	and  Cygwin only] [NEW
	      EXPERIMENTAL SMARTCTL FEATURE] the device	 consists  of  one  or
	      more  SATA  or  SAS  disks  connected  to	an Areca SAS RAID con-
	      troller.	The integer N (range 1 to  128)	 denotes  the  channel
	      (slot)  and  E (range 1 to 8) denotes the	enclosure.  Important:
	      This requires Areca SAS  controller  firmware  version  1.51  or
	      later.

 # smartctl -a -d areca,1 /dev/ada0
 smartctl 6.4 2015-06-04 r4109 [FreeBSD 9.3-RELEASE-p24 amd64] (local build)
 Copyright (C) 2002-15, Bruce Allen, Christian Franke, www.smartmontools.org
 
 do_scsi_cmnd_io with write buffer failed code = ffffffff
 do_scsi_cmnd_io with write buffer failed code = ffffffff
 do_scsi_cmnd_io with write buffer failed code = ffffffff
 do_scsi_cmnd_io with write buffer failed code = ffffffff
 do_scsi_cmnd_io with write buffer failed code = ffffffff
 do_scsi_cmnd_io with write buffer failed code = ffffffff
 do_scsi_cmnd_io with write buffer failed code = ffffffff
 do_scsi_cmnd_io with write buffer failed code = ffffffff
 do_scsi_cmnd_io with write buffer failed code = ffffffff
 Read Device Identity failed: Input/output error
 
 A mandatory SMART command failed: exiting. To continue, add one or more '-T permissive' options.


https://www.smartmontools.org/wiki/Supported_RAID-Controllers

 # smartctl -a -d areca,1 /dev/arcmsr1
 smartctl 6.4 2015-06-04 r4109 [FreeBSD 9.3-RELEASE-p24 amd64] (local build)
 Copyright (C) 2002-15, Bruce Allen, Christian Franke, www.smartmontools.org
 
 do_scsi_cmnd_io with write buffer failed code = ffffffff
 do_scsi_cmnd_io with write buffer failed code = ffffffff
 do_scsi_cmnd_io with write buffer failed code = ffffffff
 Smartctl open device: /dev/arcmsr1 [areca_disk#01_enc#01] failed: Input/output error

トップ   編集 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS