CDC File Transfer
repository·main·Indexed 25 days ago
https://github.com/google/cdc-file-transferHigh-performance tools for syncing and streaming files from Windows to Linux using Content Defined Chunking (CDC) and the FastCDC algorithm. Includes cdc_rsync for delta transfers to minimize bandwidth and cdc_stream for streaming Windows directories to a read-only Linux FUSE filesystem. Also provides cdc_indexer for measuring data redundancy and cdc_rsync_server for remote sync operations.
What's inside cdc-file-transfer
- CDC RSync is a command-line tool and library designed for uploading files to a remote machine using an rsync-like mechanism. It optimizes transfers by quickly skipping files that have matching timestamps and sizes, and it only transfers the deltas (changes) for existing files to minimize bandwidth usage.
Overview of CDC File Transfer tools
mainCDC File Transfer provides tools for syncing and streaming files from Windows to Windows or Linux using Content Defined Chunking (CDC), specifically the FastCDC algorithm. It is designed to overcome the limitations of
scpand standardrsyncwhen transferring large amounts of data or many small files over sub-par internet connections.Key tools include:
cdc_rsync: A sync tool optimized for cases where an old version of files already exists on the target. It uses fast compression and only transfers the differences (deltas) when files change.cdc_stream: A tool for streaming files and directories from Windows to Linux, optimized for read speed. It caches data on the Linux device and only re-streams differences if a file is re-read after changing on Windows. Note that the Linux directory is read-only.
Quickstart: Install CDC File Transfer
mainTo use the tools without building from source:
- Download the precompiled binaries from the latest release to a Windows device.
- Unzip the files.
- The Windows tools will automatically deploy the necessary Linux binaries to
~/.cache/cdc-file-transferon the Linux device. No manual deployment is required.
Build CDC Stream from source
mainTo build
cdc_stream, you must build components on both Linux and Windows and then combine them.- On Linux, build the FUSE filesystem component:
bazel build --config linux --compilation_mode=opt --linkopt=-Wl,--strip-all --copt=-fdata-sections --copt=-ffunction-sections --linkopt=-Wl,--gc-sections //cdc_fuse_fs - On Windows, build the client component:
bazel build --config windows --compilation_mode=opt --copt=/GL //cdc_stream - Combine: Copy the Linux build output files
cdc_fuse_fsandlibfuse.sofrombazel-bin/cdc_fuse_fsto the Windows machine'sbazel-bin\cdc_streamdirectory.
bazel build --config linux --compilation_mode=opt --linkopt=-Wl,--strip-all --copt=-fdata-sections --copt=-ffunction-sections --linkopt=-Wl,--gc-sections //cdc_fuse_fs bazel build --config windows --compilation_mode=opt --copt=/GL //cdc_stream- On Linux, build the FUSE filesystem component:
Configure SSH and SFTP for CDC File Transfer
mainThe tools require passwordless SSH and SFTP access from the Windows machine to the Linux device (e.g., via key-based authentication).
By default, the tools look for
ssh.exeandsftp.exein your system PATH. You can verify your setup by running:ssh user@linux.device.com sftp user@linux.device.comIf you need to provide additional arguments or specific paths, you can use an SSH config file at
%USERPROFILE%\.ssh\configor specify the commands via environment variables or CLI flags.set CDC_SSH_COMMAND="C:\path with space\to\ssh.exe" set CDC_SFTP_COMMAND="C:\path with space\to\sftp.exe"Build CDC RSync from source
mainTo build
cdc_rsync, you must build components on both Linux and Windows and then combine them.- On Linux, build the server component:
bazel build --config linux --compilation_mode=opt --linkopt=-Wl,--strip-all --copt=-fdata-sections --copt=-ffunction-sections --linkopt=-Wl,--gc-sections //cdc_rsync_server - On Windows, build the client component:
bazel build --config windows --compilation_mode=opt --copt=/GL //cdc_rsync - Combine: Copy the Linux build output
cdc_rsync_serverfrombazel-bin/cdc_rsync_serverto the Windows machine'sbazel-bin\cdc_rsyncdirectory.
bazel build --config linux --compilation_mode=opt --linkopt=-Wl,--strip-all --copt=-fdata-sections --copt=-ffunction-sections --linkopt=-Wl,--gc-sections //cdc_rsync_server bazel build --config windows --compilation_mode=opt --copt=/GL //cdc_rsync- On Linux, build the server component:
Tune the CDC algorithm via compile-time constants
mainThe CDC algorithm can be tuned for experimentation using preprocessor macros defined in
indexer.h. You can pass these constants during the build process using the--coptflag in Bazel. For example, you can setCDC_GEAR_BITSto a specific value.bazel build -c opt --copt=-DCDC_GEAR_BITS=32 //cdc_indexerRun the CDC Indexer sample
mainYou can run the CDC indexer sample using Bazel. Use the
--inputsflag to specify the path to the files you wish to process.bazel run -c opt //cdc_indexer -- --inputs '/path/to/files'Prerequisites for building CDC File Transfer from source
mainTo build from source, perform these steps on both Windows and Linux:
- Install Bazel.
- Clone the repository:
git clone https://github.com/google/cdc-file-transfer - Initialize submodules:
cd cdc-file-transfer git submodule update --init --recursive
Windows specific requirement: Ensure an SSH client is installed on the Windows machine. The tools require
ssh.exeandsftp.exeto function.Specify SSH and SFTP commands via environment variables
mainIf
ssh.exeorsftp.exeare not in your PATH, or if you need to pass specific flags (like identity files or ports), set theCDC_SSH_COMMANDandCDC_SFTP_COMMANDenvironment variables.Note: Use lowercase
-pforssh.exeand uppercase-Pforsftp.exewhen passing port arguments.set CDC_SSH_COMMAND=C:\path\to\ssh.exe -p 12345 -i C:\path\to\id_rsa -oUserKnownHostsFile=C:\path\to\known_hosts set CDC_SFTP_COMMAND=C:\path\to\sftp.exe -P 12345 -i C:\path\to\id_rsa -oUserKnownHostsFile=C:\path\to\known_hostsUse the CDC indexer CLI to measure data redundancy
mainThecdc_indexeris a command-line tool used to measure and report data redundancy by indexing files and calculating chunk sizes and deduplication ratios. It supports parallel processing and various chunk size configurations.Troubleshoot CDC Stream service and logs
maincdc_streamoperates via a background service.- Default Log Location:
%APPDATA%\cdc-file-transfer\logs - Custom Service Configuration: Create a JSON file at
%APPDATA%\cdc-file-transfer\cdc_stream.jsonto pass flags to the service (e.g.,{"verbosity":3}). - Manual Service Execution: Run
cdc_stream start-servicedirectly. Use the--log-to-stdoutflag to see logs in the console. - Debugging SSH/SFTP: Both tools include SSH/SFTP commands in debug logs. If a command fails, copy it and run it manually with
-vvor-vvvto investigate.
- Default Log Location: