loop
lib
Loop devices via /dev/loop-control and LOOP_* ioctls โ attach, detach, query status and resize backing files. No losetup, no cgo.
Pure-Go Linux kernel-ioctl control โ no cgo, no shelling out.
go-fsctl is a family of independent, dependency-free Go modules that drive
Linux storage subsystems straight through their kernel ioctl interfaces โ loop
devices, device-mapper, btrfs and OpenZFS. No losetup, dmsetup,
btrfs(8) or libzfs; no C toolchain, no subprocess parsing โ just the
kernel and Go.
Every module talks to the kernel the same way the reference CLIs do โ by opening a control device and issuing the subsystem's ioctls directly. No shelling out, no scraping human-readable output, no cgo wrapper around a C library.
// loop: attach a backing file via /dev/loop-control + LOOP_* ioctls
dev, err := loop.Attach(ctx, "disk.img", loop.Options{ReadOnly: false})
if err != nil {
return err
}
defer dev.Detach()
fmt.Println(dev.Path()) // e.g. /dev/loop7One module per kernel subsystem. Each is pure Go with CGO_ENABLED=0,
100% test coverage and green CI across all six 64-bit architectures.
loop
libLoop devices via /dev/loop-control and LOOP_* ioctls โ attach, detach, query status and resize backing files. No losetup, no cgo.
dm
libDevice-mapper via /dev/mapper/control and DM_* ioctls โ linear, striped, crypt, thin and verity targets with scrub-style status. No dmsetup.
btrfs
libbtrfs via BTRFS_IOC_* ioctls on directory fds โ subvolumes, snapshots, scrub, balance, qgroups and send. No btrfs(8).
zfs
libOpenZFS via /dev/zfs and ZFS_IOC_* ioctls โ pools, datasets, encryption, send/recv and clone. No libzfs, no cgo.
cowclone
libCopy-on-write file cloning via APFS clonefile(2) and Linux FICLONE reflink (btrfs, XFS, OpenZFS 2.2+), with a transparent byte-copy fallback everywhere else. No cgo.
Every module is pure Go with CGO_ENABLED=0 and drives the kernel
directly through ioctls โ no losetup, dmsetup, btrfs(8) or
libzfs, and no subprocess output to parse. Each repo holds at 100% test coverage and
builds green on amd64, arm64, riscv64, loong64, ppc64le and s390x. BSD-3-Clause throughout.