# CD/dvd read errors on linux while XP reads them fine

## devsk

When I try to mount a data dvdrw (and it gives the same problem with many CDs as well) I get tonnes of errors like

```
hdd: media error (bad sector): status=0x51 { DriveReady SeekComplete Error }

hdd: media error (bad sector): error=0x34 { AbortedCommand LastFailedSense=0x03 }

ide: failed opcode was: unknown

ATAPI device hdd:

  Error: Medium error -- (Sense key=0x03)

  (reserved error code) -- (asc=0x02, ascq=0x00)

  The failed "Read 10" packet command was:

  "28 00 00 00 00 00 00 00 40 00 00 00 00 00 00 00 "

end_request: I/O error, dev hdd, sector 0

printk: 8 messages suppressed.

```

k3b can't write to this dvdrw either, it fails to verify the data with above errors.

If I insert the same dvdrw in a XP system, it reads it fine. I can fire up Nero and re-burn any other data and have it verify that the data burned was indeed correctly matched with data on the disk.

Also, it doesn't matter where (Nero ro k3b) the disc gets burned. The disc is readable on XP but not in linux.

This doesn't happen with all the dvd/cd discs. But quite a few.

Does anyone know what could it be because?

Specs:

Abit AN8 SLI, 3800+ X2

_NEC DVD_RW ND-3550A

2.6.21 gentoo-sources

k3b 1.0.1

----------

## sonicbhoc

It's probably a kernel configuration problem somewhere. What's your lspci and your kernel configuration look like?

----------

## devsk

```
$ lspci

00:00.0 Memory controller: nVidia Corporation CK804 Memory Controller (rev a3)

00:01.0 ISA bridge: nVidia Corporation CK804 ISA Bridge (rev a3)

00:01.1 SMBus: nVidia Corporation CK804 SMBus (rev a2)

00:02.0 USB Controller: nVidia Corporation CK804 USB Controller (rev a2)

00:02.1 USB Controller: nVidia Corporation CK804 USB Controller (rev a3)

00:04.0 Multimedia audio controller: nVidia Corporation CK804 AC'97 Audio Controller (rev a2)

00:06.0 IDE interface: nVidia Corporation CK804 IDE (rev a2)

00:07.0 RAID bus controller: nVidia Corporation CK804 Serial ATA Controller (rev a3)

00:08.0 RAID bus controller: nVidia Corporation CK804 Serial ATA Controller (rev a3)

00:09.0 PCI bridge: nVidia Corporation CK804 PCI Bridge (rev a2)

00:0a.0 Bridge: nVidia Corporation CK804 Ethernet Controller (rev a3)

00:0b.0 PCI bridge: nVidia Corporation CK804 PCIE Bridge (rev a3)

00:0c.0 PCI bridge: nVidia Corporation CK804 PCIE Bridge (rev a3)

00:0d.0 PCI bridge: nVidia Corporation CK804 PCIE Bridge (rev a3)

00:0e.0 PCI bridge: nVidia Corporation CK804 PCIE Bridge (rev a3)

00:18.0 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] HyperTransport Technology Configuration

00:18.1 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Address Map

00:18.2 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] DRAM Controller

00:18.3 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Miscellaneous Control

01:00.0 VGA compatible controller: nVidia Corporation NV43 [GeForce 6600 GT] (rev a2)

05:07.0 FireWire (IEEE 1394): Texas Instruments TSB43AB22/A IEEE-1394a-2000 Controller (PHY/Link)

```

which part of the kernel config do you want? its huge...:p

----------

## jburns

What file format is being used to write the CD/DVD.  Windows/Nero may have formated the CD/DVD to a windows only format.

----------

## PaulBredbury

Check the kernel's support:

```
$ grep ISO9660 /usr/src/linux/.config 

CONFIG_ISO9660_FS=y

$ grep JOLIET /usr/src/linux/.config 

CONFIG_JOLIET=y

grep UDF /usr/src/linux/.config 

CONFIG_UDF_FS=y

CONFIG_UDF_NLS=y
```

----------

## devsk

 *PaulBredbury wrote:*   

> Check the kernel's support:
> 
> ```
> $ grep ISO9660 /usr/src/linux/.config 
> 
> ...

 

Ack on these:

```
22:10:57 root@amd-pc ~

# grep ISO9660 /usr/src/linux/.config

CONFIG_ISO9660_FS=y

08:16:21 root@amd-pc ~

# grep JOLIET /usr/src/linux/.config

CONFIG_JOLIET=y

08:16:32 root@amd-pc ~

# grep UDF /usr/src/linux/.config

CONFIG_UDF_FS=y

CONFIG_UDF_NLS=y

