Применимость: Linux, *nix
Слова для поиска: Fast copy
Быстро скопировать большие объемы данных
cp -R src1/ src2/ dest/
cp -a src1/ src2/ dest/
tar -Sc src1/ src2/ | tar -C dest/ -x
# Remote to local scp -C remotebox:path/to/sourcefile . # Local to remote scp -C localfile remotebox:path/to/destination/
# to the remote system tar czv dir/files | ssh remote.box.com "tar xz -C /dir/" # to the remote system with faster encryption tar czv ListOfFiles | ssh -c blowfish remote.box.com tar xz -C /home/user/PathToCopy # from remote to local ssh remote.box.com tar cz -C BeginDirCopyFiles |tar xz -C DirToCopy
# local to remote cat dir/file | ssh -C remote.box.com "cat > /dir/file" # combined with gzip or bz2 cat dir/file | gzip | ssh -C remote.box.com "gunzip > /dir/file" cat dir/file | bzip2 | ssh -C remote.box.com "bunzip2 > /dir/file" # remote to local ssh remote.box.com "cat /dir/file" > dir/file # combined with gzip or bz2 ssh remote.box.com "cat /dir/file | gzip" | gunzip > dir/file ssh remote.box.com "cat /dir/file | bzip2" | bunzip2 > dir/file
Destination box:
nc -l -p 2342 | tar -C /target/dir -xz -
Source box:
tar -cz /source/dir | nc Target_Box 2342
For further CPU use reduction, lzop can be used in place of the tar z option for much faster but less effective compression.
Destination box: nc -l -p 2342 | lzop -d | tar -C /target/dir -x - Source box: tar -c /source/dir | lzop | nc Target_Box 2342
Destination box: socat -u - tcp4-listen:2342 | tar x -C /target/dir Source box: tar c /source/dir | socat -u - tcp4:Target_Box:2342
Destination box: socat -u - tcp4-listen:2342 | ${UNZIP} | tar x -C /target/dir Source box: tar c /source/dir | ${ZIP} | socat -u - tcp4:Target_Box:2342
Использование netcat даст больше скорости, а SSH лучшую защиту
dd if=/dev/VolGroup01/kvm358_img | ssh root@<IP-адрес> «dd of=/dev/VolGroup01/kvm358_img»
На сервере принимающем данные:
nc -l 19000 | bzip2 -d|dd bs=16M of=/dev/VolGroup01/kvm358_img
На сервере передающем данные:
dd bs=16M if=/dev/VolGroup01/kvm358_img |bzip2 -c|nc <IP-адрес принимающего сервера> 19000
—- Актуальность: 2012/03/30 17:55