LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 04-08-2008, 07:56 AM   #1
xxxx
LQ Newbie
 
Registered: Aug 2007
Posts: 18

Rep: Reputation: 0
copying a huge amount of small files, on a live system


hi,

i have the following scenario:

<start>
one live fileserver, wich serves millions of small jpg files (photos) with lighty for a big website.
like 400GB of .jpg files in different folders.

and one backup server with a 500gb hdd in the same network with a mounted nfs share from the live server.

i have to copy the whole content from live to backup, without the possibility to take the live server offline.
</start>

When i start rsync on the backup, it takes ages til it starts to copy, and the cpu load is 100%, site will go offline.

When is start cp /live /backup its the same - offline.

the best would be to copy it immediately but only in like 20 files parts.

is that possible? or any other suggestions?


best regards, and thanks!

Sascha
 
Old 04-08-2008, 09:34 AM   #2
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
Perhaps try running your copy/backup process with an elevated nice level. For more info:

man nice


--- rod.
 
Old 04-08-2008, 09:46 AM   #3
helptonewbie
Member
 
Registered: Aug 2006
Location: England Somewhere
Distribution: Mandriva, PCLinuxOS, Karoshi, Suse, Redhat, Ubuntu
Posts: 518

Rep: Reputation: 39
i would certainly go with that suggestion...i do this myself what i run is:-
nice -n 20 rsync .....

ps- priorities are -19 highest priority tooo ---> 20 lowest priority. You must be root user to increase (higer priority) but any user can lower priority for a command.

Regards
 
Old 04-08-2008, 03:43 PM   #4
xxxx
LQ Newbie
 
Registered: Aug 2007
Posts: 18

Original Poster
Rep: Reputation: 0
hi, thanks a lot for the answers.

i allready gave nice a try, but the cpu does still raise up to 100%...
well, the server always has lot of work to do...

i think it would be the best to copy parts of the files...but how can i do that?

regards
 
Old 04-08-2008, 03:56 PM   #5
forrestt
Senior Member
 
Registered: Mar 2004
Location: Cary, NC, USA
Distribution: Fedora, Kubuntu, RedHat, CentOS, SuSe
Posts: 1,288

Rep: Reputation: 99
Just a note, there isn't really anything wrong with a high cpu load. If the nice value of a process is 20 and it is taking up 100% of the cpu then that just means that nothing else important is needing the processor. Instead of worrying about the cpu load with the copy at nice=20 what is the actual response like from the system?

HTH

Forrest

p.s. What is putting the files on the server? Can it also put them in the correct backup location?

Last edited by forrestt; 04-08-2008 at 03:57 PM.
 
Old 04-08-2008, 05:27 PM   #6
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,340

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
Quote:
Originally Posted by xxxx View Post

hi, thanks a lot for the answers.

i allready gave nice a try, but the cpu does still raise up to 100%...
well, the server always has lot of work to do...

i think it would be the best to copy parts of the files...but how can i do that?

regards
The bottleneck is probably not the CPU. It is more likely the amount of disk I/O or the disk cache being flooded by rsynch or cp. You might be able to reduce the amount of I/O by only copying files that have changed. Use the same /backup directory or directories over and over again. Then use rsynch -u to only copy the files that have changed. Similarly if you use:

cp -u /live /backup

then cp will only copy the files that have changed since the last backup.

--------------------------
Steve Stites
 
Old 04-08-2008, 09:09 PM   #7
beadyallen
Member
 
Registered: Mar 2008
Location: UK
Distribution: Fedora, Gentoo
Posts: 209

Rep: Reputation: 36
This is more of a question really, but would it be better to tar up the files before you copy it across the network. It seems to me that would save a lot of requests from cp through nfs, which might be the bottleneck. As I said, I'm not sure. I suppose you'd also need a way to create the backup archive (maybe a cron job on the server?).
Comments appreciated.
 
Old 04-09-2008, 02:12 AM   #8
xxxx
LQ Newbie
 
Registered: Aug 2007
Posts: 18

Original Poster
Rep: Reputation: 0
hi, thanks for all the answers.

i could give tar a try, but i dont have enough space left and i think, it will make the server unavailable till its finished?

Jailbait: you are right, the I/O wait keep the server down, not the CPU load!

Forrest: Users do that (so apache with php), its a big community site, where ppl can upload images - and they do it a lot!


I need a "backup basis" first, with the up to date state.
then it will be not a problem to do a copy -u /live /backup since it will only take a few minutes.

how about a for or a while loop with a file limit? is that possible?

regards

Last edited by xxxx; 04-09-2008 at 02:14 AM.
 
Old 04-09-2008, 06:01 AM   #9
forrestt
Senior Member
 
Registered: Mar 2004
Location: Cary, NC, USA
Distribution: Fedora, Kubuntu, RedHat, CentOS, SuSe
Posts: 1,288

Rep: Reputation: 99
How about changing the php code to write the file to both locations but only removing it from the web server, not the backup location?

HTH

Forrest
 
Old 04-09-2008, 06:37 AM   #10
xxxx
LQ Newbie
 
Registered: Aug 2007
Posts: 18

Original Poster
Rep: Reputation: 0
yeah that would be a solution if i allready have the backup up to date, but i need to copy 400GB NOW.

S.
 
Old 04-09-2008, 08:30 AM   #11
forrestt
Senior Member
 
Registered: Mar 2004
Location: Cary, NC, USA
Distribution: Fedora, Kubuntu, RedHat, CentOS, SuSe
Posts: 1,288

Rep: Reputation: 99
You could try (I'm going off of the locations you had in your first post, fix as needed):
Code:
cd /
tar -cf - /live| (cd /backup ; tar -xvf -)
HTH

Forrest
 
Old 04-09-2008, 09:49 AM   #12
xxxx
LQ Newbie
 
Registered: Aug 2007
Posts: 18

Original Poster
Rep: Reputation: 0
going to give it a try! thanks a lot
 
Old 04-15-2008, 02:53 AM   #13
xxxx
LQ Newbie
 
Registered: Aug 2007
Posts: 18

Original Poster
Rep: Reputation: 0
got the solution.

nice, ionice, rsync
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Huge amount of "PHP Notice:" -> huge logs Braynid Linux - Software 4 03-18-2008 06:35 AM
Move huge amount of folders with bash alexweb Linux - Newbie 4 10-27-2006 04:06 AM
Problem copying large amount of files from IDE external case in Fedora C4 TruthSeeker Linux - Newbie 8 10-26-2005 02:04 AM
PHP: huge functions file vs multiple small files carlosruiz Programming 2 06-14-2005 03:06 AM
Huge amount of stuff needs to be listed but how? Totoro Linux - Newbie 2 03-20-2004 02:10 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:24 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration