Operating System - HP-UX
1752723 Members
6568 Online
108789 Solutions
New Discussion юеВ

"mv" commands runs too slow

 
Yu Zhen
Occasional Advisor

"mv" commands runs too slow

I am running an application, which needs to move massive files from one directory to another. But the speed was too slow, about 2,000files/hour. These files are very small like some kilobytes. Any idea?
12 REPLIES 12
Ravi_8
Honored Contributor

Re: "mv" commands runs too slow

what's the u r RAM and swap size, if less try increasing both.
never give up
Yu Zhen
Occasional Advisor

Re: "mv" commands runs too slow

ravi, I have got 6G memory and 10G swap space on a V2250 box, the storage is FC60.
I think the HW is sufficient for such a simple action,but the performance is really unbearable.
Thierry Poels_1
Honored Contributor

Re: "mv" commands runs too slow

Hi,

are you really MOVING the files i.e. to another disk?
if you 'move' the files on the same disk they are simply renamed which is done a lot faster.
regards,
Thierry.
All unix flavours are exactly the same . . . . . . . . . . for end users anyway.
Paula J Frazer-Campbell
Honored Contributor

Re: "mv" commands runs too slow

Hi

How are you doing the move with "mv", if so try a copy then remove.

Also run sar and look at CPU / Disk and Swap whilst it is going on.

Paula
If you can spell SysAdmin then you is one - anon
Yu Zhen
Occasional Advisor

Re: "mv" commands runs too slow

Hi, Paula
I can't quite catch your idea. The CPU and swap usage are low, and why shall i make a copy and then remove them?
Vincenzo Restuccia
Honored Contributor

Re: "mv" commands runs too slow

Check inodes frees with
#sar -v 5 5
and your maxusers kernel parameter.
Klaus Crusius
Trusted Contributor

Re: "mv" commands runs too slow

I observed similar performance degradations, when there were simply too many files (~20000) in source of traget directory.
There is a live before death!
Paula J Frazer-Campbell
Honored Contributor

Re: "mv" commands runs too slow

Hi

A move command copies the file and removes the old so if doing a mv on many files :-
cp
rm
cp
rm etc for x times

whereas a copy of all first and go back and remove all=

cp all
rm all

far less jumping from dir to dir so therefire quicker.


Paula
If you can spell SysAdmin then you is one - anon
Deepak_5
Advisor

Re: "mv" commands runs too slow

Hi,

I feel that mv is always faster than copy.
Only reason, mv would be slow if you are
moving files across filesystem.

Just an additional info, the inode number
changes only when a file is moved across file
system.
It remains unchanged, if it is within the same
filesystem.
One can verify by using ls -il command on that file.

mv uses rename() system call, if it fails, uses
copy routine(basicailly reads from a file and writes in another file).

This is what I feel, hope it helps.

Thanks and Regards
Deepak