newfs(8) — Maintenance
OSF
NAME
newfs − Constructs a new file system
SYNOPSIS
newfs [-T ufs | s5fs] [-N] [newfs-options] special disk-type
FLAGS
-T ufs | s5fsSince OSF/1 supports multiple file system types, a new flag, -T is used to choose between the ufs and System V file systems. If -T is not specified, a ufs file system is created by default.
-NCauses the file system parameters to be printed out without creating the file system.
DESCRIPTION
You must be root to use this command.
The newfs command creates a new file system on the specified special disk-type. If the disk has been labeled using disklabel, newfs builds a file system on the specified device, basing its defaults on the information in the disk label. If the disk has not been labeled using disklabel, newfs looks up the specified disk type in the disk description file /etc/disktab to get default information on the specified special device. Typically the defaults are reasonable, however newfs has numerous options to allow the defaults to be selectively overridden.
If you invoke the newfs command without options, it displays the file system parameters without creating the file system.
The following sections describe the file system dependencies for the ufs file systems (the default) and for System V file systems. Each section defines the command syntax and the particular options that apply to that specific file system type.
FILE SYSTEM DEPENDENT newfs - UFS FILE SYSTEMS
SYNOPSIS
newfs [−N] [newfs-options] special disk-type
FLAGS
The following newfs-options flags define the general layout policies.
-bblock-sizeThe block size of the file system in bytes.
-ffrag-sizeThe fragment size of the file system in bytes.
-m%free_space
The percentage of space reserved from normal users; the minimum free space threshold (minfree). The default value is 10%. See tunefs(8) for more details on how to set this option.
-oopt_preference
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 is less than 10%, the default is to optimize for space; if the value of minfree is greater than or equal to 10%, the default is to optimize for time. See tunefs(8) for more details on how to set this option.
-amaxcontigThis specifies the maximum number of contiguous blocks that will be laid out before forcing a rotational delay (refer to the −d option). The default value is 1. See tunefs(8) for more details on how to set this option.
-drotdelayThis specifies the expected time (in milliseconds) to service a transfer completion interrupt and initiate a new transfer on the same disk. The default is 4 milliseconds. See tunefs(8) for more details on how to set this option.
-emaxbpgThis 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 cylinder group. See tunefs(8) for more details on how to set this option.
-i#bytes/inode
This specifies the density of inodes in the file system. The default is to create an inode for each 2048 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.
-c#cylinders/group
The number of cylinders per cylinder group in a file system. The default value is 16.
-ssizeThe size of the file system in sectors.
The following options override the standard sizes for the disk geometry. Their default values are taken from the disk label. Changing these defaults 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 (on a write-once disk, for example). Note that changing any of these values from their defaults makes it impossible for fsck to find the alternate superblocks if the standard superblock is lost.
-rrevolutions/minute
The speed of the disk in revolutions per minute.
-Ssector-sizeThe size of a sector in bytes (almost never anything but 512).
-usectors/track
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 −p).
-t#tracks/cylinder
The number of tracks per cylinder available for data allocation by the file system.
-pspare_sectors/track
Spare sectors (bad sector replacements) 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.
-xspare_sectors/cylinder
Spare sectors (bad sector replacements) are physical sectors that occupy space at the end of the last track in the cylinder. 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.
-lhardware_sector_interleave
Used to describe perturbations in the media format to compensate for a slow controller. Interleave is physical sector interleave on each track, specified 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 (zero) is separated by one sector from logical sector 1.
-ksector0-skew/track
Used to describe perturbations in the media format to compensate for a slow controller. Track skew is the offset of sector 0 (zero) on track N relative to sector 0 (zero) on track N-1 on the same cylinder.
FILE SYSTEM DEPENDENT newfs - SYSTEM V FILE SYSTEMS
SYNOPSIS
newfs -T s5fs [newfs-options] special disk-type
FLAGS
The following newfs-options flags are specific to the System V file system:
-bblock-sizeThe block size of the filesystem in bytes. Valid block sizes are 512, 1024 and 2048. The default is 512.
-ssizeThe size of the file system in number of block-size blocks.
-Cblocks/cyliner
The number of blocks/cylinder.
-GgapThe rotational gap.
-IinodesThe number of inodes.
-Pproto_name
The name of the prototype file to use for creating the file system.
DESCRIPTION
The newfs program waits 10 seconds before starting to construct the file system. During this 10-second pause the command can be aborted by pressing the <Delete> key.
The specified special device should either be previously labeled using disklabel(8) or its disk-type must be in /etc/disktab. If the block-size and/or the size of the file system is specified, the specified values override what is in the disklabel or in /etc/disktab.
If no prototype file is specified, newfs builds a file system with a single empty directory on it. The boot program block (block zero) is left uninitialized.
If a prototype file is specified, newfs takes its directions from that file. The prototype file contains tokens separated by spaces or new-lines. A sample prototype specification follows; line numbers have been added to aid in the explanation:
1 proto_file
2 512 4872 110
3 d--777 3 1
4 usr d--777 3 1
5 sh ---755 3 1 /sbin/sh
6 jmp d--755 6 1
7 $
8 b0 b--644 3 1 0 0
9 c0 c--644 3 1 0 0
10 $
11 $
Historically line 1, as shown in the preceding example, is the name of a file to be copied onto block zero as the bootstrap program. Since OSF/1 does not support using the System V file system as a root file system, this file name is ignored by newfs and no data is copied onto block zero of the specified special device.
Line 2 specifies the block size of the file system in bytes, the size of the file system in number of blocks of the just specified block size and the number of inodes in the file system.
Lines 3 to 9 tell newfs about files and directories to be included in this file system. Line 3 specifies the root directory. Lines 4 to 6 and 8 to 9 specify other directories and files. The $ on line 7 tells newfs to end the branch of the file system it is on, and continue from the next higher directory.
The $ on lines 10 and 11 end the process, since no additional specifications follow.
File specifications give the mode, the user ID, the group ID, and the initial contents of the file. Valid syntax for the contents field depends on the first character of the mode.
The mode for a file is specified by a 6-character string. The first character specifies the type of the file. The character range is -bcd to specify regular, block special, character special and directory files, respectively. The second character of the mode is either u or - to specify set-user-id mode or not. The third is g or - for the set-group-id mode. The rest of the mode is a 3-digit octal number giving the owner, group, and other read, write, execute permissions. Refer to chmod(1) for additional information.
Two decimal number tokens come after the mode; they specify the user and group IDs of the owner of the file. If the file is a regular file, the next token of the specification may be a path name from which the contents and size are copied. If the file is a block or character special file, two decimal numbers follow which give the major and minor device numbers. If the file is a directory, newfs makes the entries . (dot) and .. (dot dot) and then reads a list of names and file specifications recursively for the entries in the directory. As noted previously, the scan is terminated with the token $.
FILES
/usr/sbin/newfs
Specifies the command path
/etc/disktab
Provides disk geometry and file system partition information
RELATED INFORMATION
Commands: chmod(1), disklabel(8), fsck(8), tunefs(8)
Files: disktab(4), fstab(4)