一、执行命令:
# smartctl -a /dev/sda
smartctl version 5.38[x86_64-redhat-linux-gnu] Copyright (C) 2002-8 Bruce Allen
Home page ishttp://smartmontools.sourceforge.net/
Device: SEAGATE ST3300657SS Version: ES64
Serial number: 6SJ175BR
Device type: disk
Transport protocol: SAS
Local Time is: Tue Feb 21 15:23:46 2012 CST
Device supports SMART and is Enabled
Temperature Warning Disabled or NotSupported
SMART Health Status: OK
Current Drive Temperature: 40 C
Drive Trip Temperature: 68 C
Elements in grown defect list: 16
Vendor (Seagate) cache information
Blocks sent to initiator = 1990352432
Blocks received from initiator = 2738959193
Blocks read from cache and sent to initiator = 35795691
Number of read and write commands whose size <= segment size =423851654
Number of read and write commands whose size > segment size = 0
Vendor (Seagate/Hitachi) factoryinformation
number of hours powered up = 7208.00
number of minutes until next internal SMART test = 58
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: 1029069625 28 0 1029069653 1029069653 1016.060 0
write: 0 0 0 0 0 8091.799 0
verify: 126342 0 0 126342 126342 3.000 0
Non-medium error count: 13
SMART Self-test log
Num Test Status segment LifeTime LBA_first_err [SK ASC ASQ]
Description number (hours)
# 1 Background long Failed insegment --> 24 7196 435567298 [0x30x11 0x0]
# 2 Background short Completed 16 7194 - [- - -]
# 3 Background short Completed 16 7170 - [- - -]
# 4 Background short Completed 16 7146 - [- - -]
# 5 Background short Completed 16 7122 - [- - -]
# 6 Background long Completed 16 7100 - [- - -]
# 7 Background short Completed 16 7098 - [- - -]
# 8 Background short Completed 16 7074 - [- - -]
# 9 Background short Completed 16 7050 - [- - -]
#10 Background long Completed 16 7028 - [- - -]
#11 Background short Completed 16 7026 - [- - -]
#12 Background short Completed 16 7002 - [- - -]
#13 Background short Completed 16 6978 - [- - -]
#14 Background short Completed 16 6954 - [- - -]
#15 Background long Completed 16 6932 - [- - -]
#16 Background short Completed 16 6930 - [- - -]
#17 Background short Completed 16 6906 - [- - -]
#18 Backgroundshort Completed 16 6882 - [- - -]
#19 Background long Completed 16 6860 - [- - -]
#20 Background short Completed 16 6858 - [- - -]
Long (extended) Self Test duration: 3200seconds [53.3 minutes]
二、查看硬盘分区
#fdisk –lu
Disk/dev/sda: 300.0 GB, 300000000000 bytes
255heads, 63 sectors/track, 36472 cylinders, total 585937500 sectors
Units = sectors of 1 * 512 = 512 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 63 208844 104391 83 Linux
/dev/sda2 208845 585922679 292856917+ 8e Linux LVM
三、确认坏区位置
# echo 'scale=5;(435567298 - 208845) * 512/4096'|bc *512是1个Units512字节,/4096是每个块设备是4096字节
54419806.62500 处于第五个扇区,8个扇区1个块,0.125*5=0.625
说明在54419806这个块的第5个扇区有问题,接下来查看下出问题的地方是否有文件使用了
四、查看是否有文件在使用坏区
# debugfs
debugfs 1.39 (29-May-2006)
debugfs: open /dev/mapper/VolGroup00-LogVol02 #打开/dev/mapper/VolGroup00-LogVol02
debugfs: icheck 54419806 # Print a listing of the inodes which use the one or more blocks specified on the command line
Block Inode number
54419806 50659332
debugfs: ncheck 50659332 # Take the requested list of inode numbers, and print alisting of pathnames to those inodes.
Inode Pathname
50659332 /database/jhl_2918_x5/mysql/ibdata1 #找到了有文件处于坏区位置
debugfs: