| Post Reply | RetroFed Forum Forum Index » Self Hosted - Self-hosting your services. |
| Author | Message | ||
|---|---|---|---|
|
Cosine Tau
lemmy.ml
cosine@lemmy.ml Joined: 2023-06-06 |
GitHub repository: https://github.com/mashiox/s3ql-time-machine/ Background and MotivationA few years ago, before I fully understood the operational lock-in and caveats that come with S3QL, I deployed several encrypted, deduplicated filesystems directly on Amazon S3. The intent at the time made sense: use S3QL as a secure networked filesystem in the cloud to store sensitive disk backups, and data. AWS is an exceptional platform. The reliability, API consistency, are second to none. However, AWS is extremely expensive for long-term storage and data egress. As data sizes grew into hundreds of gigabytes and terabytes, keeping static media files in S3 buckets across multiple regions became financially unreasonable. My primary motivation was straightforward: change the hosting strategy to something more economic. I decided to transition my data off AWS and bring it into a local, self-hosted environment. That was where I ran into a my first blocker. The S3QL Version Lock-in ProblemOn my workstation running Arch Linux (btw), the native S3QL package is on version 6.2.2. When I first attempted to mount one of the legacy buckets, the tool failed immediately:
S3QL breaks file data into compressed, deduplicated chunks and coordinates all filesystem structures through a central SQLite metadata database stored in S3 as an object named When I tried running the suggested upgrade command, I was blocked again:
This created a classic chicken-and-egg problem. To upgrade the filesystem to work with modern S3QL, I needed the historical S3QL binaries to run fsck. Moreover, executing an irreversible schema migration directly against production S3 buckets is high-risk. A failed upgrade can permanently corrupt the metadata, turning encrypted data blocks into unrecoverable garbage. I established clear constraints for this recovery operation:
The S3QL Time Machine ArchitectureInstead of fighting host dependencies or risking an in-place database upgrade on AWS, I designed the "S3QL Time Machine" approach: run the required historical versions of S3QL inside isolated Docker containers. The container environment:
To allow the container to provide a FUSE mount back to the host, the container is launched with:
The shared volume propagation ensures that when Technical Obstacles Encountered and DebuggedDuring the recovery process across the different buckets, several subtle technical issues arose that required diagnosis. A. S3 Object Metadata and Version IdentificationTo inspect bucket metadata without mounting, I wrote a Python inspection tool using boto3. Modern S3QL formats metadata using a custom raw2 format split across B. Python ConfigParser Passphrase SyntaxWhen mounting another bucket,
S3QL uses Python's configparser with BasicInterpolation enabled by default. Because the passphrase contained a literal percent sign ( C. Remote Stale Locks (Exit Code 31)When attempting mounts on buckets that were previously aborted or not cleanly unmounted in 2020, mount.s3ql halted:
S3QL tracks an Attempting to mount failed. Running modern
This scanned the SQLite metadata tables, corrected inode size inconsistencies, cleared the stale lock, and uploaded clean metadata back to S3, allowing subsequent mounts to proceed. D. FUSE Ownership and Extraction PermissionsOnce mounted, running rsync from the host hit Permission denied errors on directories and files. FUSE mounts default to restricting access to the user that mounted the filesystem (root inside the container). Adding the Outcome and ConclusionUsing this containerized isolation technique, I successfully recovered and extracted 4 buckets of encrypted data, totaling just over a 1TB footprint in S3. The objective has been achieved. Investing the time to reverse-engineer the versioning constraints and wrapping the legacy runtime with Docker, I unlocked all of my archived data without paying ongoing AWS storage fees, without risking metadata corruption, and without destabilizing my host operating system. However, AWS did manage to ding me one last time, charging me for the exfil bandwith! AI Use DisclosureAn agentic coding harness was used in the creation of the s3ql time machine code. Architectual decision records, and deep research artifacts can be found in the repository's |
||
| 2 Original | |||
| Post Reply |
Back to top |