MAKEFS(8)
β¨ 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:
-Bbyte-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 π)-bfree-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.-ddebug-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 π)-Fspecfile β 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.
-ffree-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.-Mminimum-size β Set the minimum size of the filesystem image to minimum-size.-mmaximum-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 π)-Ndbdir β Use the user database text filemaster.passwdand group database text filegroupfrom dbdir, rather than using the results from the system's getpwnam(3) and getgrnam(3) (and related) library calls.-ofs-options β Set filesystem specific options. fs-options is a comma separated list of options. Valid filesystem specific options are detailed below. π-Ssector-size β Set the filesystem sector size to sector-size. Defaults to512.-simage-size β Set the size of the filesystem image to image-size.-tfs-type β Create an fs-type filesystem image. The following filesystem types are supported:ffsβ BSD fast filesystem (default).cd9660β ISO 9660 filesystem.
-Tmaximum-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 by512kβ Kibi; multiply by1024(1 KiB)mβ Mebi; multiply by1048576(1 MiB)gβ Gibi; multiply by1073741824(1 GiB)tβ Tebi; multiply by1099511627776(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.1for FFS (default),2for 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β Allow37instead of33characters 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 offset8into 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 thecd9660image.hard-disk-bootβ Boot image is a hard disk image.hide-rr-movedβ Assign theRR_MOVEDdirectory 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 uid0, gid0, 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 checksum8β LBA of PVD12β LBA of boot image16β Size in bytes of boot image20β 32-bit additive sum of all 32-bit words of boot image24β 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 β οΈ
makefsmay be limited to images less than 2 GiB in size due to internal use of thelongtype. 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
- debian bookworm: makefs 20190105-3
- debian trixie: makefs 20190105-3
- ubuntu jammy: makefs 20190105-3
- ubuntu noble: makefs 20190105-3
- ubuntu resolute: makefs 20190105-3build1
- ubuntu stonking: makefs 20190105-3build1
- Copyright (c) 2001-2003 Wasabi Systems, Inc
- Copyright (c) 2008, 2009, 2010, 2016, 2018 mirabilos <m@mirbsd.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms