{"id":37143745,"url":"https://github.com/pilat/go-ext4fs","last_synced_at":"2026-01-14T16:52:54.687Z","repository":{"id":326963821,"uuid":"1107271656","full_name":"pilat/go-ext4fs","owner":"pilat","description":"Pure Go ext4 filesystem builder for creating disk images without external dependencies","archived":false,"fork":false,"pushed_at":"2026-01-01T16:45:50.000Z","size":167,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-06T22:28:41.634Z","etag":null,"topics":["disk-image","ext4","filesystem","golang","no-cgo"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pilat.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-30T22:25:22.000Z","updated_at":"2026-01-01T16:45:54.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/pilat/go-ext4fs","commit_stats":null,"previous_names":["pilat/ext4"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pilat/go-ext4fs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pilat%2Fgo-ext4fs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pilat%2Fgo-ext4fs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pilat%2Fgo-ext4fs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pilat%2Fgo-ext4fs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pilat","download_url":"https://codeload.github.com/pilat/go-ext4fs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pilat%2Fgo-ext4fs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28426810,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T16:38:47.836Z","status":"ssl_error","status_checked_at":"2026-01-14T16:34:59.695Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["disk-image","ext4","filesystem","golang","no-cgo"],"created_at":"2026-01-14T16:52:54.001Z","updated_at":"2026-01-14T16:52:54.680Z","avatar_url":"https://github.com/pilat.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ext4fs\n\nPure Go ext4 filesystem implementation for creating disk images without external dependencies.\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/pilat/go-ext4fs.svg)](https://pkg.go.dev/github.com/pilat/go-ext4fs)\n[![Go Report Card](https://goreportcard.com/badge/github.com/pilat/go-ext4fs)](https://goreportcard.com/report/github.com/pilat/go-ext4fs)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Go Version](https://img.shields.io/github/go-mod/go-version/pilat/go-ext4fs)](https://github.com/pilat/go-ext4fs)\n[![CI](https://github.com/pilat/go-ext4fs/actions/workflows/ci.yml/badge.svg)](https://github.com/pilat/go-ext4fs/actions/workflows/ci.yml)\n[![Coverage](https://codecov.io/github/pilat/go-ext4fs/graph/badge.svg)](https://codecov.io/github/pilat/go-ext4fs)\n![CodeRabbit Pull Request Reviews](https://img.shields.io/coderabbit/prs/github/pilat/go-ext4fs?utm_source=oss\u0026utm_medium=github\u0026utm_campaign=pilat%2Fgo-ext4fs\u0026labelColor=171717\u0026color=FF570A\u0026link=https%3A%2F%2Fcoderabbit.ai\u0026label=CodeRabbit+Reviews)\n\n## Overview\n\nA pure Go library for **creating** ext4 filesystem images programmatically. Designed for building disk images for virtual machines and embedded systems without requiring root privileges or external tools like `mke2fs`.\n\n\u003e **Primary use case**: Creating new ext4 images from scratch. Limited support exists for modifying images previously created by this library (e.g., updating `/init` binary). Standard ext4 filesystems created by `mke2fs` cannot be opened due to unsupported features (journaling, 64-bit, flex_bg).\n\n## Features\n\n- **Pure Go**: No external dependencies or system calls\n- **Extent-based**: Modern ext4 extent trees for efficient block mapping\n- **Extended attributes**: Full xattr support for security labels and metadata\n- **Symlinks**: Both fast (inline) and slow (block-based) symlinks\n- **Simple API**: Easy to use for creating filesystem images programmatically\n- **Docker integration**: End-to-end testing with real Linux kernel verification\n\n## Installation\n```bash\ngo get github.com/pilat/go-ext4fs\n```\n\n## Quick Start\n\n### Creating a New Image\n```go\npackage main\n\nimport \"github.com/pilat/go-ext4fs\"\n\nfunc main() {\n    // Create 64MB ext4 image\n    img, err := ext4fs.New(\n        ext4fs.WithImagePath(\"disk.img\"),\n        ext4fs.WithSizeInMB(64),\n    )\n    if err != nil {\n        panic(err)\n    }\n    defer img.Close()\n\n    // Create directories and files\n    etcDir, _ := img.CreateDirectory(ext4fs.RootInode, \"etc\", 0755, 0, 0)\n    img.CreateFile(etcDir, \"hostname\", []byte(\"myhost\\n\"), 0644, 0, 0)\n    img.CreateSymlink(etcDir, \"hosts\", \"/etc/hostname\", 0, 0)\n    img.SetXattr(etcDir, \"user.comment\", []byte(\"System configuration\"))\n\n    // Finalize and save\n    if err := img.Save(); err != nil {\n        panic(err)\n    }\n}\n```\n\n### Modifying an Existing Image\n```go\npackage main\n\nimport \"github.com/pilat/go-ext4fs\"\n\nfunc main() {\n    // Open existing image (must have been created by this library)\n    img, err := ext4fs.Open(ext4fs.WithExistingImagePath(\"disk.img\"))\n    if err != nil {\n        panic(err)\n    }\n    defer img.Close()\n\n    // Modify: delete old file, add new one\n    newInit := []byte(\"#!/bin/sh\\nexec /bin/sh\\n\")\n    img.Delete(ext4fs.RootInode, \"old-init\")\n    img.CreateFile(ext4fs.RootInode, \"init\", newInit, 0755, 0, 0)\n\n    if err := img.Save(); err != nil {\n        panic(err)\n    }\n}\n```\n\n## Limitations\n\nThis library is optimized for creating simple disk images for small VMs. The following ext4 features are not implemented:\n\n| Feature | Impact |\n|---------|--------|\n| Journaling | No crash recovery (not needed for image creation) |\n| 64-bit block addresses | Maximum filesystem size ~16 TB |\n| Extent tree depth \u003e 1 | Maximum ~1,360 extents per file; sufficient for contiguous files up to ~170 TB |\n| HTree directory indexing | Linear directory scan; fine for small directories |\n| Inline data | Small files use regular blocks |\n| Encryption | No at-rest encryption support |\n| Quotas | No user/group quota tracking |\n\nFor most VM use cases (boot disks, configuration filesystems, small data volumes), these limitations have no practical impact.\n\n## Verification\n\nCreated images can be verified using standard Linux tools:\n```bash\n# Check filesystem integrity\ne2fsck -n -f disk.img\n\n# Mount and inspect (requires root)\nsudo mount -o loop disk.img /mnt\n\n# View filesystem info\ndumpe2fs disk.img\n```\n\n## License\n\nMIT License - see [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpilat%2Fgo-ext4fs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpilat%2Fgo-ext4fs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpilat%2Fgo-ext4fs/lists"}