When SCP Truncates Large Files at 204 800 Bytes: Transferring Big Files from Windows via SCP

When SCP Truncates Large Files at 204 800 Bytes: Transferring Big Files from Windows via SCP

Imagine you’re exporting a 6 GB .ova file from VirtualBox on a Windows host and use scp to copy it to your Linux machine:

scp user@win-host:"E:/ova/large-disk.vmdk" .

The progress bar happily reports:

large-disk.vmdk                                    100% 6.0GB  60.0MB/s   01:40

…only to discover that the resulting file on disk is exactly 204 800 bytes! A final debug message reveals the culprit:

debug1: truncating at 204800

What’s Happening Under the Hood

  1. SCP over SFTP by default
    Modern OpenSSH clients (≥ 9.0) implement scp by tunneling file data over SFTP rather than the old RCP protocol.
  2. Win32-OpenSSH SFTP-Server Bug
    Recent Win32-OpenSSH releases (≥ 8.6) ship an sftp-server that will only honor up to 204 800 bytes per read request.
  3. Client Requests Bigger Blocks
    Linux-side OpenSSH clients (9.2, 9.3, etc.) request default SFTP read sizes of 1 048 576 bytes (1 MiB).
  4. Channel Drop & Truncation
    When the Windows server refuses to return more than 204 800 bytes, it tears down the channel mid-transfer. The client, having already reported completion, notices a mismatch and deliberately truncates the local file to 204 800 bytes.

How to Fix It

Reverse the Transfer Direction
On Windows, push the file to Linux instead of pulling:

scp "E:/ova/large-disk.vmdk" user@linux-host:~/

Uploading from Windows to Linux isn’t affected by this bug.

Reduce the SFTP Buffer Size

scp -X buffer=204800 user@win-host:"E:/ova/large-disk.vmdk" .

The -X buffer= option (added in OpenSSH 9.2) manually sets the read block size. Any value ≤ 204 800 bytes works.

Force the Legacy SCP Protocol

scp -O user@win-host:"E:/ova/large-disk.vmdk" .

The -O flag forces use of the classic RCP-based protocol instead of SFTP.


Summary

The “truncating at 204800” message is not a filesystem issue—it’s a known incompatibility between newer OpenSSH clients and the SFTP subsystem in current Win32-OpenSSH releases. By forcing the legacy protocol, or tuning the SFTP buffer, you can restore reliable transfer of large files from Windows to Linux.

Read more