Q: Your infrastructure team is migrating to a new storage backend. You need to rsync 10TB of data with millions of tiny files between two Linux servers over the network. How do you optimize for speed?
Standard rsync -avz over SSH for millions of tiny files is extremely slow. The bottleneck becomes SSH encryption overhead and the serial nature of rsync analyzing one file at a time.
Want to master this scenario in a live sandbox? The Linux Foundation's Certified System Administrator (LFCS) & SRE Track covers this exact problem with hands-on terminal drills.
🛠️ Production Runbook & Step-by-Step Resolution
Direct Answer: "In an interview, I explain my systematic Linux troubleshooting methodology using Brendan Gregg's USE method. The interviewer is testing: Data transfer optimization, parallel processing, bypassing SSH overhead.. I structure my answer around systematic triage first, root cause analysis second, and permanent remediation third."
Initial Diagnostics & Root Cause Analysis
Standard rsync -avz over SSH for millions of tiny files is extremely slow. The bottleneck becomes SSH encryption overhead and the serial nature of rsync analyzing one file at a time.
- Parallelization: I would use
findpiped intoxargsrunning multiple rsync processes in parallel, or use tools specifically designed for this likefpsyncorGNU parallel. - Disable Compression: Remove the
-zflag from rsync. Compressing already compressed files (like images) wastes CPU, and for tiny files, the compression overhead dominates. - Change Cipher: If I must use SSH, I'd use a faster cipher:
rsync -e "ssh -c aes128-ctr".
Remediation & Permanent Safeguards
To optimize: Sender: tar -cf - folder | nc -l 1234 Receiver: nc
- Use Netcat/Tar (if secure): In a trusted backend network, pipe a parallel tar stream directly over unencrypted TCP via
nc. It avoids SSH entirely.
- Parallelization: I would use find piped into xargs running multiple rsync processes in parallel, ...
- Disable Compression: Remove the -z flag from rsync. Compressing already compressed files (like im...
- Change Cipher: If I must use SSH, I'd use a faster cipher: rsync -e "ssh -c aes128-ctr".
Senior hiring managers and bar raisers evaluate how you prioritize during outages. Avoid these common anti-patterns:
- Issuing immediate kill -9 (SIGKILL) commands rather than allowing graceful termination via kill -15 (SIGTERM) when configuring team migrating storage SIGKILL immediately halts execution without allowing processes to flush memory buffers, commit database transactions, or remove stale PID locks.
-
Overlooking file system inode exhaustion (df -i) when diagnosing 'No space left on device' errors when configuring team migrating storage
Millions of small files or unrotated session tokens can exhaust available file system inodes even when standard disk storage (
df -h) shows ample free space. - Exhausting open file descriptor allocations (ulimit -n) under intensive concurrent socket connections when configuring team migrating storage Reaching file descriptor exhaustion throws 'Too many open files' errors, preventing services from accepting new TCP client socket connections.
-
Permitting defunct zombie processes to accumulate without fixing parent process SIGCHLD waitpid reaping when configuring team migrating storage
Zombie processes consume process table entries; accumulating zombies can exhaust the system maximum PID limit (
pid_max).