The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Script to copy log files with today's date mdncan Shell Programming and Scripting 3 12-30-2008 02:14 PM
Script required to copy and delete files srnagu Shell Programming and Scripting 3 12-30-2008 02:49 AM
copy similar files only both at different locations using script. fed.linuxgossip Shell Programming and Scripting 1 11-23-2007 04:02 AM
Urgent !!! Shell script to copy files to VSS devalin Shell Programming and Scripting 1 08-20-2007 06:16 AM
copy files without password in script jwala Shell Programming and Scripting 0 02-12-2006 01:10 PM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 2 Weeks Ago
davidstvz davidstvz is offline
Registered User
  
 

Join Date: Nov 2009
Posts: 4
Trying to copy a TON of files with a script

Ok, here's the problem. I need to copy about 200 GB from an old FreeBSD (5.2.1) server to a new Debian server. The old server's fastest port is the ethernet port. I set up an NFS server on the new machine so I can just copy the files over using regular commands/scripts etc. Thing is, I probably shouldn't copy dozens of GB of files using the 'cp' command. The last time I tried that it crashed the server.

My plan is to write a script that will process a list of files copying each file from the list one at a time (while making a separate list of files successfully copied that way if anything goes wrong, I can difference the two lists and pick up where it left off). More importantly, I can copy all files ahead of time and then generate a smaller list of files modified since the original copy so that on migration day I have a minimal number of files to copy minimizing downtime.

The main problem (that I can see) with this is, any list I generate will contain both files and folders, but the folders don't need to be copied, only recreated with identical owners and permissions. Unless there is a flag for the 'cp' command that copies a folder without it's contents (not that I know of), I need to find some other way to test each path to see what it is, then if it is a directory, somehow find the permissions and owner and duplicate it on the new server.

If anyone has any advice, can see any other problems or knows of a better way I might do this, I'd appreciate the help. Thanks!
  #2 (permalink)  
Old 2 Weeks Ago
mkastin mkastin is offline
Registered User
  
 

Join Date: Jun 2009
Posts: 32
sounds to me like you want to use rsync
  #3 (permalink)  
Old 2 Weeks Ago
davidstvz davidstvz is offline
Registered User
  
 

Join Date: Nov 2009
Posts: 4
wow, that's exactly what I want. I'm always trying to reinvent the wheel it seems

I installed rsync on my Debian box (the FreeBSD already had it) and then ran this from the BSD box:

rsync -r -H -p -o -g -t -v -e ssh /users4 root@myserver.domain:/

Everything seems to be working great. And I can't believe it actually compares parts of files. That will make transferring the large mail files so much easier. I'll have the server migrated in less than an hour during lunch with this tool
  #4 (permalink)  
Old 2 Weeks Ago
TonyLawrence TonyLawrence is offline
Registered User
  
 

Join Date: Sep 2007
Location: SE Mass
Posts: 137
Yes, rsync is wonderful.

Now that you know that, take a look at Rsnapshot, which uses rsync to create backup sets. I found the docs a little confusing so I wrote Using Rsnapshot

Mac OS X uses a scheme just like this for their Time Machine backups. They have a few tricks rsnapshot lacks, but the basic idea is the same and it's definitely a convenient scheme - thanks to rsync!
  #5 (permalink)  
Old 2 Weeks Ago
davidstvz davidstvz is offline
Registered User
  
 

Join Date: Nov 2009
Posts: 4
Ok, that's even more awesome! I will definitely bookmark that and take a look once the new machine is up and running. Incremental backups would be wonderful.
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:41 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0