GEFS on OpenBSD: A Early Preview
GEFS on OpenBSD: An Initial Preview
Disclaimer: To be clear from the start—I am
notnot suggesting that this be integrated into the main source tree just yet.
Overview: What is GEFS?
As some of you may have noticed during my presentation at EuroBSD, I have developed a preliminary, albeit buggy and unstable, preview of GEFS running on OpenBSD.
Warning: This port is absolutely not production-ready. You should expect data loss, particularly when the system encounters an error.
That said, the project has progressed to a point where most remaining hurdles are well-understood, and it is now open for community scrutiny and testing.
Technical Specifications
GEFS is a modern filesystem characterized by the following properties:
- Crash-safe architecture.
- Snapshotting capabilities.
- Copy-on-Write (CoW) mechanism.
Originally authored for 9front, I am currently migrating it to OpenBSD. The codebase is relatively lean, currently sitting at under 9,000 lines of kernel code, though this will expand as missing features are implemented.
Documentation: You can find the full technical description at https://orib.dev/gefs.pdf.
Porting Strategy
I am implementing this as a legitimate in-kernel filesystem. My approach is to keep the core data structures and complex logic synchronized between Plan 9 and OpenBSD.
While the code is essentially copied and pasted, the goal is for the two versions to "rhyme." This ensures that bug fixes can be shared across platforms without the overhead of a complex abstraction layer, which I believe would be a mistake.
Current Challenges & Roadmap
The following table summarizes the current state of various filesystem components:
| Feature | Status | Primary Requirement |
|---|---|---|
| Consistency | ⚠️ Unstable | Superblock write must follow snapshot writes |
| Error Handling | ❌ Incomplete | Needs conversion from 9front style to OpenBSD style |
| POSIX | ⚠️ Partial | Adjusting constraints for POSIX compliance |
| Hardlinks | ⏳ Pending | Implement per-file reference counting |
| Kqueue | ⏳ Pending | Implement per-file reference counting |
| NFS | ⏳ Pending | Integration of specific hooks |
Detailed Problem Breakdown
- The Consistency Protocol: This is the primary unknown. To ensure safety, the write sequence must follow a specific logic: I still need to backport specific write-ordering fixes from 9front.
- Kernel Integration:
- Error handling is currently mostly commented out and requires a meticulous, piece-by-piece conversion.
- Certain global variables are being used, which currently limits the system to a single mount.
- Userspace & Tooling:
- Currently, creating a filesystem or running
fsckrequires booting 9front in a VM—which is not a viable long-term strategy. - Snapshot management and
ioctlinterfaces need to be developed for userspace.
- Currently, creating a filesystem or running
- Missing "Niceties":
- Bootloader support
- Boot environments
- Quotas (Crucial for preventing LLVM from consuming space in
/usr/obj)
Current Focus
I am intentionally avoiding KNF (Kernel Normal Form) fixes for now. I will migrate the code as I touch it, but keeping it close to the original source is a priority until it is ready for upstreaming. I am also investigating ways to optimize the slow deletion of very large files.
Installation and Acquisition
You can obtain the filesystem as a single patch here: https;//orib.dev/gefs.diff.
Because my shithub server is quite small, please avoid cloning the full repository directly from it to prevent overloading. Instead, clone the official OpenBSD source and pull the updates from my remote.
Execution Steps:
# 1. Clone the official upstream source
git clone https://github.com/openbsd/src
cd src
# 2. Add the GEFS remote and fetch updates
git remote add gefs git://shithub.us/ori/openbsd
git fetch gefs
# 3. Create a local branch for GEFS
git checkout -b gefs gefs/gefs
Note: I will be rebasing and force-pushing the gefs branch periodically to stay current with openbsd-current, so be aware that commit IDs will change.