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

     makefs - create a file system image from a directory tree

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

     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:

     -t fs-type
           Create an fs-type file system image.  The following file system
           types are supported:

                 ffs  BSD fast file system (default).

     -o fs-options
           Set file system specific options.  fs-options is a comma separated
           list of options.  Valid file system specific options are detailed

     -d debug-mask
           Enable various levels of debugging, depending upon which bits are
           set in debug-mask.  XXX: document these

     -B byte-order
           Set the byte order of the image to byte-order.  Valid byte orders
           are `big' or `be' for big endian, and `little' or `le' for little
           endian.  Some file systems may have a fixed byte order; in those
           cases this argument will be ignored.

     -S sector-size
           Set the file system sector size to sector-size.  Defaults to 512.

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

     -s image-size
           Set the size of the file system image to image-size.

     -b free-blocks
           Ensure that a minimum of free-blocks free blocks exist in the im-
           age.  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 free files (inodes) exist in
           the image.  An optional `%' suffix may be provided to indicate that
           free-blocks indicates a percentage of the calculated image size

     -F specfile
           Use specfile as an mtree(8) `specfile' specification.

           If a specfile entry exists in the underlying file system, its per-
           missions 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 spec-
           file entry is marked optional, the specfile entry is ignored.  Oth-
           erwise, 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 regu-
           lar file entries will be created as zero-length files.

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

     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 suffices:
           b    Block; multiply by 512
           k    Kilo; multiply by 1024 (1 KB)
           m    Mega; multiply by 1048576 (1 MB)
           g    Giga; multiply by 1073741824 (1 GB)
           t    Tera; multiply by 1099511627776 (1 TB)
           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 equals sign (`='), and a
     value.  The following keywords are supported:

           avgfilesize   Expected average file size
           avgfpdir      Expected number of files per directory
           bsize         Block size
           cpg           Cylinders per group
           density       Bytes per inode
           fsize         Fragment size
           maxbpg        Maximum blocks per cylinder group
           minfree       Minimum % free
           nsectors      Number of sectors
           ntracks       Number of tracks
           optimization  Optimization preference; one of `space' or `time'.
           rotdelay      Rotational delay
           rpm           Revolutions per minute
           nrpos         Number of rotational positions

     mtree(8), newfs(8)

     The makefs utility appeared in NetBSD 1.6.

     Luke Mewburn <>

NetBSD 1.6                     February 8, 2002                              2

You can also request any man page by name and (optionally) by section:


Use the DEFAULT collection to view manual pages for third-party software.

©1994 Man-cgi 1.15, Panagiotis Christias
©1996-2019 Modified for NetBSD by Kimmo Suominen