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,真是够快的。。。
相关文档:
Emebedded System and Application(Linux)
Goal
--
掌握嵌入式系统开发的流程,系统移植的方法,编写Bootloader
(Be familiar with the process of ES Developing
, System Migration
amd Bootloader Programming
)
Requriem ......
1. Linus和Bill
似乎在一夜之间,这个名字突然变得同象比尔。盖茨一样的耳熟能详。但是比尔。盖茨,
哪怕身价有数不清倍的百万美金,也永远不会变成Linux Torvalds。这位29岁的芬兰人,
简单而强大的Linux操作系统的创造者,超越了盖茨的神话。也有传闻说盖茨是一个
卓越的程序员,但Linus是货真价实的高手。还在大学里 ......
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 ......
Linux 引导过程内幕
引导 Linux® 系统的过程包括很多阶段。不管您是引导一个标准的 x86 桌面系统,还是引导一台嵌入式的 PowerPC® 机器,很多流程都惊人地相似。本文将探索 Linux 的引导过程,从最初的引导到启动第一个用户空间应用程序。在本文介绍的过程中,您将学习到各种与引导有关的主题, ......
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 ......