After an overnight transcoding job finishes, the output files need to reach the receiving node. Once a collection batch is complete, its raw data still needs to be handed off for downstream processing. A dropped SSH connection does not necessarily mean starting the transfer over, but a successful rerun does not prove that the entire batch is ready for handoff. A reliable workflow must address three things: retaining partial files, keeping the source data consistent, and independently validating the received batch.
This article uses a batch of ordinary files on Ubuntu 24.04 as an example. Both ends have rsync, GNU coreutils, and findutils installed. Run the commands in Bash on the sending host. Connection credentials for UdpAmd dedicated servers are available in the console after payment. If the server has multiple addresses, use the first address for SSH.
1. Freeze the batch before creating a checksum manifest
Transfer from an export directory whose contents are no longer being written—not from active collection files, a database directory, or a temporary transcoding directory. Databases need an application-consistent export first. For ordinary files, the producing process must close them before they become part of a batch awaiting transfer.
In this example, the source directory is /srv/export/batch-001 and the receiving directory is /srv/import/batch-001. batch-target is an SSH alias that an administrator has configured in advance, with the host key verified. It does not imply a default account or connection settings. The receiving account only needs write access to the destination directory; do not grant server-wide administrative privileges just to run a sync.
First, confirm that the directory contains only directories and regular files. If the following commands produce any output, resolve the symbolic links, device files, or other objects before continuing:
set -euo pipefail
SRC=/srv/export/batch-001
test -d "$SRC"
find "$SRC" ! -type d ! -type f -print
Store the manifest outside the source directory so that it does not include itself in the checksum calculation. File names are passed with null delimiters to handle spaces. GNU sha256sum also escapes special file names, which the same tool can read back later.
(
cd "$SRC"
find . -type f -print0 |
LC_ALL=C sort -z |
xargs -0 -r sha256sum
) > /srv/export/batch-001.sha256
Keep the source directory unchanged after generating the manifest. Changing directory permissions alone does not prevent writes through handles that are already open, so verify from the producing job's state that the batch has actually finished.
Checksums establish whether file bytes match; they cannot turn inconsistent application data into a consistent backup. Data that is still being written must first be brought into a consistent state before transfer begins.
2. Keep partial files in a separate staging area
The receiving directory must be dedicated to this batch and must not be scanned by downstream jobs. After an administrator has created it and granted the required permissions, check the remote tools and available space:
ssh batch-target 'rsync --version; df -h /srv/import'
Use the following options for the transfer:
rsync -rt \
--partial-dir=.rsync-partial \
--delay-updates \
--info=progress2 \
-e ssh \
"$SRC/" batch-target:/srv/import/batch-001/
The trailing slash on the source path means “sync the directory's contents.” Omitting it may introduce an extra directory level. -r copies recursively, and -t preserves modification times. This example delivers file contents only; it does not copy ownership, ACLs, or extended attributes. Validate permissions on the receiving side separately against the established policy.
--partial-dir retains interrupted files so that the next run of the same command can use them as a basis for delta transfer. It does not guarantee resuming at a specific byte offset. Only the trusted receiving account should have access to this directory; it must not be used as a public upload directory.
--delay-updates defers replacing completed files until the end of the transfer, but it does not provide an atomic transaction for the entire directory. Regardless of the options used, downstream jobs must wait for independent validation. The mere appearance of files is not evidence that the batch is complete.
3. Test recovery with a controlled interruption
Rehearse with a separate test batch first, never with the only production copy. Prepare a regular test file of at least 16MiB that does not yet exist at the destination, and use the same directory layout described above.
Run the transfer for this test batch with a bandwidth limit:
set +e
timeout --signal=TERM --kill-after=5s 3s \
rsync -rt \
--bwlimit=1024 \
--partial-dir=.rsync-partial \
--delay-updates \
-e ssh \
"$SRC/" batch-target:/srv/import/batch-001/
rc=$?
set -e
printf 'transfer_exit=%s\n' "$rc"
Here, --bwlimit=1024 limits rsync's transfer rate in KiB/s; it is not a measurement of data center bandwidth. A normally triggered timeout usually returns 124. If no data needs to be sent, however, the command may finish successfully before the timeout. That is why the test requires a large file that is not already present at the destination.
After the interruption, inspect the remote state:
ssh batch-target \
'find /srv/import/batch-001 -type f -printf "%P %s\n"'
You should find a partial file, which must not be treated as a delivered result. Then remove timeout and the test bandwidth limit, rerun the command from Section 2, and confirm that its exit code is zero. Retain file listings, exit codes, and transfer statistics from before and after the interruption. These records demonstrate that the recovery path was actually exercised, rather than merely checking that the options were spelled correctly.
If no partial file remains, first check the receiving directory's permissions, available space, whether data transfer actually started, and the rsync versions at both ends. Do not bypass the problem by switching directly to options that overwrite files in place.
4. Independently verify contents and the file set
Once the sync is complete, transfer the manifest and verify its relative paths from inside the receiving directory:
rsync -t -e ssh \
/srv/export/batch-001.sha256 \
batch-target:/srv/import/batch-001.sha256
ssh batch-target \
'cd /srv/import/batch-001 &&
sha256sum -c ../batch-001.sha256'
Any missing file or checksum mismatch must block the handoff. Nonzero exit codes from the manifest transfer, SSH commands, and checksum verification must all propagate to the parent job. Do not rely solely on searching the output for success messages.
The manifest checks only the files it lists; it does not report extra files at the destination. Run an additional read-only comparison:
rsync -rcn --delete \
--exclude='.rsync-partial/' \
--itemize-changes \
-e ssh \
"$SRC/" batch-target:/srv/import/batch-001/
The critical option here is -n: --delete only previews extra items at the destination and does not delete them. If file changes or deletions are reported, account for each one. Do not simply remove the dry-run option and perform a cleanup. -c reads files at both ends to calculate checksums, so schedule this step during batch acceptance to avoid competing with heavy production I/O.
5. Define failure handling in the handoff rules
The resumable transfer script should proceed in this order: successful data transfer, successful manifest transfer, passing checksum verification, and passing the difference check. If any step fails, retain the receiving directory for investigation, do not notify downstream jobs, and do not delete the source originals.
Do not casually add --inplace to this workflow. It modifies destination files directly, breaking the separation between complete files and intermediate transfer states. Likewise, do not use --append directly on ordinary batches: it relies on assumptions such as the existing prefix being correct and is not a general-purpose repair option.
Space planning on the receiving side must account for more than the final data size. Partial files, delayed-update files, and old files may occupy space at the same time. Check available capacity against the actual directory state. UdpAmd's standard configuration includes two directly attached 1TB NVMe drives, with no hardware RAID. Even if the source and destination have identical contents, that alone does not make them a backup across independent failure domains.
The final handoff record should include the batch identifier, the manifest's digest, exit codes for each stage, and the conclusion of the difference check. Downstream jobs should consume only accepted batches, while deletion of the originals should follow a separate retention policy. With these rules, a network interruption remains a recoverable transfer event instead of becoming a data-integrity incident that is difficult to trace.
Frequently asked questions
Does a successful rsync exit replace SHA-256 verification?
No. It confirms that the synchronization completed. A SHA-256 manifest generated from the frozen source independently checks each delivered file. Downstream jobs should remain blocked until verification passes.
Can the source keep changing while the transfer is retried?
Not for a consistent batch handoff. Stop writes or prepare an application-consistent snapshot or export first, then generate the manifest and transfer that fixed dataset.
EPYC 7543P Dedicated Server
From $458/month, billed in USD.