首页 » OS » CentOS » Copy sparse directory over ssh

Copy sparse directory over ssh

作者: lesca 分类: CentOS, RaspberryPi, Ubuntu 发布时间: 2019-07-22 21:30 ė浏览 10,688 次 6Comments Off on Copy sparse directory over ssh

scp can copy directory over ssh, but sparse parameter is not supported (unlike cp).

To efficiently copy directory with sparse files, use tar and ssh instead.

# Copy "images" directory to remote server 
tar -cvSf - images/ | ssh user@remoteHost "(cd /mnt/pve/vmdata/ ; tar -xf -)"
  • S – stands for sparse

tarscp.sh script

Use tarscp.sh to transfer directory over network:

Usage:
tarscp srcDir/ user@host:/dest/dir/

You can find the script from my github
Direct download link for raw file: tarscp.sh

Copyright

本文出自 Lesca 技术宅,转载时请注明出处及相应链接。

本文永久链接: https://lesca.me/archives/copy-sparse-directory-over-ssh.html

Ɣ回顶部