gmirror – recovering from a failed HDDI like RAID. On my development server, I use both hardware and software RAID. For hardware RAID on FreeBSD, I like 3Ware. For software RAID, I tend to use gmirror, because I don’t need more than RAID-1. Some time ago I added two 120GB HDD to this system. One was SATA, one was PATA. They were joined together via gmirror. Tonight I received some errors that one of the drives was failing. I replaced the drive, and recovered the mirror. I’ll show you what I did, mostly so I know what to do the next time it happens, but also so you can see what to do as well. You may wish to read Adding gmirror to an existing installation first.
The errorsThe errors I encountered were (reformatted to better fit):
Aug 30 00:10:20 ngaio kernel: ad0: FAILURE - READ_DMA status=51<READY,DSC,ERROR> error=40<UNCORRECTABLE> LBA=82797535 Aug 30 00:10:20 ngaio kernel: GEOM_MIRROR: Request failed (error=5). ad0 [READ(offset=42392337920, length=2048)] Aug 30 00:10:20 ngaio kernel: GEOM_MIRROR: Device gm0: provider ad0 disconnected.The following command identified the HDD in question:
# atacontrol list ATA channel 0: Master: ad0 <SAMSUNG SP1203N/TL100-30> ATA/ATAPI revision 7By ‘identified’, I mean I knew which HDD to look for. There was only one Samsung in the machine. Checking the gmirror status I saw:
# gmirror status Name Status Components mirror/gm0 DEGRADED ad3In addition, I installed sysutils/smartmontools and got the following output:
# /usr/local/sbin/smartctl -a /dev/ad0 smartctl version 5.38 [i386-portbld-freebsd6.3] Copyright (C) 2002-8 Bruce Allen Home page is http://smartmontools.sourceforge.net/ === START OF INFORMATION SECTION === Model Family: SAMSUNG SpinPoint P80 series Device Model: SAMSUNG SP1203N Serial Number: S00QJ10Y282854 Firmware Version: TL100-30 User Capacity: 120,060,444,672 bytes Device is: In smartctl database [for details use: -P show] ATA Version is: 7 ATA Standard is: ATA/ATAPI-7 T13 1532D revision 0 Local Time is: Sat Aug 30 01:32:29 2008 BST 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: (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: (4500) 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: ( 1) minutes. Extended self-test routine recommended polling time: ( 75) minutes. 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 0x000f 100 100 051 Pre-fail Always - 394 3 Spin_Up_Time 0x0007 100 100 025 Pre-fail Always - 5888 4 Start_Stop_Count 0x0032 100 100 000 Old_age Always - 5 5 Reallocated_Sector_Ct 0x0033 100 100 011 Pre-fail Always - 0 7 Seek_Error_Rate 0x000f 100 100 051 Pre-fail Always - 0 8 Seek_Time_Performance 0x0025 100 100 015 Pre-fail Offline - 0 9 Power_On_Half_Minutes 0x0032 100 100 000 Old_age Always - 2656h+04m 10 Spin_Retry_Count 0x0033 100 100 051 Pre-fail Always - 0 11 Calibration_Retry_Count 0x0012 100 100 000 Old_age Always - 0 12 Power_Cycle_Count 0x0032 100 100 000 Old_age Always - 5 194 Temperature_Celsius 0x0022 103 091 000 Old_age Always - 45 195 Hardware_ECC_Recovered 0x001a 100 100 000 Old_age Always - 298614779 196 Reallocated_Event_Count 0x0032 100 100 000 Old_age Always - 1 197 Current_Pending_Sector 0x0012 100 100 000 Old_age Always - 0 198 Offline_Uncorrectable 0x0030 100 100 000 Old_age Offline - 0 199 UDMA_CRC_Error_Count 0x003e 200 200 000 Old_age Always - 0 200 Multi_Zone_Error_Rate 0x000a 100 100 051 Old_age Always - 0 201 Soft_Read_Error_Rate 0x000a 100 100 051 Old_age Always - 6 SMART Error Log Version: 1 ATA Error Count: 1 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 1 occurred at disk power-on lifetime: 2654 hours (110 days + 14 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 04 df 63 ef e4 Error: UNC 4 sectors at LBA = 0x04ef63df = 82797535 Commands leading to the command that caused the error were: CR FR SC SN CL CH DH DC Powered_Up_Time Command/Feature_Name -- -- -- -- -- -- -- -- ---------------- -------------------- c8 00 04 df 63 ef e4 00 13d+18:46:35.829 READ DMA c8 00 04 07 49 eb e4 00 13d+18:46:35.829 READ DMA c8 00 04 db 48 eb e4 00 13d+18:46:35.829 READ DMA c8 00 04 03 3b eb e4 00 13d+18:46:35.829 READ DMA c8 00 04 ab 3a eb e4 00 13d+18:46:35.829 READ DMA SMART Self-test log structure revision number 1 No self-tests have been logged. [To run self-tests, use: smartctl -t] Device does not support Selective Self Tests/Logging
Interpreting the errorsI received conflicting advice regarding the above. One person said the disk was toast. Another said it should be able to recover from the above. I went with the easy bit, and replaced the HDD. Next was rebuilding the gmirror.
Rebuilding the arrayMy first attempt to insert a new HDD failed.
# gmirror insert gm0 /dev/ad6 Not all disks connected.This isn’t helpful, the first time you see it. I found my answer in a freebsd-geom mailing list post.
# gmirror forget gm0 # gmirror insert gm0 /dev/ad6 # gmirror status Name Status Components mirror/gm0 DEGRADED ad3 ad6 (0%)It took about 45 minutes for the array to sync up. I like gmirror. 🙂