[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

cp oddity

From: Adrian Revill
Subject: cp oddity
Date: Thu, 16 Apr 2009 09:22:19 +0100
User-agent: Thunderbird (Windows/20090302)


I am not sure if this is a bug, but would appreciate some advise.
If i use a single cp to copy multiple files, then read the files in inode order. I see faster disk access times than if i copy each file individually.

I am using inode order as i have already determined that this drastically reduces the read times.

Any ideas?

Does anyone know the difference between copying multiple files in one cp command and copying the same files with multiple cp commands?

The set up is this:

A single disk freshly formatted with ext3 and mounted noatime, nodiratime on /test A set of test files, 13000 files avg 200KB, named numericaly 1 to 13000, written in pseudo random order in one directory (A) kept on a separate drive mounted on /data

The test:
# copy recursivly using cp
cp -a /data/A /test/

#copy all the files in A using cp
mkdir /test/B
cp /data/A/* /test/B

#copy one file at a time in directory order
mkdir /test/C
for f in `ls -U /data/A`; do cp /test/A/$f  /test/C; done

#copy one file at a time in file name order
mkdir /test/D
for f in `ls /data/A`; do cp /test/A/$f  /test/D; done

#copy from D using a single cp command
mkdir /test/E
cp /test/D/* /test/E

umount /test
mount /test

Now for each directory list files using ls -i, sort by inode number and in a loop cat to /dev/null

/test/A takes 43s
/test/B takes 43s
/test/C takes 1m49s
/test/D takes 1m49s
/test/E takes 43s

I have run these tests in different orders and always get the same results, even tried reformatting between each test.


This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email ______________________________________________________________________

reply via email to

[Prev in Thread] Current Thread [Next in Thread]