mirror of
https://github.com/allaunthefox/Research-Stack.git
synced 2026-07-31 03:05:21 +00:00
86 lines
2.2 KiB
Text
86 lines
2.2 KiB
Text
NODUPELABS BACKUP RECOVERY INSTRUCTIONS
|
|
|
|
This file provides plain-text recovery instructions for your backups.
|
|
For a more detailed guide, see README.md
|
|
|
|
INDUSTRY STANDARD REFERENCES
|
|
---------------------------
|
|
This system implements Content-Addressable Storage (CAS) per:
|
|
|
|
- ISO/IEC 15836 (Information technology - File management)
|
|
- ISO/IEC 21320-1 (Archive file format)
|
|
- NIST SP 800-111 (Storage Encryption Guidelines)
|
|
- RFC 4949 (Internet Security Glossary)
|
|
|
|
CAS is also used by:
|
|
|
|
- Git (content-addressed by hash)
|
|
- Docker (image layers by digest)
|
|
- IPFS (content-addressed filesystem)
|
|
- S3 (etag/content-hash versioning)
|
|
|
|
HOW IT WORKS
|
|
------------
|
|
1. Files are hashed using: sha256
|
|
2. Content is stored at: content/<hash>
|
|
3. Snapshots are stored at: snapshots/<id>.json
|
|
4. Same content = same hash = stored once (idempotent)
|
|
|
|
RECOVERY OPTIONS
|
|
----------------
|
|
|
|
Option 1: Using Snapshots
|
|
1. Find snapshot in snapshots/ directory
|
|
2. Read the JSON file - it contains file paths and hashes
|
|
3. Copy from content/<hash> to original path
|
|
|
|
Recovery script (Python):
|
|
---
|
|
import json, shutil
|
|
from pathlib import Path
|
|
|
|
backup_dir = Path(".nodupe/backups")
|
|
snapshot_file = backup_dir / "snapshots" / "<snapshot_id>.json"
|
|
|
|
with open(snapshot_file) as f:
|
|
data = json.load(f)
|
|
|
|
for file_data in data["files"]:
|
|
src = Path(file_data["backup_path"])
|
|
dst = file_data["path"]
|
|
if src.exists():
|
|
shutil.copy2(src, dst)
|
|
print(f"Restored: {dst}")
|
|
---
|
|
|
|
Option 2: Direct Content Access
|
|
All backup content is stored in content/ directory by hash:
|
|
|
|
# List all backed up files
|
|
ls -la content/
|
|
|
|
# Copy a file by hash
|
|
cp content/<hash> /path/to/restore/file
|
|
|
|
SUPPORTED HASH ALGORITHMS
|
|
--------------------------
|
|
- sha256 (default)
|
|
- sha384, sha512
|
|
- sha3_256, sha3_384, sha3_512
|
|
- blake2b, blake2s
|
|
|
|
FILE VERIFICATION
|
|
-----------------
|
|
To verify file integrity:
|
|
|
|
import hashlib
|
|
|
|
def verify_file(path, expected_hash, algorithm="sha256"):
|
|
hasher = hashlib.new(algorithm)
|
|
with open(path, "rb") as f:
|
|
while chunk := f.read(8192):
|
|
hasher.update(chunk)
|
|
return hasher.hexdigest() == expected_hash
|
|
|
|
---
|
|
Generated by NoDupeLabs v1.0.0
|