DSL Tips and Tricks :: Faster Copy ?



Still can't figure out why linux is so slow copying large files between FAT32 disks (?)

But using the dd command does help (approx 1.7x);

~/tools/fastcopy.sh

Code Sample

#!/bin/bash
# A faster copy using dd
#
# Add this button command in EmelFM
#  aterm -e /$HOME/tools/fastcopy.sh %f %D

echo copying..
echo "            " $1
echo "          to" $2

dd if="$1" of="$2/$1" bs=5M

echo hit return..
read

# * only use for 1 file at a time *

Do you have DMA turned on for the drives?

Either boot with

dsl dma

or type:

sudo su
hdparm -d1 /dev/hda
hdparm -d1 /dev/hdb

etc after bootup

yep, dma was confirmed in the boot msgs :D
but there seems to be a lot of thrashing going on.
these are two seperate disk drives.

Is a second write of the same file (made straight after the first) to the same disk much faster?

As you probably know, Linux tries to maximise its use of memory, partly by caching disk writes to memory, so subsequent disk writes of the same file should be fast.

2nd write is defintely faster. (but why would i do that?)
it's the 1st write i'm interested in, cos i have large files to get from
one disk to another. typically 300 to 700mb (and i only want to copy them once).

so anyway, i just loaded up a virgin copy of dsl2.4, nothing else added,
and here are the timings for 1st copies straight after each re-boot.

file 1 = 319100928 bytes
'cp'=30 secs    'dd'=15 secs    XP=8 secs

file 2 = 565446002 bytes
'cp'=85 secs    'dd'=35 secs    XP=15 secs

'dd' was using a 5Mb bucket size.
emelFM standard copy has the same time as a bash 'cp' command.
XP using the windows explorer.

i didn't really want to compare this with windoze, but i'm curious to what the trick is. windoze is nearer to the 40 mbyte/sec performance i expect between two seperate HDs, they both run at dma100 and was checked with hdparm (udma5).

obviously the cp performance on linux got worse for the larger file.
there was a lot of disk thrashing, maybe the caching? maybe too small a bucket? maybe some other background task?, though i made sure nothing else was going on.

Next Page...
original here.