Replacing a failing disk
S.M.A.R.T. giving warnings
http://manpages.songshu.org/manpages/lenny/en/man8/smartctl.8.html
lately I've been receiving S.M.A.R.T. warnings by mail about one of the disks in a RAID10 array,
the mails came in pairs like below.
SMART error (CurrentPendingSector) detected on host: host This email was generated by the smartd daemon running on: host name: host DNS domain: cipar.net NIS domain: (none) The following warning/error was logged by the smartd daemon: Device: /dev/sde, 1 Currently unreadable (pending) sectors For details see host's SYSLOG (default: /var/log/syslog). You can also use the smartctl utility for further investigation. The original email about this issue was sent at Fri Feb 20 20:30:43 2009 CET Another email message will be sent in 24 hours if the problem persists.
SMART error (OfflineUncorrectableSector) detected on host: host this email was generated by the smartd daemon running on: host name: host DNS domain: cipar.net NIS domain: (none) The following warning/error was logged by the smartd daemon: Device: /dev/sde, 1 Offline uncorrectable sectors For details see host's SYSLOG (default: /var/log/syslog). You can also use the smartctl utility for further investigation. The original email about this issue was sent at Fri Feb 20 20:30:44 2009 CET Another email message will be sent in 24 hours if the problem persists.
Issuing
smartctl -a /dev/sde
gave me the following summary by the smartmontools
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: ST3500320AS
Serial Number: 5QM056TH
Firmware Version: SD04
User Capacity: 500,107,862,016 bytes
Device is: In smartctl database [for details use: -P show]
ATA Version is: 7
ATA Standard is: Exact ATA specification draft version not indicated
Local Time is: Sun Mar 8 11:00:53 2009 CET
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: ( 113) The previous self-test completed having
the read element of the test failed.
Total time to complete Offline
data collection: ( 634) 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: ( 106) minutes.
Conveyance self-test routine
recommended polling time: ( 2) minutes.
SCT capabilities: (0x003b) 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 114 099 006 Pre-fail Always - 132023209
3 Spin_Up_Time 0x0003 093 092 000 Pre-fail Always - 0
4 Start_Stop_Count 0x0032 100 100 020 Old_age Always - 159
5 Reallocated_Sector_Ct 0x0033 100 100 036 Pre-fail Always - 35
7 Seek_Error_Rate 0x000f 074 060 030 Pre-fail Always - 21613621419
9 Power_On_Hours 0x0032 089 089 000 Old_age Always - 9858
10 Spin_Retry_Count 0x0013 100 100 097 Pre-fail Always - 0
12 Power_Cycle_Count 0x0032 100 037 020 Old_age Always - 159
184 Unknown_Attribute 0x0032 100 100 099 Old_age Always - 0
187 Reported_Uncorrect 0x0032 082 082 000 Old_age Always - 18
188 Unknown_Attribute 0x0032 100 098 000 Old_age Always - 4295032838
189 High_Fly_Writes 0x003a 001 001 000 Old_age Always - 344
190 Airflow_Temperature_Cel 0x0022 071 048 045 Old_age Always - 29 (Lifetime Min/Max 27/31)
194 Temperature_Celsius 0x0022 029 052 000 Old_age Always - 29 (0 21 0 0)
195 Hardware_ECC_Recovered 0x001a 028 021 000 Old_age Always - 132023209
197 Current_Pending_Sector 0x0012 100 100 000 Old_age Always - 1
198 Offline_Uncorrectable 0x0010 100 100 000 Old_age Offline - 1
199 UDMA_CRC_Error_Count 0x003e 200 200 000 Old_age Always - 0
SMART Error Log Version: 1
ATA Error Count: 18 (device log contains only the most recent five errors)
CR = Command Register [HEX]
FR = Features Register [HEX]
SC = Sector Count Register [HEX]
SN = Sector Number Register [HEX]
CL = Cylinder Low Register [HEX]
CH = Cylinder High Register [HEX]
DH = Device/Head Register [HEX]
DC = Device Command Register [HEX]
ER = Error register [HEX]
ST = Status register [HEX]
Powered_Up_Time is measured from power on, and printed as
DDd+hh:mm:SS.sss where DD=days, hh=hours, mm=minutes,
SS=sec, and sss=millisec. It "wraps" after 49.710 days.
Error 18 occurred at disk power-on lifetime: 9008 hours (375 days + 8 hours)
When the command that caused the error occurred, the device was active or idle.
After command completion occurred, registers were:
ER ST SC SN CL CH DH
-- -- -- -- -- -- --
40 51 00 4b 10 95 00
Commands leading to the command that caused the error were:
CR FR SC SN CL CH DH DC Powered_Up_Time Command/Feature_Name
-- -- -- -- -- -- -- -- ---------------- --------------------
60 00 80 9f 0e 95 40 00 17d+17:02:58.471 READ FPDMA QUEUED
ec 00 00 00 00 00 a0 00 17d+17:02:58.471 IDENTIFY DEVICE
2f 00 01 10 00 00 a0 00 17d+17:02:58.348 READ LOG EXT
60 00 80 9f 0e 95 40 00 17d+17:02:56.547 READ FPDMA QUEUED
ec 00 00 00 00 00 a0 00 17d+17:02:56.546 IDENTIFY DEVICE
Error 17 occurred at disk power-on lifetime: 9008 hours (375 days + 8 hours)
When the command that caused the error occurred, the device was active or idle.
After command completion occurred, registers were:
ER ST SC SN CL CH DH
-- -- -- -- -- -- --
40 51 00 4b 10 95 00
Commands leading to the command that caused the error were:
CR FR SC SN CL CH DH DC Powered_Up_Time Command/Feature_Name
-- -- -- -- -- -- -- -- ---------------- --------------------
60 00 80 9f 0e 95 40 00 17d+17:02:56.547 READ FPDMA QUEUED
ec 00 00 00 00 00 a0 00 17d+17:02:56.546 IDENTIFY DEVICE
2f 00 01 10 00 00 a0 00 17d+17:02:56.441 READ LOG EXT
60 00 80 9f 0e 95 40 00 17d+17:02:54.640 READ FPDMA QUEUED
ec 00 00 00 00 00 a0 00 17d+17:02:54.639 IDENTIFY DEVICE
Error 16 occurred at disk power-on lifetime: 9008 hours (375 days + 8 hours)
When the command that caused the error occurred, the device was active or idle.
After command completion occurred, registers were:
ER ST SC SN CL CH DH
-- -- -- -- -- -- --
40 51 00 4b 10 95 00
Commands leading to the command that caused the error were:
CR FR SC SN CL CH DH DC Powered_Up_Time Command/Feature_Name
-- -- -- -- -- -- -- -- ---------------- --------------------
60 00 80 9f 0e 95 40 00 17d+17:02:54.640 READ FPDMA QUEUED
ec 00 00 00 00 00 a0 00 17d+17:02:54.639 IDENTIFY DEVICE
2f 00 01 10 00 00 a0 00 17d+17:02:54.534 READ LOG EXT
60 00 80 9f 0e 95 40 00 17d+17:02:52.707 READ FPDMA QUEUED
ec 00 00 00 00 00 a0 00 17d+17:02:52.707 IDENTIFY DEVICE
Error 15 occurred at disk power-on lifetime: 9008 hours (375 days + 8 hours)
When the command that caused the error occurred, the device was active or idle.
After command completion occurred, registers were:
ER ST SC SN CL CH DH
-- -- -- -- -- -- --
40 51 00 4b 10 95 00
Commands leading to the command that caused the error were:
CR FR SC SN CL CH DH DC Powered_Up_Time Command/Feature_Name
-- -- -- -- -- -- -- -- ---------------- --------------------
60 00 80 9f 0e 95 40 00 17d+17:02:52.707 READ FPDMA QUEUED
ec 00 00 00 00 00 a0 00 17d+17:02:52.707 IDENTIFY DEVICE
2f 00 01 10 00 00 a0 00 17d+17:02:52.585 READ LOG EXT
60 00 80 9f 0e 95 40 00 17d+17:02:50.792 READ FPDMA QUEUED
ec 00 00 00 00 00 a0 00 17d+17:02:50.791 IDENTIFY DEVICE
Error 14 occurred at disk power-on lifetime: 9008 hours (375 days + 8 hours)
When the command that caused the error occurred, the device was active or idle.
After command completion occurred, registers were:
ER ST SC SN CL CH DH
-- -- -- -- -- -- --
40 51 00 4b 10 95 00
Commands leading to the command that caused the error were:
CR FR SC SN CL CH DH DC Powered_Up_Time Command/Feature_Name
-- -- -- -- -- -- -- -- ---------------- --------------------
60 00 80 9f 0e 95 40 00 17d+17:02:50.792 READ FPDMA QUEUED
ec 00 00 00 00 00 a0 00 17d+17:02:50.791 IDENTIFY DEVICE
2f 00 01 10 00 00 a0 00 17d+17:02:50.677 READ LOG EXT
60 00 80 9f 0e 95 40 00 17d+17:02:48.845 READ FPDMA QUEUED
60 00 00 9f 0a 95 40 00 17d+17:02:48.845 READ FPDMA QUEUED
SMART Self-test log structure revision number 1
Num Test_Description Status Remaining LifeTime(hours) LBA_of_first_error
# 1 Extended offline Completed: read failure 10% 9849 917923767
# 2 Extended offline Completed without error 00% 9685 -
# 3 Extended offline Completed without error 00% 9594 -
# 4 Extended offline Completed: read failure 90% 9512 9769035
# 5 Extended offline Completed: read failure 90% 9344 9769035
# 6 Extended offline Completed: read failure 90% 9176 9769035
# 7 Extended offline Completed: read failure 90% 9008 9769035
# 8 Extended offline Completed without error 00% 8842 -
# 9 Extended offline Completed without error 00% 8674 -
#10 Extended offline Completed: read failure 40% 8505 675183097
#11 Extended offline Completed: read failure 40% 8342 675183097
#12 Extended offline Completed: read failure 40% 8170 675183097
#13 Extended offline Completed: read failure 40% 8002 675183097
#14 Extended offline Completed without error 00% 7835 -
#15 Extended offline Completed without error 00% 7673 -
#16 Extended offline Completed without error 00% 7503 -
#17 Extended offline Completed without error 00% 7333 -
#18 Extended offline Completed without error 00% 7165 -
#19 Extended offline Completed without error 00% 6997 -
#20 Extended offline Completed without error 00% 6833 -
#21 Extended offline Completed without error 00% 6660 -
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.
Actually i wasn't sure on how to read this but a quick e-mail to the debian-user mailinglist
returned the following advice.
G'Day. > > smartctl --all /dev/sde > > gives me the following, i've been trying to google this but some sources say > > replace the disk at once or don't wory, its harmless. Anybody can shed some > > light? > > 5 Reallocated_Sector_Ct 0x0033 100 100 036 Pre-fail Always > > - 35 This one above indicates that you drive is developing bad sectors. All drives come with 'spare' sectors that can be remapped to the usable space if ine or more becomes bad. Your drive has reallocated 35 bad sectors and is most likely out of spares. Regardless the drive is failing and must be replaced. In addition to that the data that was stored on those 35 previously bad sectors is most likely irretrievably lost. I hope that your raid setup has saved you from this data corruption. > > Num Test_Description Status Remaining LifeTime(hours) > > LBA_of_first_error > > # 1 Extended offline Completed: read failure 10% 9849 > > 917923767 ... > > #13 Extended offline Completed: read failure 40% 8002 > > 675183097 Your disc has been steadily failing for the last ~1800 hours. Buy a replacement and swap it out asap. Adrian
OK, seems like clear advice so i'd better take it,
actually i already ordered the new disk since smart gave me the first warning so its time to do some replacing.
Making an extra backup
http://manpages.songshu.org/manpages/lenny/en/man1/rsync.1.html
Before doing anything i decided to do the manual backup routine.
I have all my services and important data in a VServer set up on one big LVM partition
so we stop the VServers first.
/etc/init.d/util-vserver stop
And then make a LVM snapshot.
http://manpages.songshu.org/manpages/lenny/en/man8/lvm.8.html
lvcreate -L592M -s -n backup /dev/vg/VSERVERS
Normally you can start the VServers again at this point and then continue making the backup,
but since this is a failing disk replacement and its sunday anyway i decided not too to risk any loss of data
in case something did go wrong and accept the downtime.
First we mount the snapshot to a physical location.
In this case the location is as follows.
mkdir /mnt/backup
And then mount it.
mount /dev/vg/backup /mnt/backup
As said this is not my usual rotating backup, so i could have used copy but I always use Rsync anyway.
rsync -av /mnt/backup /BACKUP/backup
The /BACKUP location is on another seperate raid1 array on the same box,
you could of course do it to another machine over the network,
but since i have huge amounts of data this simply goes faster
After Rsync has done its job we can unmount the LVM snapshot.
umount /mnt/backup
And then remove the snapshot alltogether.
lvremove /dev/vg/backup
Remove the disk from the array
Now we have a fresh backup lets remove the disk from the array.
The array looks as follows, note this is a raid10 + a raid1 array on the same box so 6 disks in total.
lets have a look with
cat /proc/mdstat
the result looks like this.
Personalities : [raid1] [raid10]
md3 : active raid10 sdc6[0] sdd6[3] sdf6[2] sde6[1]
966020096 blocks 256K chunks 2 far-copies [4/4] [UUUU]
md2 : active raid10 sdc5[0] sdf5[3] sde5[2] sdd5[1]
979712 blocks 64K chunks 2 near-copies [4/4] [UUUU]
md1 : active raid10 sdc3[0] sdf3[3] sde3[2] sdd3[1]
9574528 blocks 64K chunks 2 near-copies [4/4] [UUUU]
md0 : active raid1 sdc1[0] sdd1[3] sde1[2] sdf1[1]
96256 blocks [4/4] [UUUU]
md4 : active raid1 sda1[0] sdb1[1]
976759936 blocks [2/2] [UU]
unused devices: <none>
The disk /dev/sde is used in ”/boot md0” ”/root md1” “swap md2” and the big ”/VSERVERS md3” partition.
We need to remove it from every md device and it takes 2 steps per device.
First we set it to fail
mdadm --fail /dev/md0 /dev/sde1
mdadm --fail /dev/md1 /dev/sde3
mdadm --fail /dev/md2 /dev/sde5
mdadm --fail /dev/md3 /dev/sde6
This time
cat /proc/mdstat
shows as follows
Personalities : [raid1] [raid10]
md3 : active raid10 sdc6[0] sdd6[3] sdf6[2] sde6[4](F)
966020096 blocks 256K chunks 2 far-copies [4/3] [U_UU]
md2 : active raid10 sdc5[0] sdf5[3] sde5[4](F) sdd5[1]
979712 blocks 64K chunks 2 near-copies [4/3] [UU_U]
md1 : active raid10 sdc3[0] sdf3[3] sde3[4](F) sdd3[1]
9574528 blocks 64K chunks 2 near-copies [4/3] [UU_U]
md0 : active raid1 sdc1[0] sdd1[3] sde1[4](F) sdf1[1]
96256 blocks [4/3] [UU_U]
md4 : active raid1 sda1[0] sdb1[1]
976759936 blocks [2/2] [UU]
unused devices: <none>
That looks about right, so now we completely remove it from the array
mdadm --remove /dev/md0 /dev/sde1
mdadm --remove /dev/md1 /dev/sde3
mdadm --remove /dev/md2 /dev/sde5
mdadm --remove /dev/md3 /dev/sde6
Identify the disk
Now /dev/sde is completely removed from the array so we can physically remove the disk and replace it with the new disk.
But how do we know which of the 6 disks is /dev/sde?
Running
smartctl -a /dev/sde
again will show the serial number as it is marked on the disk.
=== START OF INFORMATION SECTION === Model Family: Seagate Barracuda 7200.11 Device Model: ST3500320AS Serial Number: 5QM056TH Firmware Version: SD04 User Capacity: 500,107,862,016 bytes Device is: In smartctl database [for details use: -P show] ATA Version is: 7 ATA Standard is: Exact ATA specification draft version not indicated Local Time is: Sun Mar 8 14:19:10 2009 CET SMART support is: Available - device has SMART capability. SMART support is: Enabled
So in this case 5QM056TH, good to know.
Lets shutdown the machine and replace the disk
shutdown -h now
Add the new disk to the array
After replacing the disk a new unformatted disk showed up when issuing
fdisk -l
Disk /dev/sde: 500.1 GB, 500107862016 bytes 255 heads, 63 sectors/track, 60801 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk identifier: 0x00000000 Disk /dev/sde doesn't contain a valid partition table
Great, so lets get this one with the program and add it to the RAID10 array.
Firstly we need to make sure that the new /dev/sde has the exact same partition layout as the other 3 disks in the array.
Lets copy the partition table of /dev/sdc to /dev/sde.
sfdisk -d /dev/sdc | sfdisk /dev/sde
The result looked like this
Checking that no-one is using this disk right now ... OK Disk /dev/sde: 60801 cylinders, 255 heads, 63 sectors/track sfdisk: ERROR: sector 0 does not have an msdos signature /dev/sde: unrecognized partition table type Old situation: No partitions found New situation: Units = sectors of 512 bytes, counting from 0 Device Boot Start End #sectors Id System /dev/sde1 * 63 192779 192717 fd Linux raid autodetect /dev/sde2 9767520 976768064 967000545 5 Extended /dev/sde3 192780 9767519 9574740 fd Linux raid autodetect /dev/sde4 0 - 0 0 Empty /dev/sde5 9767583 10747484 979902 fd Linux raid autodetect /dev/sde6 10747548 976768064 966020517 fd Linux raid autodetect Successfully wrote the new partition table Re-reading the partition table ... If you created or changed a DOS partition, /dev/foo7, say, then use dd(1) to zero the first 512 bytes: dd if=/dev/zero of=/dev/foo7 bs=512 count=1 (See fdisk(8).)
Once the partitions are OK, we can add the disk the same way as we failed it and removed it earlier
mdadm --add /dev/md0 /dev/sde1
mdadm --add /dev/md1 /dev/sde3
mdadm --add /dev/md2 /dev/sde5
mdadm --add /dev/md3 /dev/sde6
Issuing the command
watch cat /proc/mdstat
should show you that the new disk is part of the array and that the syncing is in progress.
Every 2.0s: cat /proc/mdstat Sun Mar 8 15:01:52 2009
Personalities : [raid1] [raid10]
md3 : active raid10 sde6[4] sdd6[0] sdc6[3] sdf6[2]
966020096 blocks 256K chunks 2 far-copies [4/3] [U_UU]
[>....................] recovery = 0.0% (196352/483010048) finish=122.9min speed=65450K/sec
md2 : active raid10 sde5[4] sdd5[0] sdf5[3] sdc5[1]
979712 blocks 64K chunks 2 near-copies [4/3] [UU_U]
resync=DELAYED
md1 : active raid10 sde3[2] sdd3[0] sdf3[3] sdc3[1]
9574528 blocks 64K chunks 2 near-copies [4/4] [UUUU]
md0 : active raid1 sde1[2] sdd1[0] sdc1[3] sdf1[1]
96256 blocks [4/4] [UUUU]
md4 : active raid1 sda1[0] sdb1[1]
976759936 blocks [2/2] [UU]
unused devices: <none>
