NEWFS(8) NetBSD System Manager's Manual NEWFS(8)
NAMEnewfs -- construct a new file system
SYNOPSISnewfs [-FGINZ] [-amaxcontig] [-Bbyte-order] [-bblock-size]
[-dmaxbsize] [-emaxbpg] [-ffrag-size] [-gavgfilesize]
[-havgfpdir] [-ibytes-per-inode] [-mfree-space] [-ninodes]
[-Ofilesystem-format] [-ooptimization] [-qquota]
[-Ssector-size] [-ssize] [-Tdisk-type] [-vvolname] [-Vverbose]
specialDESCRIPTIONnewfs is used to initialize and clear file systems before first use.
Before running newfs the disk must be labeled using disklabel(8). newfs
builds a file system on the specified special device basing its defaults
on the information in the disk label. Typically the defaults are reason-
able, however newfs has numerous options to allow the defaults to be
selectively overridden.
Options with numeric arguments may contain an optional (case-insensitive)
suffix:
b Bytes; causes no modification. (Default)
k Kilo; multiply the argument by 1024.
m Mega; multiply the argument by 1048576.
g Giga; multiply the argument by 1073741824.
t Tera; multiply the argument by 1099511627776.
The following options define the general layout policies.
-amaxcontig
This sets the obsolete maxcontig parameter.
-Bbyte-order
Specify the metadata byte order of the file system to be cre-
ated. Valid byte orders are `be' and `le'. If no byte order
is specified, the file system is created in host byte order.
-bblock-size
The block size of the file system, in bytes. It must be a
power of two. The smallest allowable size is 4096 bytes.
The default size depends upon the size of the file system:
file system sizeblock-size
< 20 MB 4 KB
< 1000 MB 8 KB
< 128 GB 16 KB
>= 128 GB 32 KB
-dmaxbsize
Set the maximum extent size to maxbsize.
-emaxbpg 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
default is about one quarter of the total blocks in a cylin-
der group. See tunefs(8) for more details on how to set this
option.
-F Create a file system image in special. The file system size
needs to be specified with ``-ssize''. No attempts to use
or update the disk label will be made.
-ffrag-size
The fragment size of the file system in bytes. It must be a
power of two ranging in value between block-size/8 and
block-size. The optimal block-size:frag-size ratio is 8:1.
Other ratios are possible, but are not recommended, and may
produce unpredictable results. The default size depends upon
the size of the file system:
file system sizefrag-size
< 20 MB 0.5 KB
< 1000 MB 1 KB
< 128 GB 2 KB
>= 128 GB 4 KB
-G Treat garbage parameters as non-fatal. Using this option may
result in a file system which causes a kernel panic and
should only be used for testing.
-gavgfilesize
The expected average file size for the file system.
-havgfpdir
The expected average number of files per directory on the
file system.
-I Do not require that the file system type listed in the disk
label is `4.2BSD' or `Apple UFS'.
-ibytes-per-inode
This specifies the density of inodes in the file system. If
fewer inodes are desired, a larger number should be used; to
create more inodes a smaller number should be given. The
default is to create an inode for every (4 * frag-size) bytes
of data space:
file system sizebytes-per-inode
< 20 MB 2 KB
< 1000 MB 4 KB
< 128 GB 8 KB
>= 128 GB 16 KB
-mfree-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.
-ninodes This specifies the number of inodes for the filesystem. If
both -i and -n are specified then -n takes precedence.
-Ofilesystem-format
Select the filesystem-format.
0 4.3BSD; This option is primarily used to build
root file systems that can be understood by older
boot ROMs. This generates an FFSv1 file system
with level 1 format.
1 FFSv1; normal Fast File System, level 4 format.
Also known as `FFS', `UFS', or `UFS1'. This is
the default.
2 FFSv2; enhanced Fast File System, suited for more
than 1 Terabyte capacity. This is also known as
`UFS2'.
See fsck_ffs(8) for more information about format levels.
To create an LFS filesystem see newfs_lfs(8). To create a
Linux ext2 filesystem see newfs_ext2fs(8).
-ooptimization
Optimization preference; either ``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. 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
details on how to set this option.
-qquota enable a quota. quota can be one of user or group to enable
the specified quota type. Multiple -q can be used to enable
all types at once.
-ssize The size of the file system in sectors. An `s' suffix will
be interpreted as the number of sectors (the default). All
other suffixes are interpreted as per other numeric argu-
ments, except that the number is converted into sectors by
dividing by the sector size (as specified by -Ssecsize)
after suffix interpretation.
If no -ssize is specified then the filesystem size defaults
to that of the partition, or, if -F is specified, the exist-
ing file.
If size is negative the specified size is subtracted from the
default size (reserving space at the end of the partition).
-Tdisk-type
Uses information for the specified disk from /etc/disktab
instead of trying to get the information from the disk label.
-Vverbose This controls the amount of information written to stdout:
0 No output.
1 Overall size and cylinder group details.
2 A progress bar (dots ending at right hand margin).
3 The first few super-block backup sector numbers
are displayed before the progress bar.
4 All the super-block backup sector numbers are dis-
played (no progress bar).
The default is 3. If -N is specified newfs stops before out-
putting the progress bar.
-vvolname This specifies that an Apple UFS filesystem should be created
with the given volume name.
-Z Pre-zeros the file system image created with -F. This is
necessary if the image is to be used by vnd(4) (which doesn't
support file systems with `holes').
The following option overrides the standard sizes for the disk geometry.
The default value is taken from the disk label. Changing this default 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
changing this value from its default will make it impossible for
fsck_ffs(8) to find the alternative superblocks if the standard
superblock is lost.
-Ssector-size
The size of a sector in bytes (almost never anything but
512). Defaults to 512.
NOTES
The file system is created with `random' inode generation numbers to
improve NFS security.
The owner and group IDs of the root node of the new file system are set
to the effective UID and GID of the user initializing the file system.
For the newfs command to succeed, the disk label should first be updated
such that the fstype field for the partition is set to `4.2BSD' or `Apple
UFS', unless -F or -I is used.
To create and populate a filesystem image within a file use the makefs(8)
utility.
The partition size is found using fstat(2), not by inspecting the disk
label. The block size and fragment size will be written back to the disk
label only if the last character of special references the same partition
as the minor device number.
Unless -F is specified, special must be a raw device. This means that
for example wd0a or /dev/rwd0a must be specified instead of /dev/wd0a.
SEE ALSOfstat(2), disktab(5), fs(5), disklabel(8), diskpart(8), dumpfs(8),
fsck_ffs(8), makefs(8), mount(8), mount_mfs(8), newfs_ext2fs(8),
newfs_lfs(8), newfs_msdos(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, "Enhancements to the fast filesystem to support multi-
terabyte storage systems", Proceedings of the BSD Conference 2003, pp
79-90, September 2003.
HISTORY
The newfs command appeared in 4.2BSD.
NetBSD 6.0 June 30, 2012 NetBSD 6.0

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

Command:

Section:

Architecture:

Collection:

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