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

apfs driver

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

CI

btrfs driver

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

exfat driver

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

ext4 driver

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

fat32 driver

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

iso9660 driver

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

ntfs driver

Windows NT filesystem โ€” minimal in-image blob model (NOT the real NTFS on-disk format). Read, write, format and volume label.

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.

uefi driver

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

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.

xfs driver

High-performance journaling filesystem โ€” XFS v5 (CRC32c, ftype). Read, write, format, symlinks and volume label.

zfs driver

Copy-on-write pooled storage filesystem โ€” single pool / single vdev (test-oriented subset). Read, write, format and snapshots.

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.