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-image image β€” use this image as a starting point. the prequel. the origin story πŸ¦‹
  • -d, --root directory[:path] β€” add the given directory and contents at a particular path (by default the root).
  • -D, --devtable spec-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 -D option 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, --tarball file[:path] β€” add the given archive (tarball) contents at a particular path (by default the root). Note: if not compiled with libarchive, genext2fs will 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-blocks blocks β€” size of the image in blocks.
  • -B, --block-size bytes β€” size of a filesystem block in bytes.
  • -N, --number-of-inodes inodes β€” maximum number of inodes.
  • -L, --volume-label name β€” set the volume label for the filesystem. name your baby πŸŽ€
  • -i, --bytes-per-inode ratio β€” used to calculate the maximum number of inodes from the available blocks.
  • -m, --reserved-percentage N β€” number of reserved blocks as a percentage of size. reserving 0 blocks will prevent creation of the "lost+found" directory. so like, no lost+found for you 🫢
  • -o, --creator-os name β€” value for creator OS field in superblock.
  • -g, --block-map path β€” generate a block map file for this path.
  • -e, --fill-value value β€” fill unallocated blocks with value.
  • -z, --allow-holes β€” make files with holes. holes!! πŸ•³οΈβœ¨
  • -f, --faketime β€” use a timestamp of 0 for inode and filesystem creation, instead of the present. useful for testing. see also SOURCE_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 -d option, making them all owned by root:root.
  • -P, --squash-perms β€” squash permissions of inodes added using the -d option. 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 β€” print genext2fs version.
  • -h, --help β€” display help.

🌈 ENVIRONMENT 🌈


πŸ’œ 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