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

# NAME

`makefs` — create a file system image from a directory tree

# SYNOPSIS

`makefs` | [`-b` free-blocks] [`-f` free-files] [`-M` minimum-size] [`-m` maximum-size] [`-O` offset] [`-o` fs-options] [`-S` sector-size] [`-s` image-size] [`-T` timestamp] [`-t` fs-type] image-file directory

# DESCRIPTION

The utility `makefs` creates a file system image into image-file from the directory tree directory. No special devices or privileges are required to perform this task.

The options are as follows:

`-b` free-blocks
  Ensure that a minimum of 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.
`-f` free-files
  Ensure that a minimum of 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 file system image to minimum-size.
`-m` 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.
`-O` offset
  Instead of creating the file system at the beginning of the file, start at offset. Valid only for ffs and msdos.
`-o` fs-options
  Set file system specific options. fs-options is a comma separated list of options. Valid file system specific options are detailed below.
`-S` sector-size
  Set the file system sector size to sector-size. Defaults to 512.
`-s` image-size
  Set the size of the file system image to image-size.
`-T` timestamp
  Specify a timestamp to be set for all file system files and directories created so that repeatable builds are possible. The timestamp is an integer value interpreted as the number of seconds from the Epoch.
`-t` fs-type
  Create an fs-type file system image. The following file system types are supported:

  cd9660
    ISO 9660 file system.
  ffs
    BSD Fast File System (the default).
  msdos
    FAT12, FAT16, or FAT32 file system.

Sizes are specified as a decimal number of bytes and may use a multiplier, as documented in scan_scaled(3). Two or more numbers may be separated by an ‘x’ to indicate a product.

## ffs 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.
disklabel
  Name of a disk described in disktab(5). A disklabel with the information will be written at a machine dependent location in the image. The size of the file system image, the sector size and the bsize and fsize parameters are inferred from the disklabel.
extent
  Maximum extent size.
fsize
  Fragment size.
label
  Label name of the image.
maxbpcg
  Maximum total number of blocks in a cylinder group.
maxbpg
  Maximum blocks per file in a cylinder group.
minfree
  Minimum % free.
optimization
  Optimization preference: one of ‘`space`’ (default) or ‘`time`’.
rdroot
  A disklabel appropriate for a ramdisk will be built and written at a machine dependent location in the image. The filesystem will be described by a FS_BSDFFS partition ‘a’, with defaults offset=0, fsize=512, bsize=4096, minfree=0 and density=4096.
version
  UFS version. 1 for FFS (default) or 2 for UFS2.

## cd9660 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-multidot
  Allow multiple dots in a filename.
applicationid
  Application ID of the image.
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`’, ‘`macppc`’, ‘`powerpc`’, or ‘`efi`’.
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.
isolevel
  ISO Level.
label
  Label name of the image.
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
  Omit trailing periods in filenames.
preparer
  Preparer ID of the image.
publisher
  Publisher ID of the image.
rockridge
  Use RockRidge extensions (for longer filenames, etc.).
volumeid
  Volume set identifier of the image.

## msdos options

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:

`backup_sector`
  Location of the backup boot sector.
`block_size`
  Block size.
`bootstrap`
  Bootstrap file.
`bytes_per_sector`
  Bytes per sector.
`create_size`
  Create file size.
`directory_entries`
  Directory entries.
`drive_heads`
  Drive heads.
`fat_type`
  FAT type (12, 16, or 32).
`floppy`
  Preset drive parameters for standard format floppy disks (160, 180, 320, 360, 640, 720, 1200, 1232, 1440, or 2880).
`hidden_sectors`
  Hidden sectors.
`info_sector`
  Location of the info sector.
`media_descriptor`
  Media descriptor.
`num_FAT`
  Number of FATs.
`OEM_string`
  OEM string.
`offset`
  Offset in device.
`reserved_sectors`
  Reserved sectors.
`sectors_per_cluster`
  Sectors per cluster.
`sectors_per_fat`
  Sectors per FAT.
`sectors_per_track`
  Sectors per track.
`size`
  File System size.
`volume_id`
  Volume ID.
`volume_label`
  Volume Label.

# SEE ALSO

scan_scaled(3), installboot(8), newfs(8)

# HISTORY

The `makefs` utility appeared in NetBSD 1.6.

# AUTHORS

Luke Mewburn ⟨lukem@NetBSD.org⟩ (original program), Daniel Watt, Walter Deignan, Ryan Gabrys, Alan Perez-Rathke, Ram Vedam (cd9660 support), and Christos Zoulas (msdos support).

April 25, 2023 | Debian