Skip to main content

Conscious filesystem diff, audit and sync tool

Project description

fsync-conscious

Conscious filesystem diff, audit & sync tool
Explicit > Blind
Auditable > Convenient
Engineering > Copy & paste


📌 What is it?

fsync-conscious is a conscious directory diff, audit, and sync tool.

It exists because copying and pasting folders is a blind operation.

This project is built on a simple principle:

Never sync what you don’t understand.

Before applying any change, fsync:

  • computes explicit diffs
  • classifies risks
  • detects real filesystem errors
  • generates auditable reports
  • fails honestly when needed

🎯 Problem it solves

Common tools (cp, GUIs, copy/paste):

  • silently overwrite files
  • don’t explain what changed
  • don’t detect unreadable files
  • break on sockets, permissions, and mounts
  • are not auditable

fsync-conscious treats the filesystem as state, not just a pile of files.


🧠 Philosophy

  • Explicit diff before sync
  • Clear policy > implicit behavior
  • Failures are classified, not hidden
  • Dry-run must produce the SAME report as a real sync
  • Hashing is optional, not dogma
  • Nothing is renamed or “fixed” automatically

📦 Installation

From PyPI (recommended)

pip install fsync-conscious

This installs the fsync CLI globally.


Development / editable install

git clone https://github.com/<your-user>/fsync-conscious.git
cd fsync-conscious
pip install -e .

🚀 Basic usage

All commands follow this pattern:

fsync <mode> <A> <B> [options]

Where:

  • A → source directory (source of truth)
  • B → destination directory (backup / mirror)

🔧 Operation modes

1️⃣ diff — Difference exploration

Shows what is different between A and B. Does not create, copy, or delete anything.

fsync diff A B

Detects:

  • missing directories
  • new files
  • modified files
  • extra files in the destination

2️⃣ sync — Conscious synchronization

Updates B based on A.

fsync sync A B

By default:

  • nothing is deleted
  • only new or updated files are copied
  • invalid entities are ignored
  • execution continues even if some errors occur

3️⃣ check — Equality validation

Verifies whether A and B are equivalent.

fsync check A B
  • exit code 0 → identical
  • exit code 1 → differences found

Ideal for CI, sanity checks, and automated audits.


🔍 Comparison strategies

📅 Default: mtime

By default, comparison is based on:

  • file existence
  • modification timestamp (mtime)
fsync sync A B

Advantages

  • fast
  • low I/O
  • no need for file read permissions
  • robust for 99% of real-world cases

🔐 --hash (SHA256)

Enables content-based comparison.

fsync diff A B --hash

Behavior:

  • reads full file contents
  • detects any real content change
  • unreadable files are marked as UNREADABLE

⚠️ Hashing is opt-in by design.


🧪 Safety modes

--dry-run

Simulates the entire operation without writing anything.

fsync sync A B --dry-run

Important:

  • the generated report is IDENTICAL to a real sync
  • only side effects are suppressed

--strict-fs

Any error becomes a fatal error.

fsync sync A B --strict-fs

Aborts on:

  • unreadable files
  • invalid filenames for the target filesystem
  • write errors
  • mount incompatibilities

Ideal for CI and critical backups.


🧾 Audit mode

--audit-only

Generates a final report + explicit exit code.

fsync sync A B --dry-run --audit-only

Example output:

AUDIT REPORT
copied: 214
skipped: 0
unreadable: 2
invalid: 1

📊 Event classification

fsync classifies everything into four categories:

Category Meaning
copied files copied (or that would be copied in dry-run)
skipped ignored by policy
unreadable could not be read
invalid invalid name/path for the destination filesystem

👉 Nothing is silent.


🚦 Exit codes

Inspired by rsync:

Code Meaning
0 total success
1 differences found
2 sync applied
10 skipped files
20 unreadable files
30 invalid files
99 fatal error (--strict-fs)

🧹 Full mirroring

fsync sync A B --delete

Removes from the destination everything that no longer exists in the source.

⚠️ Use with caution.


🔄 Reverse direction

fsync diff A B --reverse

Equivalent to:

B → A

🚫 What fsync ignores by design

  • sockets (mysql.sock)
  • FIFOs
  • device files
  • broken symlinks
  • files removed during scan

Filesystems are heterogeneous. The tool explicitly assumes this.


🧠 Real-world use cases

  • conscious incremental backups
  • backup validation
  • laptop ↔ external drive
  • staging ↔ production
  • data audits
  • CI/CD pipelines
  • Docker environments
  • mounted volumes
  • critical data sets

❌ When NOT to use

  • one-off disposable copies
  • trivial tasks
  • non-technical users
  • when convenience > control

🧠 Final insight

Copy & paste solves an action. fsync solves a process.

This tool exists for people who need to:

  • understand what is happening
  • take responsibility
  • audit decisions
  • avoid silent data loss

📄 License

MIT — use, modify, and distribute freely. But understand what you are doing.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fsync_conscious-0.1.1.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fsync_conscious-0.1.1-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file fsync_conscious-0.1.1.tar.gz.

File metadata

  • Download URL: fsync_conscious-0.1.1.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for fsync_conscious-0.1.1.tar.gz
Algorithm Hash digest
SHA256 146d4b7e92675880041fe84519fb84b8e51c75d83a453127165cf00b82ee953c
MD5 9ced2bd0febb1a1f01735913ea4e6d0e
BLAKE2b-256 6fda7d2351311d67831fde8f687778146d72564dfdf1c6a9111f2c70f68ee67f

See more details on using hashes here.

File details

Details for the file fsync_conscious-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for fsync_conscious-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bc1d857512aa6eb075221aed327dee86f3b75d4a148a997ec1c19ea88deecde1
MD5 84a2a1ed21c00e777a0599cea81c3332
BLAKE2b-256 886ee85dad14d8fb2918f659d7daaf9ef05ba2c9954c6880d2b7d0649c85efca

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page