```

----------

## devsk

 *jburns wrote:*   

> What file format is being used to write the CD/DVD.  Windows/Nero may have formated the CD/DVD to a windows only format.

 I don't think they can do that. It has to be ISO9660 or UDF. Everybody burns their first livecd using windows... :Smile:  And the CD/DVD has to be read and understood when there is no operating system (like while booting without anything on the hard disk).

----------

## albright

can you copy the cd/dvd in linux using dd or do you get

errors there too?

----------

## jburns

It's been a few years since I've used Nero to transfer files, but I have used Nero to burn a CD that I could not read on Linux (2.4 version) and I could not use that CD with Linux although with Windows I could read the CD as well as erase and rewrite the CD.  Nero supports a proprietary NRG format.  See http://en.wikipedia.org/wiki/Nero_Burning_ROM and http://en.wikipedia.org/wiki/NRG_%28file_format%29  Gemtoo has the nrg2iso package to convert a NRG image to an ISO image.

----------

## padoor

xp sp2   nero 8 and lower has problems writing to any cd not only udf

nero 7 only works with xp sp2

otherwise written data may not be readable in even other windows versions.

in kernel-   flesystems  we have to enable joilet , udf ,iso9660

even then k3b written udf cannot be read in incd of nero , in windows,

joilet and iso9660 are readable in any system if enabled in kernel

----------

## devsk

 *albright wrote:*   

> can you copy the cd/dvd in linux using dd or do you get
> 
> errors there too?

 no, dd fails with the same errors.

----------

## devsk

 *jburns wrote:*   

> It's been a few years since I've used Nero to transfer files, but I have used Nero to burn a CD that I could not read on Linux (2.4 version) and I could not use that CD with Linux although with Windows I could read the CD as well as erase and rewrite the CD.  Nero supports a proprietary NRG format.  See http://en.wikipedia.org/wiki/Nero_Burning_ROM and http://en.wikipedia.org/wiki/NRG_%28file_format%29  Gemtoo has the nrg2iso package to convert a NRG image to an ISO image.

 I know about NRG format but I never use it. I actually burnt an ISO not an NRG. And I also tried burning just plain data like photos.

I think I have figured the most likely explanation for this. It seems like linux is doing some sort of readahead on the disc and hitting the bad sectors. It is not very forgiving of the read errors. I know the written sectors (which have valid data) are not bad because while burning I asked k3b to verify the data written. I also verified that if I filled the disc to full, Nero under xp couldn't verify the disc because it hit read errors as well.

I think I just got very unlucky in getting hit by at least 2 or 3 bad discs (had some sectors bad) [ maxell dvd+rw, TDK DVD+R, GQ CD-R ], and every time xp read it fine while linux didn't. It took a random experiment of filling the whole RW disc to determine that there are bad sectors on it and even xp can't read it in that case.

Does this explanation make sense? Shouldn't the readahead be limited by the actual size of the data on the disc, rather than the "128kb more than the current location and whole 650MB is my playground", which may be outside the 200MB that's written and verified? The thing with read errors is that they put the drive in non-DMA mode after a while, and can't be cleared until repeated drop_caches is done. So, the readahead becomes a self-deprecating feature.

Does anyone know if there is a way to verify whole of DVD+R disc without burning it?

Or should I turn the readahead off on the drive with hdparm?

----------

## kimmie

I've been having the same sort of problem, although I've noticed it when trying to play audio CDs. As you say, the problem doesn't occur on all CDs, but on quite a few. Also, I'd be able to play the CD's, but only after the drive had spent a while doing some sort of retry/error recovery process which took a minutes and lots of seeking. In the logs, I'd see errors like this:

```
Jun  4 19:01:13 {kern,warning}  hdb: command error: status=0x51 { DriveReady SeekComplete Error }

Jun  4 19:01:13 {kern,warning}  hdb: command error: error=0x54 { AbortedCommand LastFailedSense=0x05 }

Jun  4 19:01:13 {kern,warning}  ide: failed opcode was: unknown

Jun  4 19:01:13 {kern,warning}  ATAPI device hdb:

Jun  4 19:01:13 {kern,warning}  Error: Illegal request -- (Sense key=0x05)

Jun  4 19:01:13 {kern,err}      Illegal mode for this track or incompatible medium -- (asc=0x64, ascq=0x00)

Jun  4 19:01:13 {kern,err}      The failed \"Read 10\" packet command was: 

Jun  4 19:01:13 {kern,warning}  \"28 00 00 00 00 00 00 00 08 00 00 00 00 00 00 00 \"

Jun  4 19:01:13 {kern,warning}  end_request: I/O error, dev hdb, sector 0

Jun  4 19:01:13 {kern,err}      Buffer I/O error on device hdb, logical block 0

Jun  4 19:01:13 {kern,err}      Buffer I/O error on device hdb, logical block 1

Jun  4 19:01:13 {kern,err}      Buffer I/O error on device hdb, logical block 2

Jun  4 19:01:13 {kern,err}      Buffer I/O error on device hdb, logical block 3

Jun  4 19:01:13 {kern,err}      Buffer I/O error on device hdb, logical block 4

Jun  4 19:01:13 {kern,err}      Buffer I/O error on device hdb, logical block 5

```

Your solution (disable filesystem read-ahead) works perfectly for me; a simple

```
# hdparm -a 0 /dev/hdb

```

and all the errors are gone. This has bugged me for quite a while. Good thinking, and many thanks!   :Razz: 

----------

