Sample Header Ad - 728x90

Is there some program that can copy sparse file (/var/log/lastlog) over ssh as fast as cp (on local pc)?

1 vote
1 answer
1886 views
I'm backing ip my server via rsync over ssh but /var/log/lastlog file is 1.2G (it takes only 24K on the hdd). On a local machine cp can copy it for no time (a few ms) but rsync requires reading the whole file which takes hours. I also tried to mount server's /var/log with sshfs to my local pc but my local pc detects the file as 1.2T (so sshfs doesn't appear to detect sparse files). Is there some program that detects sparse files over ssh and can copy them the same way cp (without reading the empty blocks from the file) does? EDIT: rsync's -S/--sparse option still wants to read the whole source file (with all the empty bytes) which takes hours for 1.2T file. After rsync reads the whole file it creates small destination file (proper sparse file) but the problem is that it reads the source file with all the empty bytes (without skipping them). cp copies the file in a few ms while rsync takes hours. You can try it (on Linux) by creating 20G sparse file with truncate -s 20G sparse_file1 and copy it with rsync -S sparse_file1 sparse_file2 (takes long time) and then try to copy it with cp sparse_file1 sparse_file3 (takes a few ms).
Asked by FieryRider (135 rep)
Mar 21, 2019, 06:07 AM
Last activity: Jul 27, 2025, 03:02 PM