MAKEFS(8)

πŸ“¦
this version Β· 4 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble, ubuntu resolute, ubuntu stonking

✨ MAKEFS(8) ✨

okay so bestie, welcome to the makefs page from the System Manager's Manual πŸ’– this is the one that builds you a whole filesystem image out of a plain ol' directory tree, and I am obsessed.


πŸŽ€ NAME πŸŽ€

makefs β€” create a filesystem image from a directory tree


πŸ¦‹ SYNOPSIS πŸ¦‹

makefs [-x] [-B byte-order] [-b free-blocks] [-d debug-mask]
       [-F specfile] [-f free-files] [-M minimum-size] [-m maximum-size]
       [-N userdb-dir] [-o fs-options] [-S sector-size] [-s image-size]
       [-t fs-type] [-T maximum-time] image-file directory

🌸 DESCRIPTION 🌸

So the utility makefs creates a filesystem image into image-file from the directory tree directory. And the best part? No special devices or privileges are required to do this. Literally none. You just... do it. No root, no loopback device drama, nothing. it's giving effortless πŸ’…

The options are as follows:

  • -B byte-order β€” Set the byte order of the image to byte-order. Valid byte orders are β€˜4321’, β€˜big’, or β€˜be’ for big endian, and β€˜1234’, β€˜little’, or β€˜le’ for little endian. Some filesystems may have a fixed byte order; in those cases this argument will be ignored. (not it being ignored, rip πŸ™ˆ)
  • -b free-blocks β€” Ensure that a minimum of free-blocks free blocks exist in the image. An optional β€˜%’ suffix may be provided to indicate that free-blocks indicates a percentage of the calculated image size.
  • -d debug-mask β€” Enable various levels of debugging, depending upon which bits are set in debug-mask. XXX: document these. (yeah bestie they literally wrote "XXX: document these", iconic honestly πŸ’€)
  • -F specfile β€” Use specfile as an mtree(8) β€˜specfile’ specification.

If a specfile entry exists in the underlying filesystem, its permissions and modification time will be used unless specifically overridden by the specfile. An error will be raised if the type of entry in the specfile conflicts with that of an existing entry.

