Linux - HardwareThis forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Please post the output from "smartctl -A /dev/sda". The problem could be a simple as a single bad sector which just needs to be written to so that the drive can reallocate it to a spare sector. That is _only_ going to happen when a write to that sector occurs unless at some point the drive does manage to get a correct read from that sector and so can reallocate it on its own. Bad sectors that are pending reallocation will cause some offline tests to fail.
Assuming that the problem is just some small number of bad sectors, the Bad Block HOWTO shows the procedure for finding them, determining what file they are (or are not) part of, and making the drive reallocate them. If there are just a small number of bad sectors and this number is not increasing with time, then the drive is OK to use. There are various events such as vibration or power supply glitches that can cause a sector to become bad without being a warning of impending doom.
Good backups are, of course, always important. Drives can and do fail without warning.
This is the output of the command you suggested. Does it look that bad that the drive needs to be dumped? OK, good excuse to get a bigger drive, meads I don't need to dump a lot of Beethoven to DVD :-)
The problem is #197, Current_Pending_Sector. That is just one bad sector, and the drive otherwise looks fine. A bad sector that is pending reallocation is visible to the OS (will cause an I/O error if read) and will cause the offline test to fail at that location. Follow the steps in the Bad Block HOWTO to get that sector reallocated. Parameter #5, Reallocated_Sector_Ct, should then increase to 2, and the offline tests should then pass. That drive hasn't been used much, just under 170 power-on hours, and you should expect it to have a normal lifetime.
The steps in the HOWTO aren't as hard as they look (it covers several different cases -- you will be concerned with just one), but if you don't want to do that, the ham-fisted approach would be to back up the files on the affected partition, clear the partition with "dd if=/dev/zero of=/dev/sda5 bs=64k", then remake the filesystem and restore the backup.
Of course if you just want a bigger disk, by all means go ahead and get one.
BTW, when you post output please use [CODE]...[/CODE] tags and not [QUOTE]...[/QUOTE] tags so that formatting is preserved.
Last edited by rknichols; 05-11-2014 at 08:12 AM.
Reason: Add BTW
The attributes look fine, except of course for the bad sector, which is not good. You could try zeroing the HDD like rknichols suggests as this may repair soft errors. Obviously backup before doing this.
debugfs 1.42.9 (4-Feb-2014)
debugfs: open /dev/sda1
debugfs: testb 18087682
Illegal block number passed to ext2fs_test_block_bitmap #18087682 for block bitmap for /dev/sda1
Block 18087682 not in use
debugfs: testb 18087683
Illegal block number passed to ext2fs_test_block_bitmap #18087683 for block bitmap for /dev/sda1
Block 18087683 not in use
I don't know what the error message means. I would appreciate being told what I am doing wrong!
Unfortunately, the program will probably die from an I/O error at that point, but hopefully you will be able to see the "Inode table at ..." line and can confirm that the bad sector is within that inode table. The inodes in that sector pretty much have to be free or else your e2fsck would have died with an I/O error, so it should be safe to zero them. First, to be absolutely certain you have the right sector run
hdparm --read-sector 144701458
If you do get the expected I/O error from that, zero it by running
hdparm --write-sector 144701458
That should make "smartctl -A /dev/sda" report "0" for the Current_Pending_Sector count, and the Reallocated_Sector_Ct will probably increase to "2". It would be best to run "e2fsck -f /dev/sda5" just to be sure you haven't stepped on something in use.
You did say you had backups for this filesystem, right?