Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

docs/sftp: document use of chunk_size option in sftp remote paired with serve sftp

albertony35349657cd2d
diff --git a/backend/sftp/sftp.go b/backend/sftp/sftp.go
index 1c160996c..37fcbdcb2 100644
--- a/backend/sftp/sftp.go
+++ b/backend/sftp/sftp.go
@@ -275,19 +275,24 @@ Set to 0 to keep connections indefinitely.
Name: "chunk_size",
Help: `Upload and download chunk size.
-This controls the maximum packet size used in the SFTP protocol. The
-RFC limits this to 32768 bytes (32k), however a lot of servers
-support larger sizes and setting it larger will increase transfer
-speed dramatically on high latency links.
-
-Only use a setting higher than 32k if you always connect to the same
-server or after sufficiently broad testing.
-
-For example using the value of 252k with OpenSSH works well with its
-maximum packet size of 256k.
-
-If you get the error "failed to send packet header: EOF" when copying
-a large file, try lowering this number.
+This controls the maximum size of payload in SFTP protocol packets.
+The RFC limits this to 32768 bytes (32k), which is the default. However,
+a lot of servers support larger sizes, typically limited to a maximum
+total package size of 256k, and setting it larger will increase transfer
+speed dramatically on high latency links. This includes OpenSSH, and,
+for example, using the value of 255k works well, leaving plenty of room
+for overhead while still being within a total packet size of 256k.
+
+Make sure to test thoroughly before using a value higher than 32k,
+and only use it if you always connect to the same server or after
+sufficiently broad testing. If you get errors such as
+"failed to send packet payload: EOF", lots of "connection lost",
+or "corrupted on transfer", when copying a larger file, try lowering
+the value. The server run by [rclone serve sftp](/commands/rclone_serve_sftp)
+sends packets with standard 32k maximum payload so you must not
+set a different chunk_size when downloading files, but it accepts
+packets up to the 256k total size, so for uploads the chunk_size
+can be set as for the OpenSSH example above.
`,
Default: 32 * fs.Kibi,
Advanced: true,
diff --git a/cmd/serve/sftp/sftp.go b/cmd/serve/sftp/sftp.go
index 46c485d75..8244435ee 100644
--- a/cmd/serve/sftp/sftp.go
+++ b/cmd/serve/sftp/sftp.go
@@ -71,9 +71,9 @@ The server will respond to a small number of shell commands, mainly
md5sum, sha1sum and df, which enable it to provide support for checksums
and the about feature when accessed from an sftp remote.
-Note that this server uses fixed 32 KiB packet size, which means you must not
-configure the client to use any other values, e.g. with the
-[chunk_size](/sftp/#sftp-chunk-size) option on an sftp remote.
+Note that this server uses standard 32 KiB packet payload size, which
+means you must not configure the client to expect anything else, e.g.
+with the [chunk_size](/sftp/#sftp-chunk-size) option on an sftp remote.
The server will log errors. Use ` + "`-v`" + ` to see access logs.