In the opposite case (where a specfile entry does not have an entry in the underlying filesystem) the following occurs: If the specfile entry is marked optional, the specfile entry is ignored. Otherwise, the entry will be created in the image, and it is necessary to specify at least the following parameters in the specfile: type, mode, gname, or gid, and uname or uid, device (in the case of block or character devices), and link (in the case of symbolic links). If time isn't provided, the current time will be used. If flags isn't provided, the current file flags will be used. Missing regular file entries will be created as zero-length files.

  • -f free-files β€” Ensure that a minimum of free-files free files (inodes) exist in the image. An optional β€˜%’ suffix may be provided to indicate that free-files indicates a percentage of the calculated image size.
  • -M minimum-size β€” Set the minimum size of the filesystem image to minimum-size.
  • -m maximum-size β€” Set the maximum size of the filesystem image to maximum-size. An error will be raised if the target filesystem needs to be larger than this to accommodate the provided directory tree. (so like, don't set it too smol, she will yell at you 😭)
  • -N dbdir β€” Use the user database text file master.passwd and group database text file group from dbdir, rather than using the results from the system's getpwnam(3) and getgrnam(3) (and related) library calls.
  • -o fs-options β€” Set filesystem specific options. fs-options is a comma separated list of options. Valid filesystem specific options are detailed below. πŸ‘‡
  • -S sector-size β€” Set the filesystem sector size to sector-size. Defaults to 512.
  • -s image-size β€” Set the size of the filesystem image to image-size.
  • -t fs-type β€” Create an fs-type filesystem image. The following filesystem types are supported:
    • ffs β€” BSD fast filesystem (default).
    • cd9660 β€” ISO 9660 filesystem.
  • -T maximum-time β€” Clamp superblock and file timestamps to maximum-time seconds since the Epoch.
  • -x β€” Exclude filesystem nodes not explicitly listed in the specfile.

Where sizes are specified, a decimal number of bytes is expected. Two or more numbers may be separated by an β€œx” to indicate a product. Each number may have one of the following optional suffixes:

  • b β€” Block; multiply by 512
  • k β€” Kibi; multiply by 1024 (1 KiB)
  • m β€” Mebi; multiply by 1048576 (1 MiB)
  • g β€” Gibi; multiply by 1073741824 (1 GiB)
  • t β€” Tebi; multiply by 1099511627776 (1 TiB)
  • w β€” Word; multiply by the number of bytes in an integer

πŸ’œ FFS-specific options πŸ’œ

ffs images have ffs-specific optional parameters that may be provided. Each of the options consists of a keyword, an equal sign (β€˜=’), and a value. The following keywords are supported:

  • avgfilesize β€” Expected average file size.
  • avgfpdir β€” Expected number of files per directory.
  • bsize β€” Block size.
  • density β€” Bytes per inode.
  • fsize β€” Fragment size.
  • maxbpg β€” Maximum blocks per file in a cylinder group.
  • minfree β€” Minimum % free.
  • optimization β€” Optimization preference; one of β€˜space’ or β€˜time’.
  • extent β€” Maximum extent size.
  • maxbpcg β€” Maximum total number of blocks in a cylinder group.
  • version β€” UFS version. 1 for FFS (default), 2 for UFS2.

🌈 CD9660-specific options 🌈

cd9660 images have ISO9660-specific optional parameters that may be provided. The arguments consist of a keyword and, optionally, an equal sign (β€˜=’), and a value. The following keywords are supported:

  • allow-deep-trees β€” Allow the directory structure to exceed the maximum specified in the spec.
  • allow-max-name β€” Allow 37 instead of 33 characters for filenames by omitting the version id.
  • allow-multidot β€” Allow multiple dots in a filename.
  • applicationid β€” Application ID of the image.
  • archimedes β€” Use the β€˜ARCHIMEDES’ extension to encode RISC OS metadata.
  • boot-info-table β€” Write a legacy 56-byte table at offset 8 into the boot image (see below).
  • boot-load-segment β€” Set load segment for the boot image.
  • bootimage β€” Filename of a boot image in the format β€œsysid;filename”, where β€œsysid” is one of β€˜i386’, β€˜mac68k’, β€˜macppc’, or β€˜powerpc’.
  • creation-date β€” Override PVD creation date.
  • effective-date β€” Override PVD effective date.
  • expiration-date β€” Override PVD expiration date.
  • generic-bootimage β€” Load a generic boot image into the first 32K of the cd9660 image.
  • hard-disk-boot β€” Boot image is a hard disk image.
  • hide-rr-moved β€” Assign the RR_MOVED directory a rock ridge name of the empty string instead of the default .rr_moved.
  • keep-bad-images β€” Don't throw away images whose write was aborted due to an error. For debugging purposes.
  • label β€” Label name of the image.
  • modification-date β€” Override PVD modification date.
  • no-boot β€” Boot image is not bootable.
  • no-emul-boot β€” Boot image is a β€œno emulation” ElTorito image.
  • no-trailing-padding β€” Do not pad the image (apparently Linux needs the padding).
  • omit-trailing-period β€” Violate the standard, do not append a trailing period to filenames without an extension. (bestie that's literally a crime, but ok, do you πŸ’€)
  • preparer β€” Preparer ID of the image.
  • publisher β€” Publisher ID of the image.
  • rockridge β€” Use RockRidge extensions (for longer filenames, etc.).
  • rr-squash β€” Force uid 0, gid 0, and rationalised permission bits for RockRidge entries.
  • volumeid β€” Volume set identifier of the image.

The boot-info-table currently consists of the following fields (all 7.3.1 numbers), offsets relative to the boot image:

  • 0 β€” 8 bytes: kept as is, not part of checksum
  • 8 β€” LBA of PVD
  • 12 β€” LBA of boot image
  • 16 β€” Size in bytes of boot image
  • 20 β€” 32-bit additive sum of all 32-bit words of boot image
  • 24 β€” 40 reserved bytes (MBZ)
  • 64 β€” Begin of checksummed data, kept as is

Dates (to override) are in 8.4.26.1 format (YYYYmmddHHMMSS00) and Universal Time, i.e. with zero offset from Greenwich Mean Time.


πŸ‘‘ SEE ALSO πŸ‘‘

strsuftoll(3), installboot(8), mtree(8), newfs(8)


⭐ HISTORY ⭐

The makefs utility appeared in NetBSD 1.6.

Support for overriding PVD dates and the boot info table was added in MirBSD 11.


🫢 AUTHORS 🫢

  • Luke Mewburn <lukem@NetBSD.org> (original program)
  • Daniel Watt,
  • Walter Deignan,
  • Ryan Gabrys,
  • Alan Perez-Rathke,
  • Ram Vedam (cd9660 support)
  • Thorsten Glaser <tg@mirbsd.org>

⚠️ CAVEATS ⚠️

makefs may be limited to images less than 2 GiB in size due to internal use of the long type. so like, know your limits bestie, fr fr 😭

and that's the whole page!! this one shipped from Debian, dated December 25, 2018, and it lives at MAKEFS(8) β€” slay, periodt πŸ’…βœ¨πŸ¦‹

πŸ“¦ where this page comes from