go-filesystems

Pure-Go filesystem drivers โ€” read & write on-disk filesystem images with no cgo and no root.

CGO_ENABLED=0 no root required one module per filesystem one shared contract BSD-3-Clause
Documentation GitHub

go-filesystems is a set of independent, dependency-free Go modules that read and write on-disk filesystem images โ€” one module per filesystem, all implementing a small shared contract. Open and inspect an image, mutate it in place, or format a fresh one โ€” entirely in Go, with no kernel mount and no C toolchain.

One small contract

Every driver implements filesystem.Filesystem from go-filesystems/interface.

type Filesystem interface {
	Close() error
	ReadFile(path string) ([]byte, error)
	ListDir(path string) ([]DirEntry, error)
	Stat(path string) (Stat, error)
	WriteFile(path string, data []byte, perm os.FileMode) error
	ReadLink(path string) (string, error)
	MkDir(path string, perm os.FileMode) error
	DeleteFile(path string) error
	DeleteDir(path string) error
	Rename(oldPath, newPath string) error
}

Repositories

The shared contract plus every filesystem driver that actually exists in the org today. Capabilities reflect what each driver implements now, not just what the on-disk format allows.

interface core

The shared filesystem.Filesystem contract every driver implements โ€” Read/Write/List/Stat/MkDir/Rename and friends. No cgo, no root.

CI

cpio core

cpio records โ€” newc, crc, odc and the old binary variant, both byte orders. Deliberately not a Filesystem: unarchive indexes into a reader it keeps open and rpm has the payload decompressed in memory, so they share the parser and each builds its own filesystem over it.

CI

hostcopy core

Copies a byte range from one driver's file into another's without holding it in memory โ€” and without passing it through this process at all when both are files of the host, where it becomes copy_file_range(2). Anything else falls back to ReadAt/WriteAt, so a caller writes one call and gets the kernel's copy when the kernel can do it.

CI

detect tool

blkid-style filesystem-type prober and driver-opener registry โ€” probes on-disk magic signatures and dispatches to a registered driver. No cgo, no libblkid.

CI

sftp tool

Pure-Go SFTP server (draft-ietf-secsh-filexfer-02 v3) exporting any Filesystem over golang.org/x/crypto/ssh โ€” reachable from every ordinary SFTP client (OpenSSH, Cyberduck, WinSCP, FileZilla, VS Code, gvfs) with nothing installed and nothing mounted. Key auth and encryption included; one image plus one process is the isolation boundary.

CI

nfs tool

NFSv3 server that exports any filesystem.Filesystem โ€” mountable on macOS, Linux and Windows with no kext, no FSKit entitlement and no root on the server side. A network protocol instead of a kernel module.

CI

webdav tool

WebDAV server (RFC 4918) that exports any filesystem.Filesystem as a net/http.Handler โ€” browsable in a browser, mountable from the Finder or Explorer, with Basic/Bearer authentication and TLS. Range reads and Content-Range partial writes go through the random-access capabilities.

CI

apfs driver

Apple File System โ€” real APFS on-disk (kext-mountable), GPT-aware. Read, write, format, symlinks, snapshots and container resize.

CI

btrfs driver

Copy-on-write Linux filesystem with snapshots and subvolumes. Single-device, CRC32c (btrfs-progs โ‰ฅ 5.x). Read, write, format.

CI

exfat driver

Extended FAT for large removable media. Read, write, format and volume label.

CI

ext4 driver

Linux ext4 โ€” extents, 64-bit block numbers, flex_bg, directory htree, journaling, metadata_csum (CRC32c). Read, write, format, symlinks, online grow/shrink.

CI

fat32 driver

FAT with 32-bit allocation โ€” the cross-platform baseline. Read, write, format and volume label.

CI

hfsplus driver

Apple HFS+ / HFSX (Mac OS Extended) โ€” big-endian catalog + extents-overflow B-trees. Read, write, format.

CI

iso9660 driver

ISO 9660 / ECMA-119 optical-disc filesystem, plus Rock Ridge (names/perms/symlinks) and Joliet (UCS-2 names). Read-only.

CI

ntfs driver

Windows NT filesystem โ€” minimal in-image blob model (NOT the real NTFS on-disk format); a separate read-only real-NTFS reader parses the genuine on-disk structures. Read, write, format and volume label.

CI

oci driver

Read-only OCI / Docker image filesystem โ€” overlays an image's tar layers (whiteouts, opaque directories, hardlinks, symlinks) and serves the merged rootfs through the shared contract. Image-as-filesystem, not an on-disk format.

CI

squashfs driver

Compressed read-only archive filesystem. SquashFS 4.0 with gzip/xz/zstd/lzo/lz4 blocks and fragments. Read and format.

CI

uefi driver

EFI System Partition (FAT-based) plus the OVMF/EDK2 NvVar variable store with time-based authenticated writes. Read, write, format.

CI

ufs driver

Unix File System (BSD) โ€” UFS2 (FreeBSD 14.x) read+write, UFS1 read. Read, write, format, symlinks.

CI

ffs driver

NetBSD/OpenBSD FFSv1/FFSv2 alias module over the ufs driver. Read, write, format.

CI

xfs driver

High-performance journaling filesystem โ€” XFS v5 (CRC32c, ftype). Read, write, format, symlinks, reflink/quotas and grow/resize.

CI

zfs driver

Copy-on-write pooled storage filesystem โ€” single pool, single vdev writer (multi-vdev/RAID-Z read-only). Read, write, format, snapshots/clones and grow/shrink.

CI

cab driver

Microsoft Cabinet (.cab), read as a filesystem โ€” no cgo.

CI

rar driver

RAR read as a filesystem, including multi-volume sets.

CI

rpm driver

RPM packages โ€” the lead, the signature and header regions, and the payload.

CI

sevenzip driver

7z through bodgit/sevenzip, and it writes โ€” the container and the entries.

CI

warc driver

WARC, the ISO 28500 web archive format โ€” reader and writer.

CI

unarchive tool

Extract any archive, everywhere Go compiles: the format is sniffed from the bytes, not the extension, and volumes are followed.

CI

smb tool

SMB2 server exporting any Filesystem โ€” mountable on Windows, macOS and Linux.

CI

s3 tool

An S3-compatible object API over any driver here.

CI

osfs driver

A host directory as a Filesystem, confined with os.Root. Every other driver here decodes a format out of an image; this one hands each call to the host kernel, relative to one directory, so a server written against the contract can serve a plain directory without a disk image in the way.

CI

overlay tool

Makes a read-only filesystem writable: changes land in a spool, cheaply, and one rewrite happens when you say so.

CI

xar driver

XAR, the macOS .pkg installer format: a gzip'd XML table of contents and a heap.

CI

Every module is pure Go with CGO_ENABLED=0 and needs no root privileges and no external mount tooling for normal operation. Each driver speaks the same small filesystem.Filesystem contract, so callers stay format-agnostic. Drivers are cross-checked against the real on-disk formats their reference tools produce. BSD-3-Clause throughout.