You are not logged in.

#1 2011-11-08 16:16:08

fsckd
Forum Fellow
Registered: 2009-06-15
Posts: 4,173

[SOLVED] badblocks ext4

Overview of issue.

On boot when a filesystem is being fsck, errors appear:

[   21.638174] sd 2:0:0:0: [sdc] Unhandled sense code
[   21.638180] sd 2:0:0:0: [sdc]  Result: hostbyte=0x10 driverbyte=0x08
[   21.638186] sd 2:0:0:0: [sdc]  Sense Key : 0x3 [current] 
[   21.638192] sd 2:0:0:0: [sdc]  ASC=0x11 ASCQ=0x0
[   21.638197] sd 2:0:0:0: [sdc] CDB: cdb[0]=0x28: 28 00 05 c0 00 67 00 00 40 00
[   21.638210] end_request: critical target error, dev sdc, sector 96469095
[   21.638289] Buffer I/O error on device sdc1, logical block 96469032
[   21.638351] Buffer I/O error on device sdc1, logical block 96469033
[   21.638410] Buffer I/O error on device sdc1, logical block 96469034
[   21.638468] Buffer I/O error on device sdc1, logical block 96469035
[   21.638525] Buffer I/O error on device sdc1, logical block 96469036
[   21.638581] Buffer I/O error on device sdc1, logical block 96469037
[   21.638639] Buffer I/O error on device sdc1, logical block 96469038
[   21.638696] Buffer I/O error on device sdc1, logical block 96469039
[   21.638762] Buffer I/O error on device sdc1, logical block 96469040
[   21.638820] Buffer I/O error on device sdc1, logical block 96469041
[   23.551857] sd 2:0:0:0: [sdc] Unhandled sense code
[   23.551863] sd 2:0:0:0: [sdc]  Result: hostbyte=0x10 driverbyte=0x08
[   23.551868] sd 2:0:0:0: [sdc]  Sense Key : 0x3 [current] 
[   23.551874] sd 2:0:0:0: [sdc]  ASC=0x11 ASCQ=0x0
[   23.551878] sd 2:0:0:0: [sdc] CDB: cdb[0]=0x28: 28 00 05 c0 00 a7 00 00 80 00
[   23.551890] end_request: critical target error, dev sdc, sector 96469159
[   24.591795] sd 2:0:0:0: [sdc] Unhandled sense code
[   24.591801] sd 2:0:0:0: [sdc]  Result: hostbyte=0x10 driverbyte=0x08
[   24.591806] sd 2:0:0:0: [sdc]  Sense Key : 0x3 [current] 
[   24.591811] sd 2:0:0:0: [sdc]  ASC=0x11 ASCQ=0x0
[   24.591816] sd 2:0:0:0: [sdc] CDB: cdb[0]=0x28: 28 00 05 c0 00 8f 00 00 08 00
[   24.591828] end_request: critical target error, dev sdc, sector 96469135

I'm not familiar with that but since I can mount and read and write data my spider sense tells me it's probably bad blocks than a catastrophic mechanism failure.

Disk /dev/sdc: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders, total 312581808 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0001132a

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1              63   312581807   156290872+  83  Linux

Two general goals,

  • Locate which files are on bad blocks.

  • Mark bad blocks so they can not be used again.

I have never done either before.

Plan of attack for finding damaged files,

The wiki has this fine article: https://wiki.archlinux.org/index.php/Fi … iven_Block
which describes the process for JFS (everyone uses JFS). I am unfortunately part of the minority who uses ext4. Not to worry, the article gives ideas on how to approach this:

  • find bad blocks using: badblocks -v -b 4096 /dev/sdc1

  • use debugfs's icheck to find which inodes correspond to the bad blocks

  • use find utility to map inodes to path

Marking bad blocks

I need help with this.

Last edited by fsckd (2011-11-10 12:45:42)


aur S & M :: forum rules :: Community Ethos
Resources for Women, POC, LGBT*, and allies

Offline

#2 2011-11-08 16:20:36

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: [SOLVED] badblocks ext4

Have a look at the -c flag of fsck.ext4.

Offline

#3 2011-11-08 16:29:52

alphaniner
Member
From: Ancapistan
Registered: 2010-07-12
Posts: 2,810

Re: [SOLVED] badblocks ext4

I don't know that it's possible to 'mark' bad blocks.  You can use the -o badblocks flag along with the -l mke2fs flag, presumably to make your fs "around" the bad blocks.  Alternately, get the manufacturer's diagnostic utility and it may be able to remap all the bad sectors to reserved sectors.


But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner

Offline

#4 2011-11-08 17:09:41

kokoko3k
Member
Registered: 2008-11-14
Posts: 2,399

Re: [SOLVED] badblocks ext4

