NEWFS(8) | System Manager's Manual | NEWFS(8) |
newfs
— construct
a new file system
newfs |
[-FGINZ ] [-a
maxcontig] [-B
byte-order] [-b
block-size] [-d
maxbsize] [-e
maxbpg] [-f
frag-size] [-g
avgfilesize] [-h
avgfpdir] [-i
bytes-per-inode] [-m
free-space] [-n
inodes] [-O
filesystem-format] [-o
optimization] [-q
quota] [-S
sector-size] [-s
size] [-T
disk-type] [-v
volname] [-V
verbose] special |
newfs
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 reasonable, however newfs
has
numerous options to allow the defaults to be selectively overridden.
Options with numeric arguments may contain an optional (case-insensitive) suffix:
The following options define the general layout policies.
-a
maxcontig-B
byte-order-b
block-size-d
maxbsize-e
maxbpg-F
-s
size”. No attempts to use or update the disk
label will be made.-f
frag-size-G
-g
avgfilesize-h
avgfpdir-I
4.2BSD
’ or
‘Apple UFS
’.-i
bytes-per-inode-m
free-space-N
-n
inodes-i
and -n
are specified
then -n
takes precedence.-O
filesystem-formatTo create an LFS filesystem see newfs_lfs(8). To create a Linux ext2 filesystem see newfs_ext2fs(8).
-o
optimization-q
quotauser
or group
to enable
the specified quota type. Multiple -q
can be used
to enable all types at once.-s
size-S
secsize) after suffix
interpretation.
If no -s
size is
specified then the filesystem size defaults to that of the partition,
or, if -F
is specified, the existing file.
If size is negative the specified size is subtracted from the default size (reserving space at the end of the partition).
-T
disk-type-V
verbose-N
is specified
newfs
stops before outputting the progress
bar.-v
volname-Z
-F
.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.
-S
sector-sizeThe 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.
fstat(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.
The newfs
command appeared in
4.2BSD.
April 13, 2019 | NetBSD 10.99 |