On Sat, 28 Sep 2019 at 09:47, local10 <loca...@tutanota.com> wrote:
>
> Started to get SMART self test errors and wanted to fix them before things 
> would get any worse:
>
> SMART Self-test log structure revision number 1
> Num  Test_Description    Status                  Remaining  LifeTime(hours)  
> LBA_of_first_error
> # 1  Short offline       Completed: read failure       60%     24805         
> 624048
>
> So I calculated the file sytem block number of the bad LBA according to the 
> following formula:
>
> b = (int) ((L-S) * 512 / B)
>
> where:
> b = File System block number
> B = File system block size in bytes
> L = LBA of bad sector
> S = Starting sector of partition as shown by fdisk -lu
> and (int) denotes the integer part.
>
>
> The bad file system block number turned out to be 950 in my case. However, 
> trying to find out what file this block number belongs to failed (see below, 
> /dev/sda2 contains an ext4 root file system that was mounted as root when 
> debugfs was run):
>
> # debugfs
> debugfs 1.44.5 (15-Dec-2018)
> debugfs:  open /dev/sda2
> debugfs:  testb 950
> Block 950 marked in use
> debugfs:  icheck 950
> icheck: Input/output error while calling ext2fs_block_iterate
> icheck: Can't read next inode while doing inode scan
> debugfs:  quit
> #
>
> Any ideas? Thanks

Hi, I assume you are attempting to follow a procedure similar
to this one:
https://www.smartmontools.org/wiki/BadBlockHowto#Repairsinafilesystem

Most of the examples there assume that the bad block
is used for storage of file data. This is reasonable because
that's what most blocks are used for.

However, some blocks on any disk are used by the file system
itself to keep track of which blocks are used for what purpose.

And in this case, it appears that your bad block is one that is
used by the filesystem itself. I think that what debugfs is
telling you here:
> icheck: Can't read next inode while doing inode scan

It's telling you that the filesystem itself is broken/unreadable.
I assume you know what inodes are, if not then you should
read about that.

In such a case, I think that it is not possible to repair this filesystem.
Rather, you need to rescue or backup any required data, then
the whole filesystem needs to be recreated using mkfs to destroy
the old file system and create a new one, and then restore
all the file data. If it's a root filesystem, you will need another
one to manage that process, or reinstall.

Reply via email to