Re: ko/s, time to format a cdrw

Johnny Casey <[email protected]> Tue, 27 Sep 2005 18:25:09 -0500
Newsgroups gmane.linux.suse.packet-writing
Message-ID <[email protected]>
Le Gluon du Net wrote:
> 
> Ok, very good explanation. Chapeau! (hat) we say in french.
> 
> So why on my computer it takes more than 8 hours to burn a 500 mo file?
> More than 8 hour !!! and I didn't wait more, I stopped the copy.
> And if I try to copy 9 little files (9 files for a total of 2 mo) it
> takes 10 mn!!!
> It's slower than direct-cd and nero incd.
> Is it a normal speed?
> Someone has better performance packet writing with this drive?
> Thanks for your help and your work.
> 
> Le Gluon Du Net
> 
> My config:
> Debian testing/unstable - Knoppix

Are you running Knoppix from the CD?
What drive is Knoppix using, if so?

If Knoppix is running from CD and is at /dev/hdd, then you might just
see the 3KB/s speed you are getting.  The same might be true if you have
a hard disk (with the files on it) at /dev/hda and knoppix at /dev/hdb.
 The reason would be that the two drives would be in contention for the
IDE bus (/dev/hda and /dev/hdb on one bus and /dev/hdc and /dev/hdd on
another, etc. (Most computers come standard with 2 buses, but more can
be added with add-on cards)).  On top of that, Knoppix (or any LiveCD
system) can put a lot of strain on a system.  Memory helps there.  How
much swap/RAM do you have available?

If the above is not the case, from where are the files being copied? (A
serial line ;)

> NEC ND-3520A firmware:3.04
> /dev/pktcdvd/0=>/dev/hdc
> kernel 2.6.13
> udftools deb package v 1.0.0b3-10
> Pentium 4

Also, what connects your drives in your the computer?  (The motherboard?
 A dinky, ancient ISA multi I/O card?  A sound card?  A PCI card?  A mix?)

One way to test the raw speed of the writing mechanism is to use
/dev/zero for the source file.  It is best to do something like: (note:
'\' is a line continuation character.)

$ dd if=/dev/zero of=/a/file_where_ever_/dev/hdc_is_mounted bs=4K \
count=128000

That should create a file of zeros 500MB (= 4K(B) * 128000) in size.
You can additionally time the command by prefixing the command with
'time ' for example...

$ time dd if=/dev/zero of=/dev/null bs=4k count=128000
128000+0 records in
128000+0 records out
524288000 bytes transferred in 0.100023 seconds (5241670563 bytes/sec)

real    0m0.115s
user    0m0.016s
sys     0m0.072s

(The above just copies 500MB of '0' into nothing :)  The run time is
'real', while 'sys' is the time the program spent waiting for the system
to do something, like finish writing a block of data.  The output above
comes from the bash built in command 'time'.  Here is the result when
using /usr/bin/time:

$ /usr/bin/time dd if=/dev/zero \
of=/a/file_where_ever_/dev/hdc_is_mounted bs=4K count=128000
128000+0 records in
128000+0 records out
524288000 bytes transferred in 0.115599 seconds (4535401125 bytes/sec)
0.01user 0.08system 0:00.11elapsed 86%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+158minor)pagefaults 0swaps

$ /usr/bin/time --version
GNU time 1.7

This gives the same information and then some.  It might be helpful if
you could provide the output of this command while doing one of the
copies, even a small one.

Also, you should avoid doing anything else with the computer until you
can solve the 3KB/s write speeds, just to eliminate other variables.
Something is not right with your setup.

What does hdparm show?  For me, on my DVD RW... (run it as root)

# hdparm /dev/hdc

/dev/hdc:
 IO_support   =  1 (32-bit)
 unmaskirq    =  1 (on)
 using_dma    =  1 (on)
 keepsettings =  0 (off)
 readonly     =  0 (off)
 readahead    = 256 (on)
 HDIO_GETGEO failed: Invalid argument

The important bit is 'using_dma'.  You might want to check your other
IDE drives as well.  A hard drive should look something like this...

# hdparm /dev/hda

/dev/hda:
 multcount    = 16 (on)
 IO_support   =  0 (default 16-bit)
 unmaskirq    =  0 (off)
 using_dma    =  1 (on)
 keepsettings =  0 (off)
 readonly     =  0 (off)
 readahead    = 256 (on)
 geometry     = 38760/16/63, sectors = 39070080, start = 0

(These are from two different computers... but the idea should be
apparent.)  For example, a CD/DVD has no 'geometry' (it is just linear
sequence of sectors...), but they both have 'using_dma', 'unmaskirq',
'IO_support', 'readahead', 'keepsettings' and 'readonly' (never use
these last two unless you know *EXACTLY* what you are doing).

To change the 'using_dma' to 'on' for /dev/hdc, just type:

# hdparm -d 1 /dev/hdc

/dev/hdc:
 setting using_dma to 1 (on)
 using_dma    =  1 (on)

On older hardware (or blacklisted hardware) it should tell you that it
fails to set the flag.

Also, what does 'dmesg' say while you are doing the copies?

$ dmesg

and is syslogd (and klogd) running?

$ pstree

Will display a tree-like representation of the process hierarchy with
each level of processes listed in alphabetical order.  Since syslogd and
klogd usually run attached to 'init' or the root of the tree, they will
be against the left edge of the screen.

Are any log files in /var/log increasing in size?

$ ls -ltr /var/log

Will list the most recently updated files last.

$ ls -sSr /var/log

Will list the largest files last and display the size in KB of each
file.  The values will increase from left to right and top to bottom if
more than one column appear.  Adding '-1' (the number one) will force a
single column, but not so useful.  Adding '-h' will make the output
append 'K' or 'M' or 'G' (shudder) for the file sizes, interesting but
harder to spot the big ones.

Cheers,
Johnny