# Very slow DVD writing

## Masavishnu

For some reason, I'm not able to write DVDs at a decent speed. Growisofs only burns them at about 0.4x. Any suggestions how I could improve the speed? DMA should be enabled as shown below.

I'm using the kernel 2.6.16-gentoo-r13.

```
# hdparm -cuda /dev/hdb

/dev/hdb:

 IO_support   =  1 (32-bit)

 unmaskirq    =  1 (on)

 using_dma    =  1 (on)

 readahead    = 256 (on)
```

I had to set the IO_support and unmaskirq settings manually. They were both set to 0 by default.

```
# lspci|grep -i ide

00:1f.1 IDE interface: Intel Corporation 82801G (ICH7 Family) IDE Controller (rev 02)
```

I've enabled Intel PIIXn chipsets support in kernel config. I suppose that's what I ought to be using.

----------

## frostschutz

DMA needs to be enabled not only for the DVD writer, but also for the drive that acts as a data source (hard disk, or cd drive when copying on the fly). To verify wether it's enabled or not, the easiest thing to do would be a simple read-only speed test, for example using 'hdparm -Tt <device>'. You'll have to put a data disc into the DVD writer in order to be able to run this test. The source drive as well as the writer itself should provide a decent speed (for example, 4x DVD writing requires something around ~5-6MB/s). In case of IDE, data source and dvd writer should not be on the same channel (sharing one IDE cable). Only one of the two IDE devices can be accessed at a time, which will cut your performance, as one drive always has to wait for the other to finish its current transfer segment.

If your benchmark results in decent speeds, DMA should be ok. In this case you should check wether the media you are using is on the compatibility / recommendations list of your writer. There is a lot of cheap, low quality, and even fake media floating around nowadays, as well as picky writers. In any case, buying a sample or two of other brands may be worth testing.

----------

## Masavishnu

 *frostschutz wrote:*   

> DMA needs to be enabled not only for the DVD writer, but also for the drive that acts as a data source (hard disk, or cd drive when copying on the fly). To verify wether it's enabled or not, the easiest thing to do would be a simple read-only speed test, for example using 'hdparm -Tt <device>'. You'll have to put a data disc into the DVD writer in order to be able to run this test. The source drive as well as the writer itself should provide a decent speed (for example, 4x DVD writing requires something around ~5-6MB/s). In case of IDE, data source and dvd writer should not be on the same channel (sharing one IDE cable). Only one of the two IDE devices can be accessed at a time, which will cut your performance, as one drive always has to wait for the other to finish its current transfer segment.

 

```
# hdparm -cadu /dev/hda

/dev/hda:

 IO_support   =  0 (default 16-bit)

 unmaskirq    =  0 (off)

 using_dma    =  1 (on)

 readahead    = 256 (on)
```

This looks rather similar to what I got on my DVD drive. I'm using a laptop, so I have little choice over the channel that I use. Anyhow, it works swell on Windows, which makes me think the problem lies within software configuration. In any case, I ran the benchmark:

```
# hdparm -Tt /dev/hdb

/dev/hdb:

 Timing cached reads:   4308 MB in  2.00 seconds = 2158.97 MB/sec

 Timing buffered disk reads:   10 MB in  3.27 seconds =   3.06 MB/sec
```

I don't know what I should make of this, but there's the result. Much faster than the 0.4x I've been experiencing when burning.

 *Quote:*   

> If your benchmark results in decent speeds, DMA should be ok. In this case you should check wether the media you are using is on the compatibility / recommendations list of your writer. There is a lot of cheap, low quality, and even fake media floating around nowadays, as well as picky writers. In any case, buying a sample or two of other brands may be worth testing.

 

The media can't be the problem as it works well under Windows and Nero. It's but a configuration issue. I shall look into the possibility of altering hdparm settings with the HDD.

Edit: I benchmarked /dev/hda and it gave me 33 MB/s. Sounds rather low, imo. The HDD should perform better.

----------

## Masavishnu

I've tried to fiddle with hdparm, and I think I've got optimal settings. I've enabled UDMA5 on the HDD and UDMA2 on the DVD burner. Yet the problem remains.

