易截截图软件、单文件、免安装、纯绿色、仅160KB

linux下的fastcopy

在拷贝数据的时候,如果遇到一堆小文件,即使总数据量很小,拷贝也会很费时,在win下,有一个软件叫fastcopy,可以实现快速拷贝,据说使用了一种叫内存映射的技术,那么在Linux下有没有呢?
我找了半天,原来LInux下根本不需要单独的软件,用现有的命令组合就OK了!
有高手在两个服务器间传数据,使用命令,实现了快速传送数据。
http://www.4bcj.com/post/2008/01/Fast-File-Copy—Linux!.aspx
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!
感谢本校LInux版主ashmer,写了这个shell脚本,可以实现fastcopy, 与诸位共享.
#!/bin/sh
# file: fastcp.sh
source="$1"
target="$2"
if [ "x$1" == "x" ] || [ "x$2" == "x" ] ; then
echo "$0 SOURCE_DIR TARGET_DIR"
exit 1
fi
exec tar -cp "$source" -f - | tar -xpv -C "$target" -f -
#end
PS: 测试了一番,速度竟然由cp的0m21.270s降低至0m6.984s,真是够快的。。。


相关文档:

Linux Shell编程step by step 文本文件最后两行相减

作者:fbysss
msn:jameslastchina@hotmail.com 
blog:blog.csdn.net/fbysss
声明:本文由fbysss整理编写,转载请注明出处
关键字:shell编程
背景
        同事求助。
需求
      一个文本文件,要得到最后一行与倒数第一行相减的结果。
测试文 ......

Linux diff与patch的深入分析

Linux diff与patch的深入分析
http://blog.csdn.net/vrix/archive/2009/08/25/4483906.aspx
diff的输出格式分为传统格式和统一格式
1)diff的传统格式输出.
############################################
cat before.txt
输出:
This is a line to be deleted
This is a line that will be changed
This is a line ......

Linux RCU机制详解

原文网址:http://blog.chinaunix.net/u1/51562/showart_1341707.html
 
一:前言
RCU机制出现的比较早,只是在linux kernel中一直到2.5版本的时候才被采用.关于RCU机制,这里就不做过多的介绍了,网上有很多有关RCU介绍和使用的文档.请自行查阅.本文主要是从linux kernel源代码的角度.来分析RCU的实现.
在讨论RCU的实 ......

Linux C notes (BOOK UNIX)

Chapter 1: Thread
① thread functions
1. pthread_self();
2. thread existing
    you can get the value of rval_ptr just by  pthread_join(pthread_t tht, void ** rval_ptr)
    cancel a thread as the thread exits with PTHREAD_CANCELED in pthread_exit, this functio ......

linux系统编程代码1

#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/sysmacros.h>
#include <time.h>
#include <unistd.h>
#define TIME_STRING_BUF 50
char * timestring(time_t t,char *buf)
 {
   struct tm *local; ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号