newfs(8) - NetBSD Manual Pages

Command: Section: Arch: Collection:  
NEWFS(8)                NetBSD System Manager's Manual                NEWFS(8)


NAME
newfs - construct a new file system
SYNOPSIS
newfs [-B byte-order] [-FINOZ] [-S sector-size] [-T disk-type] [-a maxcontig] [-b block-size] [-c cpg] [-d rotdelay] [-e maxbpg] [-f frag-size] [-g avgfilesize] [-h avgfpdir] [-i bytes-per-inode] [-k skew] [-l interleave] [-m free-space] [-n rotational-positions] [-o optimization] [-p track-spares] [-r revolutions] [-s size] [-t ntracks] [-u nsectors] [-x sectors] special
DESCRIPTION
newfs is used to initialize and clear file systems before first use. Be- fore 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 se- lectively 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 The following options define the general layout policies. -B byte-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. -F Create a file system image in special. The file system size needs to be specified with ``-s size''. No attempts to use or update the disk label will be made. -I Do not require that the file system type listed in the disk label is `4.2BSD'. -N Causes the file system parameters to be printed out without really creating the file system. -O Creates a 4.3BSD format file system. This option is primari- ly used to build root file systems that can be understood by older boot ROMs. -T disk-type Uses information for the specified disk from /etc/disktab in- stead of trying to get the information from the disk label. -Z Pre-zeros the file system image created with -F. This is nec- essary if the image is to be used by vnd(4) (which doesn't support file systems with `holes'). -a maxcontig This specifies the maximum number of contiguous blocks that will be laid out before forcing a rotational delay (see the -d option). The default value is 8. See tunefs(8) for more details on how to set this option. -b block-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 size block-size < 20 MB 4 KB < 1024 MB 8 KB >= 1024 MB 16 KB -c cpg The number of cylinders 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. -d rotdelay This specifies the expected time (in milliseconds) to service a transfer completion interrupt and initiate a new transfer on the same disk. The default is 0 milliseconds. See tunefs(8) for more details on how to set this option. -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. 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 size frag-size < 20 MB 0.5 KB < 1024 MB 1 KB >= 1024 MB 2 KB -g avgfilesize The expected average file size for the file system. -h avgfpdir The expected average number of files per directory on the file system. -i bytes-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 de- fault is to create an inode for every (4 * frag-size) bytes of data space: file system size bytes-per-inode < 20 MB 2 KB < 1024 MB 4 KB >= 1024 MB 8 KB -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 rotational-positions Determines how many rotational time slots there are in one revolution of the disk. -o optimization 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 de- tails on how to set this option. -s size 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 -S secsize) af- ter suffix interpretation. The following options override the standard sizes for the disk geometry. Their default values are taken from the disk label. Changing these de- faults 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 any of these values from their defaults will make it impos- sible for fsck_ffs(8) to find the alternative superblocks if the standard superblock is lost. -S sector-size The size of a sector in bytes (almost never anything but 512). Defaults to 512. -k skew Sector 0 skew, per track. Used to describe perturbations in the media format to compensate for a slow controller. Track skew is the offset of sector 0 on track N relative to sector 0 on track N-1 on the same cylinder. -l interleave Hardware sector interleave. Used to describe perturbations in the media format to compensate for a slow controller. In- terleave is physical sector interleave on each track, speci- fied as the denominator of the ratio: sectors read/sectors passed over Thus an interleave of 1/1 implies contiguous layout, while 1/2 implies logical sector 0 is separated by one sector from logical sector 1. -p track-spares Spare sectors per track. Spare sectors (bad sector replace- ments) are physical sectors that occupy space at the end of each track. They are not counted as part of the sectors per track (-u) since they are not available to the file system for data allocation. -r revolutions The speed of the disk in revolutions per minute. -t ntracks The number of tracks per cylinder available for data alloca- tion by the file system. -u nsectors The number of sectors per track available for data allocation by the file system. This does not include sectors reserved at the end of each track for bad block replacement (see the -p option). -x spare-sectors-per-cylinder Spare sectors (bad sector replacements) are physical sectors that occupy space at the end of the last track in the cylin- der. They are deducted from the sectors per track (-u) of the last track of each cylinder since they are not available to the file system for data allocation.
NOTES
If the file system will be exported over NFS, the fsirand(8) utility should be run after newfs to improve 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', unless -F or -I is used.
SEE ALSO
disktab(5), fs(5), disklabel(8), diskpart(8), dumpfs(8), fsck_ffs(8), fsirand(8), mount(8), mount_mfs(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).
HISTORY
The newfs command appeared in 4.2BSD. NetBSD 1.6 February 20, 2002 4
Powered by man-cgi (2024-03-20). Maintained for NetBSD by Kimmo Suominen. Based on man-cgi by Panagiotis Christias.