I really do need the burner, and I wouldn't like to wait half an hour for a couple of hundred MBs. Also, since the drive works well under Windows as I pointed out, it's bound to be a configuration issue. I'd appreciate any help.

----------

## Gentree

 *Quote:*   

> Edit: I benchmarked /dev/hda and it gave me 33 MB/s. Sounds rather low, imo. The HDD should perform better.

  use hdparm -I and google the model , it is probably a 5400 rpm disk.

what are you tring to burn and with what tools?  :Cool: 

----------

## clintpatty

I'm with Gentree on thinking that it's probably a burning app configuration prob and not drive configuration.

----------

## Masavishnu

 *Gentree wrote:*   

>  *Quote:*   Edit: I benchmarked /dev/hda and it gave me 33 MB/s. Sounds rather low, imo. The HDD should perform better.  use hdparm -I and google the model , it is probably a 5400 rpm disk.

 

It turns out that it is a 4200 rpm Seagate model. Specifically, ST9100825A.

 *Gentree wrote:*   

> what are you tring to burn and with what tools? 8)

 

Files and preprepared DVD images with growisofs (and k3b).

edit: The command I've been using would be as follows: growisofs -Z /dev/dvdrw -J -R somefiles

The very same command works well on another computer of mine.

----------

## Gentree

 *Quote:*   

> growisofs -Z /dev/dvdrw -J -R somefiles

 

That's fine, is there nothing in the output refering to speed or problems with the recording medium?

 :Cool: 

----------

## Masavishnu

 *Gentree wrote:*   

> That's fine, is there nothing in the output refering to speed or problems with the recording medium?
> 
>  8)

 

None.

Here is some example output:

```
$ growisofs -Z /dev/dvdrw -J -R carmina_burana_05_-_cour_d\'amours.flac

WARNING: /dev/dvdrw already carries isofs!

About to execute 'mkisofs -J -R carmina_burana_05_-_cour_d'amours.flac | builtin_dd of=/dev/dvdrw obs=32k seek=0'

 11.13% done, estimate finish Sat Aug 26 03:31:08 2006

 22.27% done, estimate finish Sat Aug 26 03:31:12 2006

 33.36% done, estimate finish Sat Aug 26 03:31:10 2006

/dev/dvdrw: "Current Write Speed" is 2.5x1385KBps.

 44.50% done, estimate finish Sat Aug 26 03:31:55 2006

 55.60% done, estimate finish Sat Aug 26 03:32:36 2006

 66.73% done, estimate finish Sat Aug 26 03:32:54 2006

 77.83% done, estimate finish Sat Aug 26 03:33:11 2006

 88.96% done, estimate finish Sat Aug 26 03:33:18 2006

Total translation table size: 0

Total rockridge attributes bytes: 279

Total directory bytes: 0

Path table size(bytes): 10

Max brk space used 21000

44979 extents written (87 MB)

builtin_dd: 44992*2KB out @ average 0.4x1385KBps

/dev/dvdrw: flushing cache

/dev/dvdrw: stopping de-icing

/dev/dvdrw: writing lead-out

/dev/dvdrw: reloading tray
```

----------

## Gentree

OK it seems to start at 2.5x and ends up at 0.4x , that would again suggest media probs.

Do you have any CDs or other media to try?

How old is the writer? You could test that it reads OK by reading an audio CD with cdparanoia and see how much rereading it does.

 :Cool: 

----------

## frostschutz

I use this command for burning stuff with growisofs under heavy load conditions (as root):

```
(nice -n -5  mkisofs -r -J -allow-multidot -graft-points -- "file1" "file2" "file3") | \

(nice -n -10 bfr -b 128m -p -i 100% -m 10% -t 120 -T 95%) | \

(nice -n -15 growisofs -dvd-compat -Z /dev/dvdrw=/dev/fd/0)
```

You can have this a bit more comfortable as a shell script http://www.metamorpher.de/files/burn-dvd-fly.sh and http://www.metamorpher.de/files/burn-dvd-image.sh (use at your own risk). You'll have to edit these to set variables like your DVD writer device etc.

