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 编译安装 MYSQL 5.1 与 Innodb
编译mysql5
代码:
./configure \
--prefix=/usr/local/mysql \
--localstatedir=/usr/local/mysql/data \
--with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock \
--with-extra-charsets=all \
--with-charset=utf8 \
- ......
Emebedded System and Application(Linux)
Goal
--
掌握嵌入式系统开发的流程,系统移植的方法,编写Bootloader
(Be familiar with the process of ES Developing
, System Migration
amd Bootloader Programming
)
Requriem ......
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 that will be unchanged
cat after.txt
输出:
This is a line that has been changed
Thi ......
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 ......
#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; ......