時間:2015/6/28來源:IT貓撲網(wǎng)作者:網(wǎng)管聯(lián)盟我要評論(0)
Linux檢測硬盤壞道
bAdBlocks
功能說明:檢查磁盤裝置中損壞的區(qū)塊。
語法:badblocks [-svw][-b ][-o ][磁盤裝置][磁盤區(qū)塊數(shù)][啟始區(qū)塊]
補充說明:執(zhí)行指令時須指定所要檢查的磁盤裝置,及此裝置的磁盤區(qū)塊數(shù)。
參數(shù):
-b 指定磁盤的區(qū)塊大小,單位為字節(jié)。
-o 將檢查的結(jié)果寫入指定的輸出文件。
-s 在檢查時顯示進度。
-v 執(zhí)行時顯示詳細的信息。
-w 在檢查時,執(zhí)行寫入測試。
[磁盤裝置] 指定要檢查的磁盤裝置。
[磁盤區(qū)塊數(shù)] 指定磁盤裝置的區(qū)塊總數(shù)。
[啟始區(qū)塊] 指定要從哪個區(qū)塊開始檢查。
badblocks 檢測磁盤壞塊
1)$badblocks -s //顯示進度 -v //顯示執(zhí)行詳細情況 /dev/sda1
2)讀寫方式檢測 未掛載的磁盤設(shè)備或分區(qū)
$badblocks -s //顯示進度 -w //以寫去檢測 -v //顯示執(zhí)行詳細情況 /dev/sda2
FreeBsd檢測硬盤壞道
利用硬盤的S.M.A.R.T.功能來做。
cd /usr/ports/sysutils/smartmontools
make install
快速檢查硬盤是否有問題
smartctl -a /dev/ad0
表面測試
smartctl -t long /dev/ad0
好像還有一個badtrk工具
=========================================================================
smartctl詳解:
linuxsir.org/bbs/showthread.php?s=&threadid=81020">https://www.linuxsir.org/bbs/showthread.php?s=&threadid=81020
werix
監(jiān)測你的硬盤 - 提前預(yù)報系統(tǒng)SMART
前言:
大家心理最怕的不是安裝某個系統(tǒng),而是辛辛苦苦安裝之后,忽然有一天硬盤壞了,又沒有備份(DAT,DLT之類磁帶機貴得嚇?biāo)廊?。怎么樣才能知道你的硬盤能否過新年呢?(硬盤狀態(tài)如何?) 特別是如果能夠提前預(yù)報,告訴大家硬盤快頂不住了,那該多好。
解決辦法:
SMART
SMART(SFF-8035i) 是硬盤生產(chǎn)商們建立的一個工業(yè)標(biāo)準(zhǔn),這個標(biāo)準(zhǔn)就是在硬盤上保存一個跟執(zhí)行情況,可靠程度,讀找錯誤率等屬性的表格。所有屬性都有一個1byte(大小范圍1-253)的標(biāo)準(zhǔn)化值,還包含另一個1byte的關(guān)鍵階段值,如果屬性表格內(nèi)某個數(shù)據(jù)接近小于或達到關(guān)鍵階段值,那么你的硬盤就快跟你永別了,至少也是超過它的設(shè)計使用極限了- 該做備份和最壞的打算了。
SFF-8035i工業(yè)標(biāo)準(zhǔn)經(jīng)過ATA-3,ATA-4到了ATA-5,加入了一個錯誤信息文件(errorlog) 和一系列硬盤自測SMART命令。SMART適應(yīng)與IDE和SCSI硬盤。
我用FreeBSD 5.2和Debian做了實驗,都不錯,OpenBSD下面可以直接用atactl,大家看看man atactl,或是下面的帖子。其它linux系統(tǒng)沒問題,可以看文章最后給出的官方網(wǎng)站去查詢一下你的系統(tǒng)。
1。安裝 smartmontools
FreeBSD:
#/usr/ports/sysutils/smartmontools
#make install clean
#cp /usr/local/etc/rc.d/smartd.sh.sample /usr/local/etc/rc.d/smartd.sh
#cp /usr/local/etc/smartd.conf.sample /usr/local/etc/smartd.conf
#chmod 555 /usr/local/etc/rc.d/smartd.sh
Debian:
apt-get install smartmontool*
/etc/smartd.conf
FreeBSD設(shè)置文件/usr/local/etc/smartd.conf
Debian設(shè)置文件 /etc/smartd.conf
注意:
千萬不要忘了改寫設(shè)置文件。。!
FreeBSD下第一張IDE硬盤是ad0,SCSI硬盤是da0
Debian下第一張IDE硬盤是/dev/hda,SCSI硬盤是/dev/sda
下面我用FreeBSD做例子,我的硬盤是IDE,如果你的是SCSI,你就去官方網(wǎng)站啟動監(jiān)護程序:
/usr/local/etc/rc.d/smartd.sh start
首先讓我們看一下你的硬盤是否支持SMART:
bash-2.05b# smartctl -i /dev/ad0
smartctl version 5.26 Copyright (C) 2002-3 Bruce Allen
Home page is https://smartmontools.sourceforge.net/
=== START OF INFORMATION SECTION ===
Device Model: IBM-DJSA-220
Serial Number: 44K443Z0103
Firmware Version: JS4OAC3A
Device is: Not in smartctl database [for details use: -P showall]
ATA Version is: 5
ATA Standard is: ATA/ATAPI-5 T13 1321D revision 1
Local Time is: Mon Dec 22 21:04:38 2003 CET
SMART support is: Available - device has SMART capability.
SMART support is: enable
The SMART RETURN STATUS return value (smartmontools -H option/Directive)
can not be retrieved with this version of ATAng, please do not rely on this value
看看我的盤健康測試,如果你的self-assessment test result是FAILING,那就是說它要完蛋了,馬上備份!。
bash-2.05b# smartctl -Hc /dev/ad0
smartctl version 5.26 Copyright (C) 2002-3 Bruce Allen
Home page is https://smartmontools.sourceforge.net/
The SMART RETURN STATUS return value (smartmontools -H option/Directive)
can not be retrieved with this version of ATAng, please do not rely on
this value
#p#副標(biāo)題#e#
=== 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: ( 650) seconds.
Offline data collection
capabilities: (0x1b) SMART execute Offline immediate.
Auto Offline data collection on/off
support.
Suspend Offline collection upon
new
command.
Offline surface scan supported.
Self-test supported.
No Conveyance Self-test supported.
No 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.
No General Purpose Logging support.
Short self-test routine
recommended polling time: ( 2) minutes.
Extended self-test routine
recommended polling time: ( 29) minutes.
下面表格給出的屬性信息根據(jù)你的硬盤廠商不同而不同,最 重要的是明白每個縱行的意義:如果有一個標(biāo)準(zhǔn)值(VALUE)小于或等於關(guān)鍵值(THRESH)時,WHEN_FAILED 行會給出信息,我的WHEN_FAILED縱行是空行,說明沒事兒。如果WHEN_FAILED報錯,硬盤有問題了。。。。WORST 是標(biāo)準(zhǔn)值(VALUE)的最小值。
bash-2.05b# smartctl -A /dev/ad0
smartctl version 5.26 Copyright (C) 2002-3 Bruce Allen
Home page is https://smartmontools.sourceforge.net/
The SMART RETURN STATUS return value (smartmontools -H option/Directive)
can not be retrieved with this version of ATAng, please do not rely on
this value
=== START OF READ SMART DATA SECTION ===
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 0x000b 100 100 062 Pre-fail Always
- 0
2 Throughput_Performance 0x0005 100 100 040 Pre-fail Offline
- 0
3 Spin_Up_Time 0x0007 113 113 033 Pre-fail Always
- 1
4 Start_Stop_Count 0x0012 100 100 000 Old_age Always
- 985
5 Reallocated_Sector_Ct 0x0033 100 100 005 Pre-fail Always
- 0
7 Seek_Error_Rate 0x000b 100 100 067 Pre-fail Always
- 0
8 Seek_Time_Performance 0x0005 100 100 040 Pre-fail Offline
- 0
9 Power_On_Hours 0x0012 097 097 000 Old_age Always
- 1642
1
關(guān)鍵詞標(biāo)簽:FreeBSD,Linux檢測硬盤
相關(guān)閱讀
熱門文章 安裝紅帽子RedHat Linux9.0操作系統(tǒng)教程使用screen管理你的遠程會話GNU/Linux安裝vmware如何登錄linux vps圖形界面 Linux遠程桌面連
人氣排行 Linux下獲取CPUID、硬盤序列號與MAC地址linux tc實現(xiàn)ip流量限制dmidecode命令查看內(nèi)存型號linux下解壓rar文件安裝紅帽子RedHat Linux9.0操作系統(tǒng)教程Ubuntu linux 關(guān)機、重啟、注銷 命令lcx.exe、nc.exe、sc.exe入侵中的使用方法查看linux服務(wù)器硬盤IO讀寫負載