Handling Disk Failures
From Exterior Memory
Revision as of 17:54, 31 August 2017 by MacFreek (Talk | contribs) (Created page with "The best way to deal with disk failures it to assume they will happen and be prepared. See Reliable data storage for best practises. If you have multiple disks in a mirro...")
The best way to deal with disk failures it to assume they will happen and be prepared. See Reliable data storage for best practises.
If you have multiple disks in a mirror setup, and an additional off-site backup, you are fine.
The cause of action is to:
- Run a SMART test (if that hasn't been done) to find where the test fails.
- Write directly to the sector with dd. This forces the drive to relocate the sector to one of your extra sectors.
- Scrub the file system on the disk. If you have a mirrored copy, everything should be restored to normal.
- If you don't have a mirror, use your backup disk to restore the data.
- Decide if you want to replace the disk to prevent future failures.
SMART selftests
A bad block may be reported as follows:
Device: /dev/ada0, 1 Currently unreadable (pending) sectors Device: /dev/ada0, Self-Test Log error count increased from 0 to 1
Bad block are best detected by running a SMART self-test, assuming that the disk has S.M.A.R.T. support.
To examine the status (including indication if a test is still running):
# smartctl -c /dev/ada0
which will include one of these results:
Self-test execution status: ( 0) The previous self-test routine completed without error or no self-test has ever been run.
or
Self-test execution status: ( 249) Self-test routine in progress... 90% of test remaining.
To get the log of the last completed test, run:
# smartctl -l selftest /dev/ada0
To start a test:
# smartctl -t long /dev/ada0
or
# smartctl -t short /dev/ada0
To abort a test:
# smartctl -X /dev/ada0
pakhuis# smartctl -a /dev/ada0
=== START OF INFORMATION SECTION === ... User Capacity: 3,000,592,982,016 bytes [3.00 TB] Sector Sizes: 512 bytes logical, 4096 bytes physical ... 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 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 200 200 051 Pre-fail Always - 0 3 Spin_Up_Time 0x0027 155 150 021 Pre-fail Always - 9225 4 Start_Stop_Count 0x0032 100 100 000 Old_age Always - 91 5 Reallocated_Sector_Ct 0x0033 200 200 140 Pre-fail Always - 0 7 Seek_Error_Rate 0x002e 200 200 000 Old_age Always - 0 9 Power_On_Hours 0x0032 070 070 000 Old_age Always - 22013 10 Spin_Retry_Count 0x0032 100 253 000 Old_age Always - 0 11 Calibration_Retry_Count 0x0032 100 253 000 Old_age Always - 0 12 Power_Cycle_Count 0x0032 100 100 000 Old_age Always - 89 192 Power-Off_Retract_Count 0x0032 200 200 000 Old_age Always - 74 193 Load_Cycle_Count 0x0032 001 001 000 Old_age Always - 914156 194 Temperature_Celsius 0x0022 108 107 000 Old_age Always - 44 196 Reallocated_Event_Count 0x0032 200 200 000 Old_age Always - 0 197 Current_Pending_Sector 0x0032 200 200 000 Old_age Always - 1 <---- this ought to be 0 198 Offline_Uncorrectable 0x0030 200 200 000 Old_age Offline - 0 199 UDMA_CRC_Error_Count 0x0032 200 200 000 Old_age Always - 0 200 Multi_Zone_Error_Rate 0x0008 200 200 000 Old_age Offline - 5 <---- this is worrying. 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 Extended offline Completed without error 00% 22010 - # 2 Extended offline Completed without error 00% 21999 - # 3 Short offline Completed without error 00% 21966 - # 4 Short offline Completed without error 00% 21965 - # 5 Short offline Completed without error 00% 21964 - # 6 Short offline Completed without error 00% 21963 - # 7 Short offline Completed without error 00% 21962 - # 8 Short offline Completed without error 00% 21961 - # 9 Short offline Completed without error 00% 21960 - #10 Short offline Completed without error 00% 21959 - #11 Short offline Completed without error 00% 21958 - #12 Short offline Completed: read failure 90% 21957 310949139 #13 Short offline Completed without error 00% 21956 - #14 Short offline Completed without error 00% 21955 - #15 Short offline Completed without error 00% 21954 - #16 Short offline Completed without error 00% 21953 - #17 Short offline Completed without error 00% 21952 - #18 Short offline Completed without error 00% 21951 - #19 Short offline Completed without error 00% 21950 - #20 Short offline Completed without error 00% 21949 - #21 Short offline Completed without error 00% 21948 - 1 of 1 failed self-tests are outdated by newer successful extended offline self-test # 1
A few things to notice:
- The disk has a sector size of 512 bytes logical, 4096 bytes physical. We need this info later.
- SMART support is enabled. Good.
- SMART still passes. So the disk is still usable. As long as it lasts, that is.
- There is 1 Current_Pending_Sector. So there is 1 "bad block". This can be fixed, though for some people it is already enough to replace the disk.
- The disk has 5 Multi_Zone_Error_Rate. Anything >0 is worrying, and an indication that the disk is starting to fail. This is a clear indication that it is time to buy a replacement disk.
- The first sector that is failing is 310949139.