LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   Problem trying to find out which files could be affected by bad sectors (https://www.linuxquestions.org/questions/linux-hardware-18/problem-trying-to-find-out-which-files-could-be-affected-by-bad-sectors-4175471651/)

gwiesenekker 07-31-2013 03:39 PM

Problem trying to find out which files could be affected by bad sectors
 
I regularly check my Linux partitions under Windows with HD Sentinel. It found some bad sectors on my ext4 / partition (/dev/sdf5) and now I am trying to find out which files could be affected to assess the damage.

I found the block size of the ext4 file system:

tune2fs -l /dev/sdf5 | grep Block

which returned 4096.

I checked for bad blocks:

badblocks -b 4096 /dev/sdf5

It found 3 bad blocks, one of them being block number 1692288.

Now to find the affected files I ran:

debugfs
open /dev/sdf5
testb 1692288
icheck 1692288

testb returns 'Block 1692288 marked in use', but icheck (to find the inode) returns '<block not found>'.

What does this mean? Is the filesystem corrupt? e2fsck -f /dev/sdf5 shows the filesystem is OK.

Regards,
Gijsbert

Ser Olmy 07-31-2013 06:08 PM

Quote:

Originally Posted by gwiesenekker (Post 5000515)
Now to find the affected files I ran:

debugfs
open /dev/sdf5
testb 1692288
icheck 1692288

testb returns 'Block 1692288 marked in use', but icheck (to find the inode) returns '<block not found>'.

What does this mean? Is the filesystem corrupt?

I would think so. If a block is marked as being in use, there should be a referencing inode. Even a block inside the journal itself should not return "block not found".

Quote:

Originally Posted by gwiesenekker (Post 5000515)
e2fsck -f /dev/sdf5 shows the filesystem is OK.

Very strange. Do you get any errors if you try to mount the file system? Anything suspicious in the logs?

gwiesenekker 07-31-2013 11:32 PM

I can mount the filesystem and I do not get any errors in the logs. Meanwhile I found the reason why icheck returns '<block not found>': the blocks are reserved as bad:

# dumpe2fs -b /dev/sdf5
dumpe2fs 1.41.12 (17-May-2010)
1692288
1692318
1692320

Regards,
Gijsbert

Ser Olmy 07-31-2013 11:49 PM

I guess they must have been detected by a previous fsck run. You should check with smartctl -a /dev/sdf before and after writing to these blocks to confirm that the drive reallocates properly. Pay special attention to the Reallocated_Sector_Ct and Current_Pending_Sector values.

If you're not already monitoring the drive with smartd, that may also be worth considering.

H_TeXMeX_H 08-01-2013 04:25 AM

Bad blocks are a sign that the HDD may fail, so make sure to backup your data.


All times are GMT -5. The time now is 02:48 AM.