NEWFS(8)                OpenBSD System Manager's Manual               NEWFS(8)

NAME
     newfs, mount_mfs - construct a new file system

SYNOPSIS
     newfs [-Nq] [-b block-size] [-c fragments-per-cylinder-group] [-e maxbpg]
           [-f frag-size] [-g avgfilesize] [-h avgfpdir] [-i bytes]
           [-m free-space] [-O filesystem-format] [-o optimization]
           [-S sector-size] [-s size] [-T disktype] [-t fstype] special

     mount_mfs [-b block-size] [-c fragments-per-cylinder-group] [-e maxbpg]
           [-f frag-size] [-i bytes] [-m free-space] [-o options] [-P file]
           [-s size] special node

DESCRIPTION
     Before running newfs or mount_mfs, the disk must be labeled using
     disklabel(8).  newfs builds a file system on the specified special de-
     vice, basing its defaults on the information in the disk label.  Typical-
     ly the defaults are reasonable, although newfs has numerous options to
     allow the defaults to be selectively overridden.

     The special file should be a raw device, for example /dev/rsd0a; if a
     relative path like sd0a is specified, the corresponding raw device is
     used.

     mount_mfs is used to build a file system in virtual memory and then mount
     it on a specified node.  mount_mfs exits and the contents of the file
     system are lost when the file system is unmounted.  If mount_mfs is sent
     a signal while running, for example during system shutdown, it will at-
     tempt to unmount its corresponding file system.  The parameters to
     mount_mfs are the same as those to newfs.  The special file is only used
     to read the disk label which provides a set of configuration parameters
     for the memory based file system.  The special file is typically that of
     the primary swap area, since that is where the file system will be backed
     up when free memory gets low and the memory supporting the file system
     has to be paged.  If the keyword ``swap'' is used instead of a special
     file name, default configuration parameters will be used.  (This option
     is useful when trying to use mount_mfs on a machine without any disks.)

     Both newfs and mount_mfs now have the functionality of fsirand(8) built
     in, so it is not necessary to run fsirand(8) manually unless you wish to
     re-randomize the file system (or list the inode generation numbers).

     The options to newfs are as follows:

     -b block-size
                 The block size of the file system, in bytes.  The default is
                 16KB.

     -c fragments-per-cylinder-group
                 The number of fragments per cylinder group in a file system.
                 The default is to compute the maximum allowed by the other
                 parameters.  This value is dependent on a number of other pa-
                 rameters, in particular the block size and the number of
                 bytes per inode.

     -e maxbpg   This indicates the maximum number of blocks any single file
                 can allocate out of a cylinder group before it is forced to
                 begin allocating blocks from another cylinder group.  The de-
                 fault is about one quarter of the total blocks in a cylinder
                 group.  See tunefs(8) for more details on how to set this op-
                 tion.

     -f frag-size
                 The fragment size of the file system in bytes.  The default
                 is 2048.

     -g avgfilesize
                 The expected average file size for the file system in bytes.

     -h avgfpdir
                 The expected average number of files per directory on the
                 file system.

     -i bytes    This specifies the density of inodes in the file system.  The
                 default is to create an inode for each 8192 bytes of data
                 space.  If fewer inodes are desired, a larger number should
                 be used; to create more inodes a smaller number should be
                 given.

     -m free-space
                 The percentage of space reserved from normal users; the mini-
                 mum free space threshold.  The default value used is 5%.  See
                 tunefs(8) for more details on how to set this option.

     -N          Causes the file system parameters to be printed out without
                 really creating the file system.

     -O filesystem-format
                 Select the filesystem format:

                       0    4.3BSD format file system.  This option is primar-
                            ily used to build root file systems that can be
                            understood by older boot ROMs.
                       1    Fast File System (the default).
                       2    Enhanced Fast File System (FFS2).

     -o optimization
                 space or time.  The file system can either be instructed to
                 try to minimize the time spent allocating blocks, or to try
                 to minimize the space fragmentation on the disk.  Unless an
                 optimization has been specified, if the value of minfree (see
                 above) is less than 5%, the default is to optimize for space;
                 if the value of minfree is greater than or equal to 5%, the
                 default is to optimize for time.  See tunefs(8) for more de-
                 tails on how to set this option.

     -q          Operate in quiet mode.  With this option, newfs will not
                 print extraneous information like superblock backups.

     -S sector-size
                 The size of a sector in bytes (almost never anything but
                 512).  Changing this is useful only when using newfs to build
                 a file system whose raw image will eventually be used on a
                 different type of disk than the one on which it is initially
                 created (for example on a write-once disk).  Note that chang-
                 ing this from its default will make it impossible for fsck(8)
                 to find the alternate superblocks if the standard superblock
                 is lost.

     -s size     The size of the file system in sectors.  The maximum size of
                 a Fast File System is 2,147,483,647 (2^31 - 1) sectors, which
                 is slightly less than 1TB, assuming a sector size of 512
                 bytes.  FFS2 file systems can be as large as the maximum par-
                 tition size supported.  Note however that for mount_mfs the
                 practical limit is based on datasize in login.conf(5), and
                 ultimately depends on the per-arch MAXDSIZ limit.

     -T disktype
                 Uses information for the specified disk from disktab(5) in-
                 stead of trying to get the information from the disklabel(5).

     -t fstype   Set the file system type of which file system you wish to
                 create.  newfs will be smart enough to run the alternate
                 newfs_XXX program instead.

     The options to mount_mfs are as described for newfs, except for the -o
     and -P options.

     Those options are as follows:

     -o options
             Options are specified with a -o flag followed by a comma separat-
             ed string of options.  See the mount(8) man page for possible op-
             tions and their meanings.

     -P file
             If file is a directory, populate the created mfs file system with
             the contents of the directory.  If file is a block device, popu-
             late the created mfs file system with the contents of the FFS
             file system contained on the device.

     If the -P file option is not used, the owner and mode of the created mfs
     file system will be the same as the owner and mode of the mount point.

ENVIRONMENT
     TMPDIR  Directory in which to create temporary mount points for use by
             mount_mfs -P instead of /tmp.

SEE ALSO
     disktab(5), fs(5), disklabel(8), dumpfs(8), fsck(8), fsirand(8),
     growfs(8), mount(8), tunefs(8)

     M. McKusick, W. Joy, S. Leffler, and R. Fabry, "A Fast File System for
     UNIX", ACM Transactions on Computer Systems 2, 3, pp 181-197, August
     1984, (reprinted in the BSD System Manager's Manual).

     M. McKusick, M. Karels, and K. Bostic, "A Pageable Memory Based
     Filesystem", USENIX Summer Conference Proceedings, 1990.

HISTORY
     The newfs command appeared in 4.2BSD.

OpenBSD 4.7                     August 3, 2008                               3
