Linux rsync lab
FG09 · v23
1. Container workflow · 2. Linux validation · 3. Windows validation · 4. Create and verify your container
Alerts to Answers Analyst Field Guide — Linux Companion — Classroom Pilot Draft
Introduction
This lab teaches the same preservation process as the Windows Robocopy guide: identify the source, record its baseline, preview the direction, make a logged copy, verify the contents, and preserve records that support your finding. The tool changes; the obligation to explain the work does not.
Rsync is a Linux file-transfer tool for local or remote copying. Here it copies only generated practice folders on one machine. File-level copying is not a complete disk acquisition. Neither a copy log nor matching hashes establish the source's authenticity or the completeness of an acquisition (Guttman et al., 2022, pp. 6–8, 11; Rsync(1) manpage, n.d.).
1 Learn one skill at a time
| Stage | Your task |
|---|---|
| Crawl | Create the fixture, protect its baseline receipt, and preview the copy. |
| Walk | Copy, read the log, and explain a repeat run. |
| Run | Check SHA-256, missing and extra files, and the original baseline; save records. |
Before you begin
Use an instructor-prepared Ubuntu/Debian Linux machine or VM with Bash, rsync, and Python 3.9 or later. Other Linux distributions can use the same scripts after a local pilot. Python uses only its standard library; no pip packages are required. The scripts require Linux and do not run under Windows PowerShell or Git Bash.
Extract the kit into a persistent class folder on a local Linux filesystem, such as your home directory. Open a terminal in the extracted folder containing Student. Keep that session open. Run scripts as your ordinary account using bash; no sudo or chmod step is needed. Avoid temporary folders, network shares, cloud-synced folders, and Windows-mounted paths for this lab.
Use the HTML guide's Copy code buttons. Run one block at a time, read its result, and stop on an error. Quotes preserve spaces in paths. A backslash at a line's end continues a Bash command; do not put a space after it.
Practice boundary and testing status
Use synthetic files only. The kit supplies four .sh entrypoints and a shared Python helper. The comparison reads both trees without writing files; a separate saving step writes under Records. No student script deletes source or destination files. Reading a live system can still have side effects; this kit does not provide write protection or a snapshot.
This edition passed all 12 tests in Ubuntu 26.04.1 under WSL1 on September 20, 2026, including real Bash/rsync execution. Before class, the instructor must repeat the self-test in the actual classroom environment. NISTIR 8387 supports the preservation principles; it does not certify this classroom software or guarantee admissibility (Guttman et al., 2022, pp. 1, 6).
2 Crawl Prepare the practice files
The setup creates a unique ATA-Rsync folder under your current class folder. Source contains three ordinary files and one empty folder. Logs holds environment information. Records holds the original SHA-256 baseline. Destination does not yet exist.
lab=$(bash ./Student/new-rsync-lab.sh "$PWD")
src="$lab/Source"
dst="$lab/Destination"
baseline="$lab/Records/source-baseline.json"
printf 'Lab: %s\n' "$lab"The variables lab, src, dst, and baseline are short names for full paths. The setup prints its status and baseline digest on screen, while the lab variable receives only the new folder's path.
| Folder | Purpose |
|---|---|
| Source | Original generated practice files; kept in place. |
| Destination | Receives the selected copy. |
| Logs | Environment information, copy output, and command records. |
| Records | Pre-copy baseline and separately saved verification packets. |
Expected files: Case Notes/notes.txt, Exports/events.log, and Exports/results.csv. EmptyFolder contains no files. The generated fixture has no links, devices, or other special files.
Before copying: give the printed baseline SHA-256, lab ID, and UTC time to your instructor. The instructor must keep a receipt where you cannot edit it. Keep the baseline JSON in Records. Hashes stored only beside editable evidence can be replaced along with the evidence (Guttman et al., 2022, pp. 7, 11).
3 Crawl Preview the direction
bash ./Student/copy-rsync-lab.sh "$lab" --previewThe helper checks the generated source against its baseline and uses rsync's --dry-run. It retains a preview log under Logs but does not create or populate Destination. Preview output describes proposed actions, not a completed transfer (Rsync(1) manpage, n.d.).
Stop and check: confirm the printed source and destination, exit status, and proposed three files. If the paths or result are wrong, stop and retain the error. Do not reverse the paths or create replacement receipts to make the output look correct.
Student checkpoint: show the instructor the baseline receipt and copy direction. Explain why a preview is not evidence that file contents reached the destination.
4 Walk Make a logged copy
bash ./Student/copy-rsync-lab.sh "$lab"The helper copies the contents of Source into Destination. It requests recursion, permission bits, and modification times for the ordinary-file fixture. It rejects encountered links, hard-linked files, and special files that need a separate plan. Every run gets unique log names.
Expected first copy: exit 0 and three regular files transferred. Destination should contain the three files and EmptyFolder. The helper displays status and the retained log path.
5 Walk Read the records before claiming success
For each preview or copy, Logs contains a .log file, captured .console.txt output, and a .run.json record. The JSON records the exact argument list, exit code, source/destination, UTC times, rsync version and executable digest, and kit script digests. The environment record includes Python and OS information.
| Observation | What you can say |
|---|---|
| Exit 0 | Rsync reported successful completion of this operation; content verification follows. |
| Nonzero exit | Stop and review. Partial work and error records remain for investigation. |
| Regular files transferred | Files were selected and transferred in this run. Record the actual count. |
| No files transferred | No file content was selected for transfer; this does not establish hash equality. |
Repeat the synthetic copy
bash ./Student/copy-rsync-lab.sh "$lab"Expected repeat: exit 0 and zero regular files transferred, with a new set of logs. Keep the preview and both copy records. Do not assume that the total number of files in rsync's summary equals the number of ordinary files: directory entries may be counted too.
Different exit-code rule: rsync uses 0 for success. Do not carry Robocopy's successful nonzero-code convention into this lab. Codes 23 and 24 describe partial-transfer conditions and require review here (Rsync(1) manpage, n.d.).
Student checkpoint: point to the first and repeat transfer counts. Explain why an unchanged repeat still needs a separate SHA-256 check. Do not repeat a real evidence copy merely to overwrite or hide a discrepancy.
6 Run Verify both copies without changing them
Retrieve the original baseline receipt from the instructor. Paste only its 64-character SHA-256 when prompted. The result variable will hold JSON; the readable labels appear on screen.
read -r -p 'Paste instructor-held baseline SHA256: ' receiptAfter answering the prompt, run the comparison block:
result=''
result=$(bash ./Student/compare-rsync-trees.sh \
"$src" "$dst" "$baseline" "$receipt")The helper reads both trees and pairs ordinary files by exact relative path, including case. It compares byte lengths and SHA-256 and checks the current source against the protected baseline. Python's standard-library hashlib supplies SHA-256 (Python Software Foundation, n.d.).
| Screen label | Meaning |
|---|---|
| Green MATCH | Same relative path, size, and SHA-256 in both trees. |
| Red MISSING FROM DESTINATION | A source file has no destination counterpart. |
| Yellow EXTRA IN DESTINATION | A destination file has no source counterpart. |
| Red HASH MISMATCH | Both files exist, but their hashes differ. |
| Red BASELINE CHANGED | Current source inventory or contents differ from the original baseline. |
| Red INCOMPLETE | Reading, path validation, or the receipt check failed. No completed result. |
Labels remain readable without color. A renamed file appears as missing and extra. Paths are quoted and control characters escaped in the display. Differences remain in place; the comparison makes no report-file writes.
Expected clean result: three MATCH lines, then:
PASS | Match: 3 | Missing: 0 | Extra: 0 | Different: 0
Source baseline: MATCH
PASS requires nonempty matching file inventories, an unchanged source baseline, and a matching supplied receipt. Receipt provenance still depends on custody records. Without a baseline, identical trees show MATCH ONLY; empty trees show NO FILES. A completed comparison exits 0 even when its result is REVIEW. INCOMPLETE exits 3. Always read the result label.
Check the empty folder separately: confirm Destination/EmptyFolder exists and is empty. Directory lists are retained for context but are not an automated directory-equivalence test. Metadata, extended attributes, authenticity, and acquisition completeness are outside this content check. Hash equality supports a bounded integrity finding (Guttman et al., 2022, pp. 7–8, 11).
On REVIEW or INCOMPLETE: preserve the finding or error and notify the instructor. Do not recopy to hide it. A mismatch does not automatically establish deliberate tampering (Guttman et al., 2022, p. 7).
6 continued Save and protect the verification
For a completed comparison, inspect the full result and save it outside both copies:
printf '%s\n' "$result" | python3 -m json.tool
record=$(printf '%s\n' "$result" | \
bash ./Student/save-lab-verification.sh "$lab")
printf 'Saved record: %s\n' "$record"The saving helper creates a new Records/verification folder. It saves full-hash JSON and CSV, the baseline used, script copies, and snapshots of the lab logs. It hashes the saved files into record-manifest.json and prints that manifest's SHA-256. A completed REVIEW can be saved; an INCOMPLETE check has no result to save. Keep its error text and your notes instead.
Protect the second receipt: give the record-manifest SHA-256, lab ID, and UTC time to the instructor. Record the receipt reference in your worksheet. A checksum sidecar in an editable folder is not independent protection (Guttman et al., 2022, pp. 7, 11).
Preserve more than a checksum
- Identify the original source, how it was created or transferred, and each custodian. A pathname alone is not provenance (Guttman et al., 2022, p. 7).
- Distinguish a protected acquired master from a verified working copy. This lab uses writable synthetic folders; it does not make either folder immutable.
- Use approved storage with individual accounts, access controls, and logging. Keep a backup at a separate location and verify transfers; two folders on one disk are not a resilient backup (Guttman et al., 2022, pp. 7–9).
- Retain native files and the software needed to read them. Follow the relevant retention and release policy (Guttman et al., 2022, pp. 9–10).
Use the same worksheet and questions
Student_Worksheet.md keeps the Windows lab's evidence-handling fields: authority and scope, source identity, method, operator, versions, times, receipts, exceptions, custody, finding, and retention. Linux-specific fields identify the distribution, filesystem, Bash, Python, and rsync versions. Use the same five defensibility questions on the next page.
Record clock source or uncertainty, not merely a UTC value. Script timestamps and account identifiers are context, not authenticated proof. Write notes as you work. Preserve earlier entries when adding dated corrections; do not reconstruct an undocumented event as if it had been recorded at the time. These fields are the teaching implementation, not a NIST-prescribed form.
Student evidence and knowledge checks
Hand in the same kind of evidence packet
- Completed Student_Worksheet.md, including both separately held receipt references.
- Source, Destination, Logs, and Records from the generated lab, plus the kit scripts.
- Saved verification JSON, CSV, baseline, scripts, logs, and record manifest. Screenshots may illustrate them but cannot replace the underlying records.
- The empty-folder check and an explanation of every exception, warning, or incomplete step.
Submit through the approved class channel and retain your lab until released. The reviewer checks the baseline and record manifest against the original instructor-held receipts, then rehashes every listed record. A matching manifest supports integrity relative to that receipt; it cannot prove an unobserved collection actually occurred as described.
Write a bounded finding
“Between [UTC start] and [UTC end], I compared [count] source and [count] destination files. [count] matched by relative path, size, and SHA-256. I found [count] missing, [count] extra, and [count] different files. The source [matched/differed from] the baseline associated with receipt [reference]. Rsync reported exit [code]. EmptyFolder [result]. This check did not establish source authenticity, metadata equality, or acquisition completeness. Exceptions: [details].”
Defend your process using your records
- What were you authorized to copy, from where, and why this method?
- Show the baseline receipt. Who held it, and could you alter it?
- Show the exact command, versions, logs, and full hashes supporting your finding. Why does a skipped file still need hashing?
- What could change without this test detecting it? Explain the scope of a file-stream check and the absence of a snapshot.
- Who handled or accessed the material? Explain every discrepancy and custody gap without claiming certainty the records do not support.
Compare the two operating systems
Explain why a first Robocopy copy can return 1 while a successful rsync copy returns 0. Identify where each kit retains its baseline, command record, and verification manifest. Discuss Linux case-sensitive names and the source trailing slash without changing the preservation standard.
For an instructor-led extension, use a separate synthetic pair with a changed, missing, and extra file. Then change both copies identically after a recorded baseline. Matching copies alone cannot show whether they changed before comparison (Guttman et al., 2022, p. 11).
This exercise supports a traceable account of your work. It does not guarantee admissibility; real cases require appropriate authority, procedures, qualifications, and review.
Quick reference Read when needed
The helper uses explicit options for ordinary practice files. Read the logged Arguments array to see exactly what ran. Option behavior is documented in the rsync manual (Rsync(1) manpage, n.d.).
| Option or concept | Meaning in this lab |
|---|---|
| --recursive | Includes subdirectories, including empty ones. |
| --perms | Requests permission-bit preservation. |
| --times | Requests modification-time preservation. |
| --dry-run | Previews the transfer; the helper separately retains a log. |
| --itemize-changes | Describes selected changes. It is not a SHA-256 manifest. |
| --stats | Adds a transfer summary. |
| --log-file | Writes the uniquely named log under Logs. |
| Source/ | The trailing slash selects the source directory's contents. |
| -- | Ends option parsing before the two absolute paths. |
Important scope choices
Archive mode is not complete preservation. The familiar -a option does not include hard links, ACLs, or extended attributes by itself. Those require additional choices, support, and permissions. This introductory kit uses explicit ordinary-file options and does not verify metadata (Rsync(1) manpage, n.d.).
Copying can overwrite. Destination-only files remain because the helper does not use deletion options. Selected destination files can still be replaced during a copy. The repeat exercise is only for the generated synthetic lab.
Reject unsupported objects. Links, hard-linked files, special files, and detected filesystem boundaries stop the helper. A real collection requires a documented handling plan; silently omitting an object is not a complete acquisition.
Keep the source stable. The helper checks file identity, size, and times around reads and checks for common changes during enumeration. These checks do not create a snapshot or prove that a live source was unchanged throughout the operation. Case-sensitive names are paired exactly. Windows/Linux metadata and path rules are not interchangeable.
Common problems
Missing command or wrong platform: stop and ask the instructor to prepare Linux, Bash, rsync, and Python 3.9+. The instructor self-test is required before class. Do not bypass the Linux guard to claim a Windows run qualifies the kit.
Permission denied or special file: retain the message and clarify scope. Do not use sudo, change evidence permissions, or remove an item merely to force a PASS.
Invalid receipt or JSON: use the original receipt and the current result variable. If comparison failed, it produced no completed JSON. Do not paste an old PASS result into the saving step.
References
Guttman, B., White, D. R., & Walraven, T. (2022). Digital evidence preservation: Considerations for evidence handlers (NIST Interagency Report 8387). National Institute of Standards and Technology. https://doi.org/10.6028/NIST.IR.8387
Python Software Foundation. (n.d.). hashlib — Secure hashes and message digests. Python documentation. Retrieved September 19, 2026, from https://docs.python.org/3/library/hashlib.html
Rsync(1) manpage. (n.d.). Retrieved September 19, 2026, from https://download.samba.org/pub/rsync/rsync.1
Source and implementation boundaries
APA 7 citations identify the source of a claim. NIST locators use the printed report pages, not PDF viewer positions. NISTIR 8387 supports preservation principles; the rsync manual describes transfer behavior, and Python documentation describes the hashing library. The scripts, receipts, worksheet, and lesson sequence are this kit's implementation.
The instructor package includes a NIST crosswalk, answer key, Linux self-test, and testing-status record. The Windows and Linux kits assess the same evidence-handling reasoning. Neither provides a complete imaging, write-protection, custody, or legal-admissibility system.
Instructor pilot before teaching
Run bash ./Instructor/test-lab.sh "$PWD" as an ordinary Linux user. It creates separate synthetic test fixtures and retains its results. A clean run must have no failures, errors, or skips, and NativeLinuxQualified must be true. Record the distribution, filesystem, Bash/Python/rsync versions, UTC time, and test-result location. Investigate any discrepancy before deploying the lesson to students.
The current draft passed all 12 tests on Ubuntu 26.04.1/WSL1 with wslfs (rw,noatime), Bash 5.3.9, Python 3.14.4 and rsync 3.4.1. No failures, errors or skips occurred. Retain that result and repeat qualification on the classroom VM/filesystem.
Student kit
Download the student scripts, worksheet and guide.
The companion retains its own source edition and documented test scope. Author approval does not replace a classroom run.
1. Container workflow · 2. Linux validation · 3. Windows validation · 4. Create and verify your container
Companion lab
SL-03 — Linux rsync transfer and verification: tasks, evidence submission and completion criteria.