GENEXT2FS(8)
π GENEXT2FS(8) π
ok so this is the manual for genext2fs, from the System Manager's Manual β and bestie, it's the ext2 filesystem generator for embedded systems. sit down, grab a strawberry, we're doing this πβ¨
πΈ NAME πΈ
genext2fs β ext2 filesystem generator for embedded systems π¦
β¨ SYNOPSIS β¨
genext2fs [ options ] [ output-image ]
π DESCRIPTION π
so here's the whole vibe: genext2fs generates an ext2 filesystem as a normal (non-root) user. literally no cap. it does not require you to mount the image file to copy files onto it, and it also does not require you to become the superuser to make device nodes. you just... do it. as yourself. main character energy π
the filesystem is created either from scratch, or from an already existing one if you specify it with the -x option. then each -d and -D option successively adds a "layer" to the image. stacking layers like it's a little outfit π
the filesystem image gets created in the file output-image. if you don't specify one, it is sent to stdout. iykyk.
by default, the maximum number of inodes in the filesystem is the minimum number required to accommodate the initial contents. the way that works is: a minimal filesystem (typically read-only) can be created with minimal free inodes. if you need them, free inodes can be added by passing the relevant options. and the filesystem image size in blocks can be minimised by trial and error. yes, trial and error. it's giving science π§ͺ
π OPTIONS π
-x,--starting-imageimage β use this image as a starting point. the prequel. the origin story π¦-d,--rootdirectory[:path] β add the given directory and contents at a particular path (by default the root).-D,--devtablespec-file[:path] β use spec-file to specify inodes to be added, at the given path (by default the root), including files, directories and special files like devices. if the specified files are already present in the image, their ownership and permission modes will be adjusted accordingly β and heads up, this can only occur when the-Doption appears after the options that create the specified files. furthermore, you can use a single table entry to create many devices with a range of minor numbers (see examples below). all specified inodes receive the mtime of spec-file itself. iconic.-a,--tarballfile[:path] β add the given archive (tarball) contents at a particular path (by default the root). Note: if not compiled withlibarchive,genext2fswill use a builtin tarball parser with very primitive capabilities (e.g. no sparse file support, generally no support other than for modern GNU tar without fancy options). so like, know which one you got, bestie π-b,--size-in-blocksblocks β size of the image in blocks.-B,--block-sizebytes β size of a filesystem block in bytes.-N,--number-of-inodesinodes β maximum number of inodes.-L,--volume-labelname β set the volume label for the filesystem. name your baby π-i,--bytes-per-inoderatio β used to calculate the maximum number of inodes from the available blocks.-m,--reserved-percentageN β number of reserved blocks as a percentage of size. reserving0blocks will prevent creation of the"lost+found"directory. so like, no lost+found for you π«Ά-o,--creator-osname β value for creator OS field in superblock.-g,--block-mappath β generate a block map file for this path.-e,--fill-valuevalue β fill unallocated blocks with value.-z,--allow-holesβ make files with holes. holes!! π³οΈβ¨-f,--faketimeβ use a timestamp of0for inode and filesystem creation, instead of the present. useful for testing. see alsoSOURCE_DATE_EPOCH. time is fake fr fr-q,--squashβ squash permissions and owners (same as-P -U). squish.-U,--squash-uidsβ squash ownership of inodes added using the-doption, making them all owned byroot:root.-P,--squash-permsβ squash permissions of inodes added using the-doption. analogous to"umask 077".-X,--xattrsβ copy extended attributes from source files into the filesystem image. by default, extended attributes are not copied.-v,--verboseβ print resulting filesystem structure. tell me everything π¬-V,--versionβ printgenext2fsversion.-h,--helpβ display help.
π ENVIRONMENT π
SOURCE_DATE_EPOCHβ standardized date for reproducible builds, seehttps://reproducible-builds.org/docs/source-date-epoch/for more information. reproducible builds are the moment, no cap β¨
π EXAMPLES π
genext2fs -b 1440 -d src /dev/fd0
all files in the src directory will be written to /dev/fd0 as a new ext2 filesystem image. you can then mount the floppy as usual. floppy disk era but make it slay πΎ
genext2fs -b 1024 -d src -D device_table.txt flashdisk.img
this example builds a filesystem from all the files in src, then device nodes are created based on the contents of the file device_table.txt.
entries in the device table take the form of:
<name> <type> <mode> <uid> <gid> <major> <minor> <start> <inc> <count>
where name is the file name and type can be one of:
f A regular file
d Directory
c Character special device file
b Block special device file
p Fifo (named pipe)
l Symbolic link
uid is the user id for the target file, gid is the group id for the target file. the rest of the entries (major, minor, etc) apply only to device special files. like, only the special ones get the extra treatment π
an example device file follows:
# name type mode uid gid major minor start inc count
/dev d 755 0 0 - - - - -
/dev/mem c 640 0 0 1 1 0 0 -
/dev/tty c 666 0 0 5 0 0 0 -
/dev/tty c 666 0 0 4 0 0 1 6
/dev/loop b 640 0 0 7 0 0 1 2
/dev/hda b 640 0 0 3 0 0 0 -
/dev/hda b 640 0 0 3 1 1 1 16
/dev/log s 666 0 0 - - - - -
this device table creates the /dev directory, a character device node /dev/mem (major 1, minor 1), and also creates /dev/tty, /dev/tty[0-5], /dev/loop[0-1], /dev/hda, /dev/hda1 to /dev/hda15 and /dev/log socket. one table, so many devices, ate π₯
π«Ά SEE ALSO π«Ά
mkfs(8), genromfs(8), mkisofs(8), mkfs.jffs2(1)
π¦ AUTHOR π¦
this manual page was written by David Kimdon <dwhedon@debian.org>, for the Debian GNU/Linux system (but may be used by others). examples provided by Erik Andersen <andersen@codepoet.org>. thank you legends π«‘π
and that's the whole page bestie β dated August 19, 2006, system manager's manual energy, GENEXT2FS(8) periodt π
β¨πΈ
π¦ where this page comes from
- alpine 3.24: genext2fs-doc 1.6.2-r0 Β· GPL-2.0-only
- fedora 44: genext2fs 1.6.2-1.fc44 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms