Quantcast
Channel: Device: /dev/sda [SAT], 1 Currently unreadable (pending) sectors - Server Fault
Viewing all articles
Browse latest Browse all 6

Answer by Donovan Baarda for Device: /dev/sda [SAT], 1 Currently unreadable (pending) sectors

$
0
0

I believe the "197 Current_Pending_Sector" count is is a count of sectors that have failed to read. This does kind of imply that the drive is starting to fail, but it doesn't necessarily mean the drive is bad. If those sectors are re-written the drive firmware can re-map them away and the drive could be fine.

Searching around also finds discussions that suggest some models of SSD drives regularly toggle this to 1 and back, and it might be a mostly harmless firmware bug in the SMART reporting.

So you could just ignore it, and provided your filesystem can handle the occasional bad block read (ie, does some kind of robust raid/redundancy under the hood), it might slowly clear itself as the filesystem overwrites those blocks. If your filesystem cannot handle bad block reads, you could get IO errors every time something tries to read whatever is in that block. You might still be able to recover by finding and deleting that file, and the filesystem will eventually re-write over that sector.

You can also clear the Current_Pending_Sector count by explicitly overwriting those sectors. THIS WILL DESTROY DATA ON THE DISK! This could corrupt the filesystem in ways that could loose all the data on the disk, not just what is lost in the bad sector. So only do this if you can afford to loose all the data on the disk.

You can find the bad sector by running a smart long test;

# smartctl -t long /dev/sda

You can then check the status of the long test to see if its finished, and the LBA of the first error it encountered;

# smartctl -l selftest /dev/sdasmartctl 7.1 2019-12-30 r5022 [x86_64-linux-5.7.0-1-amd64] (local build)Copyright (C) 2002-19, Bruce Allen, Christian Franke, www.smartmontools.org=== START OF READ SMART DATA SECTION ===SMART Self-test log structure revision number 1Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error# 1  Extended offline    Completed without error       00%     17711         12345# 2  Short offline       Completed without error       00%     17709         -# 3  Short captive       Interrupted (host reset)      10%       450         -# 4  Short captive       Interrupted (host reset)      10%       228         -

Note: If you don't see a number in LBA_of_first_error you can try using -l xselftest instead.

You can then overwrite the bad sector using dd;

# dd if=/dev/zero of=/dev/sda seek=12345 count=1

Though note that the default bs=512 blocksize might be smaller than the physical sector size on the drive, so you may need to write up to count=8 to wipe it completely. You can then rinse-and repeat the test/overwrite cycle until all the bad sectors are overwritten. Finally, you can check that the count has been zeroed;

$ sudo smartctl -A /dev/sdc | grep Current_Pending_Sector197 Current_Pending_Sector  0x0012   200   200   000    Old_age   Always       -       0

I experienced this on an old WD 200G HDD that had some kind of hickup that may have been caused by poor hotplug connections that resulted in a Current_Pending_Sector count of 26. When I ran the long test, it passed without finding any bad sectors, but the count was still at 26. I was able to zero the counter it by zeroing out the whole drive with dd;

dd if=/dev/zero of=/dev/sda bs=1M status=progress

Note the bs=1M makes it go much faster, but it's not the 512 sector size so there will be a partial block at the end. Subsequent smartctl long and short tests have all reported the drive as fine.


Viewing all articles
Browse latest Browse all 6

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>