你可以使用一个循环使用dd
#gen a test file
dd if=/dev/urandom bs=1K count=1024 of=test.bin
sourcefile="test.bin"
这应该很容易scriptified(bash的假设):
bsize=$((128*1024))
flength=$(stat --printf=%s "$sourcefile")
for i in $(seq 0 $((($flength-1)/$bsize))); do dd if="$sourcefile" bs=$bsize skip=$i count=1 2>/dev/null; done | md5sum
# verify
md5sum "$sourcefile"
for i in $(seq $RANDOM); do echo hello >> "$sourcefile"; done
flength=$(stat --printf=%s "$sourcefile")
for i in $(seq 0 $((($flength-1)/$bsize))); do dd if="$sourcefile" bs=$bsize skip=$i count=1 2>/dev/null; done | md5sum
# verify
md5sum "$sourcefile"
在我的系统中,这工作就像一个魅力,产生以下输出
1024+0 records in
1024+0 records out
1048576 bytes (1.0 MB) copied, 0.27551 s, 3.8 MB/s
d73c5a920dae16861983c95d8fb1e94b -
d73c5a920dae16861983c95d8fb1e94b test.bin
d14ae9ae62652bc7768b076226a6320a -
d14ae9ae62652bc7768b076226a6320a test.bin
我现在将留给您将信息传递给您的网络工作的挑战。 查看mkfifo,将每个子作业重定向到一个单独的fifo,并且如果该作业具有任何值(通常bandwith是限制因素),那么可以使用xargs -PN拆分并行作业。
属于http://unix.stackexchange.com – 2011-03-28 21:12:53