Fast File Copy - Linux!

January 25, 2008 07:49 by bjones

 

All good ideas come out of necessity.  We were cloning an instance of Oracle Financials from one server to another.  There are a LOT of files under < 1k and the copy takes forever.  Yesterday the copy was kicked off using SCP - there was 39GBs to copy over a gigabit switch.  This should have been less than 10 minutes but actually took over 8 hours because of all the small files.  The copy failed and we needed to fix the problem and copy it a lot faster (30 minutes) today.

 

 After clearing up 10 GBs of log files, we were left with hundreds of thousands of small files that were going to slow us down.  We couldn't tarball the file because of a lack of space on the source server.  I started searching around and found this nifty tip that takes our encryption and streams all the files as one large file:

This requires netcat on both servers.

Destination box: nc -l -p 2342 | tar -C /target/dir -xzf -
Source box: tar -cz /source/dir | nc Target_Box 2342

It's been about 4 minutes and I'm already 1/3 of the way done!


Currently rated 3.1 by 32 people

  • Currently 3.125/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Tags:
Categories: Code Monkey | SysAdmin
Actions: E-mail | Permalink | Comments (7) | Comment RSSRSS comment feed

Comments