This adds nice priorities (to prevent slowdown due to CPU load) and adds a 128MB software buffer. To my knowledge, growisofs doesn't have a buffer on it's own like cdrecord does, so it relies on fast nonstop disk performance. Additional prioritizing using ionice is still missing, as I just recently stumbled over this possibility.

I suggest you try burning once with a command like this, not because I think it will solve your problem, but because it might help in identifying it. Especially the bfr program is useful here - it will tell you how well the buffer is filled. If your low write speed is caused by bad hard disk performance, this buffer will be empty (or at least not properly filled most of the time). If the buffer is full and the write speed is still  in the low, your dvd writer / media is at fault.

----------

## Masavishnu

 *Gentree wrote:*   

> OK it seems to start at 2.5x and ends up at 0.4x , that would again suggest media probs.

 

2.5x is a nominal speed it tries to write at. It just can't reach it.

 *Gentree wrote:*   

> Do you have any CDs or other media to try?

 

I just took a fresh DVD+RW disc and tried writing some 700 MB worth of data on it. No improvement -- I cancelled after 15 minutes or so. I then booted to Windows and tried writing with Nero. It was ready in about 3 minutes.

 *Quote:*   

> How old is the writer? You could test that it reads OK by reading an audio CD with cdparanoia and see how much rereading it does.
> 
>  8)

 

Quite new. It came with this laptop when I bought it in June. I'll try doing that next along with what frostschutz just suggested.

----------

## Masavishnu

Right. I tried reading an audio CD with cdparanoia. It didn't seem to report any read errors.

I'm now burning with the script. It seems to report the buffer to be full, if I 'm reading the output properly. Oddly enough, the writing speed seems to be at around 1.5x at times, but then it might suddenly drop to as low as 0.2x for a moment.

edit: So there must be a configuration issue somewhere because the same media and drive work perfectly on Windows.

edit: Also, with this script, there seems to be considerable rise in performance albeit not to the desired levels.

----------

## frostschutz

So for some reason, the system cannot transfer data (which is already read into memory, so it can't be the hard disk) to the writer fast enough, as if the device was not actually using DMA. So it's either misconfigured in some way or your IDE chipset is not correctly supported.

----------

## Gentree

 *Quote:*   

> I've enabled Intel PIIXn chipsets support in kernel config. I suppose that's what I ought to be using.

 

maybe you should firm up on that. Try booting from liveCD and lsmod to see if you have guessed right.

also what drive do you have exactly? hdparm -I   :Cool: 

----------

## Masavishnu

 *Gentree wrote:*   

> maybe you should firm up on that. Try booting from liveCD and lsmod to see if you have guessed right.

 

Let's see. I'm rather unsure about most modules, so I'll just paste all except those I know to be unrelated (e.g. IEEE1394, USB, bluetooth and SATA modules):

```

yenta_socket           19084  0

rsrc_nonstatic          9472  1 yenta_socket

dm_mirror              15440  0

dm_mod                 37784  1 dm_mirror

pdc_adma                7172  0

ata_piix                7428  0

ahci                   10116  0

libata                 36104  15 pdc_adma,sata_mv,ata_piix,ahci,sata_qstor,sata_vsc,sata_uli,sata_sis,sata_sx4,sata_nv,sata_via,sata_svw,sata_sil24,sata_sil,sata_promise

sbp2                   17412  0

sl811_hcd              10240  0

```

ata_piix sounds like something in that direction.

 *Quote:*   

> also what drive do you have exactly? hdparm -I  8)

 

```
rover:/home/masa# hdparm -I /dev/hdb

/dev/hdb:

ATAPI CD-ROM, with removable media

        Model Number:       TSSTcorpCD/DVDW TS-L632C

        Serial Number:      36WP502356

        Firmware Revision:  AS07

Standards:

        Used: ATAPI for CD-ROMs, SFF-8020i, r2.5

        Supported: CD-ROM ATAPI-2

Configuration:

        DRQ response: 50us.

        Packet size: 12 bytes

Capabilities:

        LBA, IORDY(can be disabled)

        Buffer size: 2048.0kB

        DMA: mdma0 mdma1 mdma2 udma0 udma1 *udma2

             Cycle time: min=120ns recommended=120ns

        PIO: pio0 pio1 pio2 pio3 pio4

             Cycle time: no flow control=120ns  IORDY flow control=120ns

Commands/features:

        Enabled Supported:

           *    NOP cmd

           *    DEVICE RESET cmd

           *    PACKET command feature set

           *    Power Management feature set

           *    Mandatory FLUSH CACHE command

HW reset results:

        CBLID- above Vih

        Device num = 1 determined by CSEL
```

----------

## quag7

This could be way off but I'll throw it out - have you tried running this as root with nice -19 ?

May not matter at all, but it's something I'd try...

----------

## Masavishnu

 *quag7 wrote:*   

> This could be way off but I'll throw it out - have you tried running this as root with nice -19 ?

 

I've tried that, but it did no good. The problem isn't with CPU load.

----------

## Gentree

you dont say whether what you posted was your current installation or a liveCD. If you have not already I suggest you try a CD , see if it can burn at correct speed and if so lsmod to find what you're missing.

I have a different mobo but I just grepped my kernel config :

```

bash-3.1#grep -i  piix .config

# CONFIG_BLK_DEV_PIIX is not set

# CONFIG_SCSI_PATA_MPIIX is not set

# CONFIG_SCSI_PATA_OLDPIIX is not set

# CONFIG_SCSI_ATA_PIIX is not set

# CONFIG_I2C_PIIX4 is not set

```

CONFIG_BLK_DEV_PIIX is probably the one you want but I'd build them all as modules and see if they get  loaded.

again a liveCD is probably the quickest way to find what's missing.

 :Cool: 

PS reading back at your output, what's all the sata stuff? Have you modprobed all those different sata modules by hand? Your HD is a Seagate ATA/100 , is the burner SATA??

----------

## Masavishnu

 *Gentree wrote:*   

> PS reading back at your output, what's all the sata stuff? Have you modprobed all those different sata modules by hand? Your HD is a Seagate ATA/100 , is the burner SATA??

 

All that stuff came from the LiveCD. I'm confident that I'm using the right driver, and neither of those is SATA; the LiveCD just wanted to load those modules for some reason.

I'll try burning with it later today when I have the chance.

----------

## bakaohki

Same here, drive worked okay before full gentoo rebuild, no problem with hdparm or hardware. Media is same box as before. I suspect k3b or growisofs, the latter has better chances.

----------

## NeddySeagoon

Masavishnu,

I see the warning signs in your first post where you say 

```
ICH7
```

Tell us about your hard drive, is it SATA or IDE?

ICH6 and ICH7 chip sets can be difficult with mixed (SATA & IDE) systems.

----------

## Masavishnu

 *NeddySeagoon wrote:*   

> Tell us about your hard drive, is it SATA or IDE?
> 
> ICH6 and ICH7 chip sets can be difficult with mixed (SATA & IDE) systems.

 

It's a PATA drive, I suppose (note: SATA, too, is IDE. I've been told this a number of times on another forum). UDMA 100 drives cannot be SATA, or can they? Also, I always thought SATA devices would be visible as sda etc. rather than hda.

----------

## NeddySeagoon

Masavishnu,

What data rate do you get from your hard drive ?

Setting DMA on for the PATA interface is not straightforward on the ICDH6 and ICH7

```
hdparm -tT /dev/hdX
```

will show it, when you have no other disk activity.

----------

## Masavishnu

 *NeddySeagoon wrote:*   

> What data rate do you get from your hard drive ?
> 
> Setting DMA on for the PATA interface is not straightforward on the ICDH6 and ICH7
> 
> ```
> ...

 

There seems to have been little change since the last time I ran it.

```
# hdparm -tT /dev/hda

/dev/hda:

 Timing cached reads:   4216 MB in  2.00 seconds = 2111.08 MB/sec

 Timing buffered disk reads:  100 MB in  3.01 seconds =  33.26 MB/sec
```

----------