Is smart active on that drive?
As far as i know smart should reallocate bad sectors automatically:
http://www.ariolic.com/activesmart/smar … count.html

I'd try smartctl utility, and see what it reports.


Help me to improve ssh-rdp !
Retroarch User? Try my koko-aio shader !

Offline

#5 2011-11-08 17:49:45

fsckd
Forum Fellow
Registered: 2009-06-15
Posts: 4,173

Re: [SOLVED] badblocks ext4

Thank you. -c for fsck should probably do the job at the filesystem level. Yes this drive has smart (iirc) and I'll see what I can find. Thank you for reminding me of that.

Output from badblocks (options same as listed above):

Checking blocks 0 to 39072717
Checking for bad blocks (read-only test): 12058624done, 24:41 elapsed
12058634done, 24:44 elapsed
12058635done, 24:47 elapsed
12058636done, 24:49 elapsed
done                                
Pass completed, 4 bad blocks found.

aur S & M :: forum rules :: Community Ethos
Resources for Women, POC, LGBT*, and allies

Offline

#6 2011-11-08 19:58:14

R00KIE
Forum Fellow
From: Between a computer and a chair
Registered: 2008-09-14
Posts: 4,734

Re: [SOLVED] badblocks ext4

You want to use a write-read test. Also check the SMART attributes for any offline pending sectors, those should either get remapped if they are indeed bad or an overwrite will solve the problem.


R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K

Offline

#7 2011-11-09 06:03:48

fsckd
Forum Fellow
Registered: 2009-06-15
Posts: 4,173

Re: [SOLVED] badblocks ext4

ROOKIE, thanks for the suggestions.



debugfs /dev/sdc1 gave me this error,

/dev/sdc1: Can't read an block bitmap while reading block bitmap

and dmesg shows output similar to that in my first post. That kills my attempt to determine which files, if any, are damaged.

I bought a WD Passport and am copying all files. I'll try SMART and fsck -cc tomorrow when I can think more clearly.


aur S & M :: forum rules :: Community Ethos
Resources for Women, POC, LGBT*, and allies

Offline

#8 2011-11-10 12:45:15

fsckd
Forum Fellow
Registered: 2009-06-15
Posts: 4,173

Re: [SOLVED] badblocks ext4

I was wrong. The device does not have smart. I ran fsck -c -c all of yesterday (!) and that seems to have handled the issue at the file system level. Thank you everyone.


aur S & M :: forum rules :: Community Ethos
Resources for Women, POC, LGBT*, and allies

Offline

#9 2011-11-10 15:11:25

R00KIE
Forum Fellow
From: Between a computer and a chair
Registered: 2008-09-14
Posts: 4,734

Re: [SOLVED] badblocks ext4

fsckd wrote:

I was wrong. The device does not have smart. I ran fsck -c -c all of yesterday (!) and that seems to have handled the issue at the file system level. Thank you everyone.

Are you sure? If it is a normal HD it most probably 99.99% sure has SMART, however if it is connected through a usb bridge it might be that the bridge doesn't support passing the specific ata commands to access the SMART data or you need to use smartctl with -d {usbcypress,usbjmicron,usbsunplus}. I've had success with this last option in one case where it would seem smart data was not accessible.


R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K

Offline

#10 2011-11-10 16:02:08

fsckd
Forum Fellow
Registered: 2009-06-15
Posts: 4,173

Re: [SOLVED] badblocks ext4

I'm not sure. When I tried -d usbcypress it hung and kill -9 took a while to take effect.

Here's the output from hdparm -I,

/dev/sdb:
SG_IO: bad/missing sense data, sb[]:  70 00 05 00 00 00 00 0a 00 00 00 00 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

ATA device, with non-removable media
Standards:
        Likely used: 1
Configuration:
        Logical         max     current
        cylinders       0       0
        heads           0       0
        sectors/track   0       0
        --
        Logical/Physical Sector size:           512 bytes
        device size with M = 1024*1024:           0 MBytes
        device size with M = 1000*1000:           0 MBytes
        cache/buffer size  = unknown
Capabilities:
        IORDY not likely
        Cannot perform double-word IO
        R/W multiple sector transfer: not supported
        DMA: not supported
        PIO: pio0

aur S & M :: forum rules :: Community Ethos
Resources for Women, POC, LGBT*, and allies

Offline

#11 2011-11-10 19:48:03

R00KIE
Forum Fellow
From: Between a computer and a chair
Registered: 2008-09-14
Posts: 4,734

Re: [SOLVED] badblocks ext4

Then I guess that falls into the category of usb bridge does not support the passthrough of the needed ata commands (or smartctl/hdparm does not know the chip and how to do it). I guess this is quite a hit or miss thing, it was worth the shot though.


R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K

Offline

Board footer

Powered by FluxBB