wiki: add dev-tools section with tmux, screen, and rsync articles
Add three new articles to 03-opensource/dev-tools/: - tmux: persistent terminal sessions, background jobs, capture-pane - screen: lightweight alternative, comparison table - rsync: flags reference, resumable transfers, SSH usage Update all indexes (SUMMARY, section index, main index, README). Article count: 28 → 31. Remove tmux from writing backlog. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
102
03-opensource/dev-tools/rsync.md
Normal file
102
03-opensource/dev-tools/rsync.md
Normal file
@@ -0,0 +1,102 @@
|
||||
# rsync — Fast, Resumable File Transfers
|
||||
|
||||
## Problem
|
||||
|
||||
Copying large files or directory trees between drives or servers is slow, fragile, and unresumable with `cp`. A dropped connection or a single error means starting over. You also want to skip files that already exist at the destination without re-copying them.
|
||||
|
||||
## Solution
|
||||
|
||||
`rsync` is a file synchronization tool that only transfers what has changed, preserves metadata, and can resume interrupted transfers. It works locally and over SSH.
|
||||
|
||||
### Installation (Fedora)
|
||||
|
||||
```bash
|
||||
sudo dnf install rsync
|
||||
```
|
||||
|
||||
### Basic Local Copy
|
||||
|
||||
```bash
|
||||
rsync -av /source/ /destination/
|
||||
```
|
||||
|
||||
- `-a` — archive mode: preserves permissions, timestamps, symlinks, ownership
|
||||
- `-v` — verbose: shows what's being transferred
|
||||
|
||||
**Trailing slash on source matters:**
|
||||
- `/source/` — copy the *contents* of source into destination
|
||||
- `/source` — copy the source *directory itself* into destination
|
||||
|
||||
### Resume an Interrupted Transfer
|
||||
|
||||
```bash
|
||||
rsync -av --partial --progress /source/ /destination/
|
||||
```
|
||||
|
||||
- `--partial` — keeps partially transferred files so they can be resumed
|
||||
- `--progress` — shows per-file progress and speed
|
||||
|
||||
### Skip Already-Transferred Files
|
||||
|
||||
```bash
|
||||
rsync -av --ignore-existing /source/ /destination/
|
||||
```
|
||||
|
||||
Useful when restarting a migration — skips anything already at the destination regardless of timestamp comparison.
|
||||
|
||||
### Dry Run First
|
||||
|
||||
Always preview what rsync will do before committing:
|
||||
|
||||
```bash
|
||||
rsync -av --dry-run /source/ /destination/
|
||||
```
|
||||
|
||||
No files are moved. Output shows exactly what would happen.
|
||||
|
||||
### Transfer Over SSH
|
||||
|
||||
```bash
|
||||
rsync -av -e ssh /source/ user@remotehost:/destination/
|
||||
```
|
||||
|
||||
Or with a non-standard port:
|
||||
|
||||
```bash
|
||||
rsync -av -e "ssh -p 2222" /source/ user@remotehost:/destination/
|
||||
```
|
||||
|
||||
### Exclude Patterns
|
||||
|
||||
```bash
|
||||
rsync -av --exclude='*.tmp' --exclude='.Trash*' /source/ /destination/
|
||||
```
|
||||
|
||||
### Real-World Use
|
||||
|
||||
Migrating ~286 files from `/majorRAID` to `/majorstorage` during a RAID dissolution project:
|
||||
|
||||
```bash
|
||||
rsync -av --partial --progress --ignore-existing \
|
||||
/majorRAID/ /majorstorage/ \
|
||||
2>&1 | tee /root/raid_migrate.log
|
||||
```
|
||||
|
||||
Run inside a `tmux` or `screen` session so it survives SSH disconnects:
|
||||
|
||||
```bash
|
||||
tmux new-session -d -s rsync-migrate \
|
||||
"rsync -av --partial --progress /majorRAID/ /majorstorage/ | tee /root/raid_migrate.log"
|
||||
```
|
||||
|
||||
### Check Progress on a Running Transfer
|
||||
|
||||
```bash
|
||||
tail -f /root/raid_migrate.log
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Tags
|
||||
|
||||
#rsync #linux #storage #file-transfer #sysadmin #dev-tools
|
||||
Reference in New Issue
Block a user