# Disk read errors?

## Monq

I got disk read errors when mounting the root partition, and so it doesn't mount and I get dropped to an emergency shell.

When that happens, I'm no longer able to mount it using the Gentoo Live CD or any other distro's live CD, but I can recover the data using a Windows program, ext2explore. I can't run fsck either (I get read errors too, until it hangs).

If I delete and create the partition again, I can run a fsck surface scan, which won't show any errors.

That happened to me twice with another distro (Arch Linux), so I considered switching to Gentoo, but I got the same again...

Is my installation recoverable? I'm not sure but I think the disk is not broken or something (how may I check for that?)

And sorry for my english but I think you understood it   :Razz: 

----------

## NeddySeagoon

Monq,

Welcome to Gentoo

Before we test the drive surface, which takes a long time and will destroy any data there there are a few other things.

Please post the output of dmesg, showing some of the errors.

Unplugging and replugging the data cable to the drive and the motherboard may help. This 'wipes' the contacts in the connectors.

If your drive is a PATA device with either a 40 wire or 80 wire ribbon cable, the connector at the end of the cable must be used.

----------

## Monq

 *NeddySeagoon wrote:*   

> Monq,
> 
> Welcome to Gentoo

 

 :Smile: 

 *NeddySeagoon wrote:*   

> 
> 
> Before we test the drive surface, which takes a long time and will destroy any data there there are a few other things.
> 
> Please post the output of dmesg, showing some of the errors.
> ...

 

How do I do that? As I said I can't even boot, because the root device doesn't mount. I'll try to take a photo of the error  :Smile: 

 *NeddySeagoon wrote:*   

> 
> 
> Unplugging and replugging the data cable to the drive and the motherboard may help. This 'wipes' the contacts in the connectors.
> 
> If your drive is a PATA device with either a 40 wire or 80 wire ribbon cable, the connector at the end of the cable must be used.

 

It's a SATA drive, this is a laptop. I already tried to unplug and plug the disk again, it's the same.

Thanks for your answer.

----------

## NeddySeagoon

Monq,

Boot with a CD and attempt to mount the partitions the drive contains.

The dmesg command will then show any errors.  Do not try to get into your chroot. attempting to mount is enough.

The Gentoo liveCD contains a tool called wgetpaste which puts files and/or command output on the web.

In this case 

```
dmesg | wgetpaste
```

is what you need to do, then post the URL you get back.

----------

## Monq

```
ata1.00: exception Emask 0x0 SAct 0x1 SErr 0x0 action 0x0

ata1.00: irq_stat 0x40000008

ata1.00: failed command: READ FPDMA QUEUED

ata1.00: cmd 60/00:00:58:fe:fe/01:00:38:00:00/40 tag 0 ncq 131072 in

         res 41/40:00:d0:fe:fe/00:00:38:00:00/00 Emask 0x409 (media error) <F>

ata1.00: status: { DRDY ERR }

ata1.00: error: { UNC }

ata1.00: configured for UDMA/100

ata1: EH complete

ata1.00: exception Emask 0x0 SAct 0x1 SErr 0x0 action 0x0

ata1.00: irq_stat 0x40000008

ata1.00: failed command: READ FPDMA QUEUED

ata1.00: cmd 60/00:00:58:fe:fe/01:00:38:00:00/40 tag 0 ncq 131072 in

         res 41/40:00:d0:fe:fe/00:00:38:00:00/00 Emask 0x409 (media error) <F>

ata1.00: status: { DRDY ERR }

ata1.00: error: { UNC }

ata1.00: configured for UDMA/100

ata1: EH complete

ata1.00: exception Emask 0x0 SAct 0x1 SErr 0x0 action 0x0

ata1.00: irq_stat 0x40000008

ata1.00: failed command: READ FPDMA QUEUED

ata1.00: cmd 60/00:00:58:fe:fe/01:00:38:00:00/40 tag 0 ncq 131072 in

         res 41/40:00:d0:fe:fe/00:00:38:00:00/00 Emask 0x409 (media error) <F>

ata1.00: status: { DRDY ERR }

ata1.00: error: { UNC }

ata1.00: configured for UDMA/100

ata1: EH complete

ata1.00: exception Emask 0x0 SAct 0x1 SErr 0x0 action 0x0

ata1.00: irq_stat 0x40000008

ata1.00: failed command: READ FPDMA QUEUED

ata1.00: cmd 60/00:00:58:fe:fe/01:00:38:00:00/40 tag 0 ncq 131072 in

         res 41/40:00:d0:fe:fe/00:00:38:00:00/00 Emask 0x409 (media error) <F>

ata1.00: status: { DRDY ERR }

ata1.00: error: { UNC }

ata1.00: configured for UDMA/100

ata1: EH complete

ata1.00: exception Emask 0x0 SAct 0x1 SErr 0x0 action 0x0

ata1.00: irq_stat 0x40000008

ata1.00: failed command: READ FPDMA QUEUED

ata1.00: cmd 60/00:00:58:fe:fe/01:00:38:00:00/40 tag 0 ncq 131072 in

         res 41/40:00:d0:fe:fe/00:00:38:00:00/00 Emask 0x409 (media error) <F>

ata1.00: status: { DRDY ERR }

ata1.00: error: { UNC }

ata1.00: configured for UDMA/100

ata1: EH complete

ata1.00: exception Emask 0x0 SAct 0x1 SErr 0x0 action 0x0

ata1.00: irq_stat 0x40000008

ata1.00: failed command: READ FPDMA QUEUED

ata1.00: cmd 60/00:00:58:fe:fe/01:00:38:00:00/40 tag 0 ncq 131072 in

         res 41/40:00:d0:fe:fe/00:00:38:00:00/00 Emask 0x409 (media error) <F>

ata1.00: status: { DRDY ERR }

ata1.00: error: { UNC }

ata1.00: configured for UDMA/100

sd 0:0:0:0: [sda] Unhandled sense code

sd 0:0:0:0: [sda]  Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE

sd 0:0:0:0: [sda]  Sense Key : Medium Error [current] [descriptor]

Descriptor sense data with sense descriptors (in hex):

        72 03 11 04 00 00 00 0c 00 0a 80 00 00 00 00 00 

        38 fe fe d0 

sd 0:0:0:0: [sda]  Add. Sense: Unrecovered read error - auto reallocate failed

sd 0:0:0:0: [sda] CDB: Read(10): 28 00 38 fe fe 58 00 01 00 00

end_request: I/O error, dev sda, sector 956235472

JBD: Failed to read block at offset 20441

ata1: EH complete

JBD: recovery failed

EXT4-fs (sda3): error loading journal
```

Thanks.

----------

## NeddySeagoon

Monq,

If you have any data on that drive that you need, DO NOT do this.

For each partition on your drive do

```
 badblocks -w /dev/sda...
```

This will destroy all the data and from the man page

```
   -w     Use  write-mode test. With this option, badblocks scans for bad blocks by writing some patterns (0xaa, 0x55, 0xff, 0x00) on every block of the

              device, reading every block and comparing the contents.
```

So it will take a while.

When a write files due to an internal drive issue, the drive will attempt to remap the failed sector to a spare sector, which will allow the write to succeed.  If you can find a  liveCD that contains smartmontools (maybe SystemRescueCD ?) you can read the drive internal error log and post it here. From your

```
 sd 0:0:0:0: [sda]  Add. Sense: Unrecovered read error - auto reallocate failed

sd 0:0:0:0: [sda] CDB: Read(10): 28 00 38 fe fe 58 00 01 00 00

end_request: I/O error, dev sda, sector 956235472 
```

Your drive has at least one bad block, where the data is probably lost.

That list of errors is the system trying to reread the block - only onle block is listed in the error report.

----------

## Monq

I'll try, thanks  :Very Happy: 

----------

## Monq

Done. My hard disk is split in three partitions: a0 and a1 are for Windows, and a2 is for Gentoo.

The problem was in the Gentoo partition so I just did:

```
badblocks -wv /dev/sda2
```

The result, after one hour or so, was:

```
Pass completed, 0 bad blocks found.
```

----------

## NeddySeagoon

Monq,

The writes will have forced bad block relocation.  Let it finish, it will do 4 passes.

----------

## Monq

 *NeddySeagoon wrote:*   

> Monq,
> 
> The writes will have forced bad block relocation.  Let it finish, it will do 4 passes.

 

I let it finish, but I don't know what the 'bad block relocation' is. If I delete the partition and re-create the filesystem, will that happen again?

Does the output mean that there are no bad blocks?

Thank you.

----------

