Manual Page Search Parameters

MAKEFS(8) System Manager's Manual MAKEFS(8)

makefscreate a file system image from a directory tree or a mtree manifest

makefs [-DxZ] [-B endian] [-b free-blocks] [-d debug-mask] [-F mtree-specfile] [-f free-files] [-M minimum-size] [-m maximum-size] [-N userdb-dir] [-O offset] [-o fs-options] [-R roundup-size] [-S sector-size] [-s image-size] [-T timestamp] [-t fs-type] image-file directory | manifest [extra-directory ...]

The utility makefs creates a file system image into image-file from the directory tree directory or from the mtree manifest manifest. If any optional directory trees are passed in the extra-directory arguments, then the directory tree of each argument will be merged into the directory or manifest first before creating image-file. No special devices or privileges are required to perform this task.

The options are as follows:

endian
Set the byte order of the image to endian. Valid byte orders are ‘4321’, ‘big’, or ‘be’ for big endian, and ‘1234’, ‘little’, or ‘le’ for little endian. Some file systems may have a fixed byte order; in those cases this argument will be ignored.
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.
Treat duplicate paths in an mtree manifest as warnings not error. If this flag is specified more than once, warnings about duplicate paths are not printed at all.
debug-mask
Enable various levels of debugging, depending upon which bits are set in debug-mask. This option is intended for source debugging. debug-mask is a bit map defined in the header file makefs.h. See the source for usage, and look for defines starting with DEBUG_.
mtree-specfile
To create an image from a list of files in an mtree format manifest, specify it as the last argument on the command line, not as a the argument to -F.

Use mtree-specfile as an mtree(8) ‘specfile’ specification. This option has no effect when the image is created from a mtree manifest rather than a directory.

If a specfile entry exists in the underlying file system, 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 file system) the following occurs: If the specfile entry is marked , 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: , , , or , and or , and (in the case of symbolic links). If is not provided, the current time will be used. If is not provided, the current file flags will be used. Missing regular file entries will be created as zero-length files.

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.
minimum-size
Set the minimum size of the file system image to minimum-size.
maximum-size
Set the maximum size of the file system image to maximum-size. An error will be raised if the target file system needs to be larger than this to accommodate the provided directory tree.
userdb-dir
Use the user database text file master.passwd and group database text file group from userdb-dir, rather than using the results from the system's getpwnam(3) and getgrnam(3) (and related) library calls.
offset
Instead of creating the filesystem at the beginning of the file, start at offset. Valid only for ffs and msdos.
fs-options
Set file system specific options. fs-options is a comma separated list of options. Valid file system specific options are detailed below.
Deprecated. Create a sparse file for ffs. This is the same as the preferred -Z flag.
roundup-size
Round the image up to roundup-size. roundup-size should be a multiple of the file system block size. This option only applies to the ffs file system type.
sector-size
Set the file system sector size to sector-size. Defaults to 512.
image-size
Set the size of the file system image to image-size. This is equivalent to setting both the minimum (-M) and the maximum (-m) sizes to the same value. For ffs and msdos the image-size does not include the offset. offset is not included in that size.
timestamp
Specify a timestamp to be set for all filesystem files and directories created so that repeatable builds are possible. The timestamp can be a pathname, where the timestamps are derived from that file, or an integer value interpreted as the number of seconds from the Epoch. Note that timestamps specified in an mtree(5) spec file, override the default timestamp.
fs-type
Create an fs-type file system image. The following file system types are supported:
BSD fast file system (default).
ISO 9660 file system.
FAT12, FAT16, or FAT32 file system.
ZFS pool containing one or more file systems.
Exclude file system nodes not explicitly listed in the specfile.
Create a sparse file for ffs. This is useful for virtual machine images.

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 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:

Expected average file size.
Expected number of files per directory.
Block size.
Bytes per inode. If unset, will allocate the minimum number of inodes to represent the filesystem if no free space has been requested (free blocks or minimum size set); otherwise the larger of the newfs defaults or what is required by the free inode parameters if set.
Fragment size.
Label name of the image.
Maximum blocks per file in a cylinder group.
Minimum % free.
Optimization preference; one of ‘space’ or ‘time’.
Maximum extent size.
Maximum total number of blocks in a cylinder group.
UFS version. 1 for FFS (default), 2 for UFS2.
0 for disable (default), 1 for enable

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 the directory structure to exceed the maximum specified in the spec.
Allow illegal characters in filenames. This option is not implemented.
Allow lowercase characters in filenames. This option is not implemented.
Allow 37 instead of 33 characters for filenames by omitting the version id.
Allow multiple dots in a filename.
Application ID of the image.
Boot image directory. This option is not implemented.
Write an MBR partition table to the image to allow older CHRP hardware to boot.
Set load segment for the boot image.
Filename of a boot image in the format “sysid;filename”, where “sysid” is one of ‘efi’, ‘i386’, ‘mac68k’, ‘macppc’, or ‘powerpc’.
Load a generic boot image into the first 32K of the cd9660 image.
Boot image is a hard disk image.
An integer representing the ISO 9660 interchange level where “level” is either ‘1’ or ‘2’. “level” ‘3’ is not implemented.
Do not discard images whose write was aborted due to an error. For debugging purposes.
Label name of the image.
Boot image is not bootable.
Boot image is a “no emulation” ElTorito image.
Do not pad the image (apparently Linux needs the padding).
Omit trailing periods in filenames.
Set platform ID of section header entry of the boot image.
Preparer ID of the image.
Publisher ID of the image.
Use RockRidge extensions (for longer filenames, etc.).
Turns on verbose output.
Volume set identifier of the image.

msdos images have MS-DOS-specific optional parameters that may be provided. The arguments consist of a keyword, an equal sign (‘=’), and a value. The following keywords are supported (see newfs_msdos(8) for more details):

Location of the backup boot sector.
Block size.
Bootstrap file.
Bytes per sector.
Create file size.
Directory entries.
Drive heads.
FAT type (12, 16, or 32).
Preset drive parameters for standard format floppy disks (160, 180, 320, 360, 640, 720, 1200, 1232, 1440, or 2880).
Hidden sectors.
Location of the info sector.
Media descriptor.
Number of FATs.
OEM string.
Offset in device. This option will be ignored if -O is set to a positive number.
Reserved sectors.
Sectors per cluster.
Sectors per FAT.
Sectors per track.
File System size.
Volume ID.
Volume Label.

Note: ZFS support is currently considered experimental. Do not use it for anything critical.

The image created by makefs contains a ZFS pool with a single vdev of type ‘disk’. The root dataset is always created implicitly and contains the entire input directory tree unless additional datasets are specified using the options described below.

The arguments consist of a keyword, an equal sign (‘=’), and a value. The following keywords are supported:

ashift
The base-2 logarithm of the minimum block size. Typical values are 9 (512B blocks) and 12 (4KB blocks). The default value is 12.
bootfs
The name of the bootable dataset for the pool. Specifying this option causes the ‘bootfs’ property to be set in the created pool.
mssize
The size of metaslabs in the created pool. By default, makefs allocates large (up to 512MB) metaslabs with the expectation that the image will be auto-expanded upon first use. This option allows the default heuristic to be overridden.
verify-txgs
Prompt OpenZFS to verify pool metadata during import. This is disabled by default as it may significantly increase import times.
poolname
The name of the ZFS pool. This option must be specified.
rootpath
An implicit path prefix added to dataset mountpoints. By default it is /<poolname>. For creating bootable pools, the rootpath should be set to /. At least one dataset must have a mountpoint equal to rootpath.
fs
Create an additional dataset. This option may be specified multiple times. The argument value must be of the form <dataset>[;<prop1=v1>[;<prop2=v2>[;...]]], where dataset is the name of the dataset and must belong to the pool's namespace. For example, with a pool name of ‘test’ all dataset names must be prefixed by ‘test/’. A dataset must exist at each level of the pool's namespace. For example, to create ‘test/foo/bar’, ‘test/foo’ must be created as well.

The dataset mountpoints determine how the datasets are populated with files from the staged directory tree. Conceptually, all datasets are mounted before any are populated with files. The root of the staged directory tree is mapped to rootpath.

Dataset properties, as described in zfsprops(7), may be specified following the dataset name. The following properties may be set for a dataset:

atime
 
canmount
 
exec
 
mountpoint
 
setuid
 

mtree(5), zfsconcepts(7), zfsprops(7), zpoolprops(7), mtree(8), newfs(8)

The makefs utility appeared in NetBSD 1.6. It was ported to FreeBSD and first appeared in FreeBSD 8.0.

Luke Mewburn <lukem@NetBSD.org> (original program),
Daniel Watt,
Walter Deignan,
Ryan Gabrys,
Alan Perez-Rathke,
Ram Vedam (cd9660 support),
Christos Zoulas (msdos support),
Mark Johnston (zfs support).

January 19, 2024 dev