| 1 | .\" Copyright (c) 1983, 1987, 1991, 1993, 1994 |
| 2 | .\" The Regents of the University of California. All rights reserved. |
| 3 | .\" |
| 4 | .\" Redistribution and use in source and binary forms, with or without |
| 5 | .\" modification, are permitted provided that the following conditions |
| 6 | .\" are met: |
| 7 | .\" 1. Redistributions of source code must retain the above copyright |
| 8 | .\" notice, this list of conditions and the following disclaimer. |
| 9 | .\" 2. Redistributions in binary form must reproduce the above copyright |
| 10 | .\" notice, this list of conditions and the following disclaimer in the |
| 11 | .\" documentation and/or other materials provided with the distribution. |
| 12 | .\" 3. All advertising materials mentioning features or use of this software |
| 13 | .\" must display the following acknowledgement: |
| 14 | .\" This product includes software developed by the University of |
| 15 | .\" California, Berkeley and its contributors. |
| 16 | .\" 4. Neither the name of the University nor the names of its contributors |
| 17 | .\" may be used to endorse or promote products derived from this software |
| 18 | .\" without specific prior written permission. |
| 19 | .\" |
| 20 | .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
| 21 | .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 22 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 23 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
| 24 | .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 25 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 26 | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 27 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
| 28 | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 29 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 30 | .\" SUCH DAMAGE. |
| 31 | .\" |
| 32 | .\" @(#)newfs.8 8.6 (Berkeley) 5/3/95 |
| 33 | .\" $FreeBSD: src/sbin/newfs/newfs.8,v 1.26.2.15 2003/05/13 12:16:08 joerg Exp $ |
| 34 | .\" $DragonFly: src/sbin/newfs/newfs.8,v 1.4 2004/05/19 22:52:34 dillon Exp $ |
| 35 | .\" |
| 36 | .Dd May 13, 2003 |
| 37 | .Dt NEWFS 8 |
| 38 | .Os |
| 39 | .Sh NAME |
| 40 | .Nm newfs , |
| 41 | .Nm mount_mfs |
| 42 | .Nd construct a new file system |
| 43 | .Sh SYNOPSIS |
| 44 | .Nm |
| 45 | .Op Fl NCOU |
| 46 | .Op Fl S Ar sector-size |
| 47 | .Op Fl T Ar disktype |
| 48 | .Op Fl a Ar maxcontig |
| 49 | .Op Fl b Ar block-size |
| 50 | .Op Fl c Ar cylinders |
| 51 | .Op Fl d Ar rotdelay |
| 52 | .Op Fl e Ar maxbpg |
| 53 | .Op Fl f Ar frag-size |
| 54 | .Op Fl g Ar avgfilesize |
| 55 | .Op Fl h Ar avfpdir |
| 56 | .Op Fl i Ar bytes |
| 57 | .Op Fl k Ar skew |
| 58 | .Op Fl l Ar interleave |
| 59 | .Op Fl m Ar free space |
| 60 | .Op Fl n Ar rotational positions |
| 61 | .Op Fl o Ar optimization |
| 62 | .Op Fl p Ar sectors |
| 63 | .Op Fl r Ar revolutions |
| 64 | .Op Fl s Ar size |
| 65 | .Op Fl t Ar tracks |
| 66 | .Op Fl u Ar sectors |
| 67 | .Op Fl v |
| 68 | .Op Fl x Ar sectors |
| 69 | .Ar special |
| 70 | .Nm mount_mfs |
| 71 | .Op Fl NU |
| 72 | .Op Fl F Ar file |
| 73 | .Op Fl T Ar disktype |
| 74 | .Op Fl a Ar maxcontig |
| 75 | .Op Fl b Ar block-size |
| 76 | .Op Fl c Ar cylinders |
| 77 | .Op Fl d Ar rotdelay |
| 78 | .Op Fl e Ar maxbpg |
| 79 | .Op Fl f Ar frag-size |
| 80 | .Op Fl i Ar bytes |
| 81 | .Op Fl m Ar free space |
| 82 | .Op Fl n Ar rotational positions |
| 83 | .Op Fl o Ar options |
| 84 | .Op Fl s Ar size |
| 85 | .Op Fl v |
| 86 | .Ar special node |
| 87 | .Sh DESCRIPTION |
| 88 | .Nm Newfs |
| 89 | is used to initialize and clear filesystems before first use. |
| 90 | Before running |
| 91 | .Nm |
| 92 | or |
| 93 | .Nm mount_mfs , |
| 94 | the disk must be labeled using |
| 95 | .Xr disklabel 8 . |
| 96 | .Nm Newfs |
| 97 | builds a file system on the specified special file. |
| 98 | (We often refer to the |
| 99 | .Dq special file |
| 100 | as the |
| 101 | .Dq disk , |
| 102 | although the special file need not be a physical disk. |
| 103 | In fact, it need not even be special.) |
| 104 | Typically the defaults are reasonable, however |
| 105 | .Nm |
| 106 | has numerous options to allow the defaults to be selectively overridden. |
| 107 | .Pp |
| 108 | .Nm Mount_mfs |
| 109 | is used to build a file system in virtual memory and then mount it |
| 110 | on a specified node. |
| 111 | .Nm Mount_mfs |
| 112 | exits and the contents of the file system are lost |
| 113 | when the file system is unmounted. |
| 114 | If |
| 115 | .Nm mount_mfs |
| 116 | is sent a signal while running, |
| 117 | for example during system shutdown, |
| 118 | it will attempt to unmount its |
| 119 | corresponding file system. |
| 120 | The parameters to |
| 121 | .Nm mount_mfs |
| 122 | are the same as those to |
| 123 | .Nm . |
| 124 | If the |
| 125 | .Fl T |
| 126 | flag is specified (see below), the special file is unused. |
| 127 | Otherwise, it is only used to read the disk label which provides |
| 128 | a set of configuration parameters for the memory based file system. |
| 129 | The special file is typically that of the primary swap area, |
| 130 | since that is where the file system will be backed up when |
| 131 | free memory gets low and the memory supporting |
| 132 | the file system has to be paged. |
| 133 | .Pp |
| 134 | .Nm mount_mfs |
| 135 | creates the raw character device |
| 136 | .Pa /dev/mfs<PID> |
| 137 | to represent the backing store while the mount is active. This device may |
| 138 | be read but not written and allows swap-based MFS filesystems to be dumped |
| 139 | if desired. |
| 140 | .Pp |
| 141 | The following options define the general layout policies: |
| 142 | .Bl -tag -width indent |
| 143 | .It Fl T Ar disktype |
| 144 | For backward compatibility and for |
| 145 | .Nm mount_mfs . |
| 146 | .It Fl F Ar file |
| 147 | .Nm Mount_mfs |
| 148 | will use this file for the image of the filesystem. When |
| 149 | .Nm mount_mfs |
| 150 | exits, this file will be left behind. |
| 151 | .It Fl C |
| 152 | Tell |
| 153 | .Nm Mount_mfs |
| 154 | to copy the underlying filesystem into the MFS mount being created |
| 155 | over it. |
| 156 | .It Fl N |
| 157 | Cause the file system parameters to be printed out |
| 158 | without really creating the file system. |
| 159 | .It Fl O |
| 160 | Create a |
| 161 | .Bx 4.3 |
| 162 | format filesystem. |
| 163 | This options is primarily used to build root filesystems |
| 164 | that can be understood by older boot ROMs. |
| 165 | .It Fl T |
| 166 | Use information for the specified disk from |
| 167 | .Pa /etc/disktab |
| 168 | instead of trying to get the information from a disklabel. |
| 169 | .It Fl U |
| 170 | Enables soft updates on the new filesystem. |
| 171 | .It Fl a Ar maxcontig |
| 172 | Specify the maximum number of contiguous blocks that will be |
| 173 | laid out before forcing a rotational delay (see the |
| 174 | .Fl d |
| 175 | option). |
| 176 | The default value is 1. |
| 177 | See |
| 178 | .Xr tunefs 8 |
| 179 | for more details on how to set this option. |
| 180 | .It Fl b Ar block-size |
| 181 | The block size of the file system, in bytes. It must be a power of 2. The |
| 182 | default size is 16384 bytes, and the smallest allowable size is 4096 bytes. |
| 183 | The optimal block:fragment ratio is 8:1. |
| 184 | Other ratios are possible, but are not recommended, |
| 185 | and may produce unpredictable results. |
| 186 | .It Fl c Ar #cylinders/group |
| 187 | The number of cylinders per cylinder group in a file system. The default |
| 188 | is to compute the maximum allowed by the other parameters. This value is |
| 189 | dependent on a number of other parameters, in particular the block size |
| 190 | and the number of bytes per inode. |
| 191 | .It Fl d Ar rotdelay |
| 192 | This parameter once specified the minimum time in milliseconds required to |
| 193 | initiate another disk transfer on the same cylinder. It was used in determining |
| 194 | the rotationally optimal layout for disk blocks within a file. Modern disks |
| 195 | with read/write-behind achieve higher performance with this feature disabled, so |
| 196 | this value should be left at the default value of 0 milliseconds. See |
| 197 | .Xr tunefs 8 |
| 198 | for more details on how to set this option. |
| 199 | .It Fl e Ar maxbpg |
| 200 | Indicate the maximum number of blocks any single file can |
| 201 | allocate out of a cylinder group before it is forced to begin |
| 202 | allocating blocks from another cylinder group. |
| 203 | The default is about one quarter of the total blocks in a cylinder group. |
| 204 | See |
| 205 | .Xr tunefs 8 |
| 206 | for more details on how to set this option. |
| 207 | .It Fl f Ar frag-size |
| 208 | The fragment size of the file system in bytes. It must be a power of two |
| 209 | ranging in value between |
| 210 | .Ar blocksize Ns /8 |
| 211 | and |
| 212 | .Ar blocksize . |
| 213 | The default is 2048 bytes. |
| 214 | .It Fl g Ar avgfilesize |
| 215 | The expected average file size for the file system. |
| 216 | .It Fl h Ar avgfpdir |
| 217 | The expected average number of files per directory on the file system. |
| 218 | .It Fl i Ar number of bytes per inode |
| 219 | Specify the density of inodes in the file system. |
| 220 | The default is to create an inode for every |
| 221 | .Pq 4 * Ar frag-size |
| 222 | bytes of data space. |
| 223 | If fewer inodes are desired, a larger number should be used; |
| 224 | to create more inodes a smaller number should be given. |
| 225 | One inode is required for each distinct file, so this value effectively |
| 226 | specifies the average file size on the file system. |
| 227 | .It Fl m Ar free space \&% |
| 228 | The percentage of space reserved from normal users; the minimum free |
| 229 | space threshold. |
| 230 | The default value used is |
| 231 | defined by |
| 232 | .Dv MINFREE |
| 233 | from |
| 234 | .Aq Pa ufs/ffs/fs.h , |
| 235 | currently 8%. |
| 236 | See |
| 237 | .Xr tunefs 8 |
| 238 | for more details on how to set this option. |
| 239 | .It Fl n Ar number of distinguished rotational positions |
| 240 | UFS has the ability to keep track of the availability of blocks at different |
| 241 | rotational positions, so that it could lay out the data to be picked up with |
| 242 | minimum rotational latency. This parameter specifies the default number of |
| 243 | rotational positions to distinguish. |
| 244 | .Pp |
| 245 | Nowadays this value should be set to 1 (which essentially disables the |
| 246 | rotational position table) because modern drives with read-ahead and |
| 247 | write-behind do better without the rotational position table. |
| 248 | .It Fl o Ar optimization\ preference |
| 249 | .Pq Ar space No or Ar time . |
| 250 | The file system can either be instructed to try to minimize the time spent |
| 251 | allocating blocks, or to try to minimize the space fragmentation on the disk. |
| 252 | If the value of minfree (see above) is less than 8%, |
| 253 | the default is to optimize for |
| 254 | .Ar space ; |
| 255 | if the value of minfree is greater than or equal to 8%, |
| 256 | the default is to optimize for |
| 257 | .Ar time . |
| 258 | See |
| 259 | .Xr tunefs 8 |
| 260 | for more details on how to set this option. |
| 261 | .It Fl s Ar size |
| 262 | The size of the file system in sectors. This value defaults to the size of the |
| 263 | raw partition specified in |
| 264 | .Ar special |
| 265 | (in other words, |
| 266 | .Nm |
| 267 | will use the entire partition for the file system). |
| 268 | .It Fl v |
| 269 | Specify that the disk does not contain any partitions, and that |
| 270 | .Nm |
| 271 | should build a file system on the whole disk. |
| 272 | This option is useful for synthetic disks such as |
| 273 | .Nm vinum . |
| 274 | .El |
| 275 | .Pp |
| 276 | The following options override the standard sizes for the disk geometry. |
| 277 | Their default values are taken from the disk label. |
| 278 | Changing these defaults is useful only when using |
| 279 | .Nm |
| 280 | to build a file system whose raw image will eventually be used on a |
| 281 | different type of disk than the one on which it is initially created |
| 282 | (for example on a write-once disk). |
| 283 | Note that changing any of these values from their defaults will make |
| 284 | it impossible for |
| 285 | .Xr fsck 8 |
| 286 | to find the alternate superblocks if the standard superblock is lost. |
| 287 | .Bl -tag -width indent |
| 288 | .It Fl S Ar sector-size |
| 289 | The size of a sector in bytes (almost never anything but 512). |
| 290 | .It Fl k Ar sector \&0 skew , per track |
| 291 | Used to describe perturbations in the media format to compensate for |
| 292 | a slow controller. |
| 293 | Track skew is the offset of sector 0 on track N relative to sector 0 |
| 294 | on track N-1 on the same cylinder. |
| 295 | This option is of historical importance only; modern controllers are always fast |
| 296 | enough to handle operations back-to-back. |
| 297 | .It Fl l Ar hardware sector interleave |
| 298 | Used to describe perturbations in the media format to compensate for |
| 299 | a slow controller. |
| 300 | Interleave is physical sector interleave on each track, |
| 301 | specified as the denominator of the ratio: |
| 302 | .Dl sectors read/sectors passed over |
| 303 | Thus an interleave of 1/1 implies contiguous layout, while 1/2 implies |
| 304 | logical sector 0 is separated by one sector from logical sector 1. |
| 305 | This option is of historical importance only; the physical sector layout of |
| 306 | modern disks is not visible from outside. |
| 307 | .It Fl p Ar spare sectors per track |
| 308 | Spare sectors (bad sector replacements) are physical sectors that occupy |
| 309 | space at the end of each track. |
| 310 | They are not counted as part of the sectors/track |
| 311 | .Pq Fl u |
| 312 | since they are not available to the file system for data allocation. |
| 313 | This option is of historical importance only. Modern disks perform their own |
| 314 | bad sector allocation. |
| 315 | .It Fl r Ar revolutions/minute |
| 316 | The speed of the disk in revolutions per minute. This value is no longer of |
| 317 | interest, since all the parameters which depend on it are usually disabled. |
| 318 | .It Fl t Ar #tracks/cylinder |
| 319 | The number of tracks/cylinder available for data allocation by the file |
| 320 | system. |
| 321 | The default is 1. |
| 322 | If zero is specified, the value from the disklabel will be used. |
| 323 | .It Fl u Ar sectors/track |
| 324 | The number of sectors per track available for data allocation by the file |
| 325 | system. |
| 326 | The default is 4096. |
| 327 | If zero is specified, the value from the disklabel will be used. |
| 328 | This does not include sectors reserved at the end of each track for bad |
| 329 | block replacement (see the |
| 330 | .Fl p |
| 331 | option). |
| 332 | .It Fl x Ar spare sectors per cylinder |
| 333 | Spare sectors (bad sector replacements) are physical sectors that occupy |
| 334 | space at the end of the last track in the cylinder. |
| 335 | They are deducted from the sectors/track |
| 336 | .Pq Fl u |
| 337 | of the last track of each cylinder since they are not available to the file |
| 338 | system for data allocation. |
| 339 | This option is of historical importance only. Modern disks perform their own |
| 340 | bad sector allocation. |
| 341 | .El |
| 342 | .Pp |
| 343 | The options to the |
| 344 | .Nm mount_mfs |
| 345 | command are as described for the |
| 346 | .Nm |
| 347 | command, except for the |
| 348 | .Fl o |
| 349 | option. |
| 350 | .Pp |
| 351 | That option is as follows: |
| 352 | .Bl -tag -width indent |
| 353 | .It Fl o |
| 354 | Options are specified with a |
| 355 | .Fl o |
| 356 | flag followed by a comma separated string of options. |
| 357 | See the |
| 358 | .Xr mount 8 |
| 359 | man page for possible options and their meanings. |
| 360 | .El |
| 361 | .Sh EXAMPLES |
| 362 | .Dl newfs /dev/ad3s1a |
| 363 | .Pp |
| 364 | Creates a new ufs file system on |
| 365 | .Pa ad3s1a . |
| 366 | .Nm |
| 367 | will use a block size of 16384 bytes, a fragment size of 2048 bytes |
| 368 | and the largest possible number of cylinders per group. |
| 369 | These values tend to produce better performance for most applications |
| 370 | than the historical defaults |
| 371 | (8192 byte block size and 1024 byte fragment size). |
| 372 | This large fragment size |
| 373 | may lead to large amounts of wasted space |
| 374 | on filesystems that contain a large number of small files. |
| 375 | .Pp |
| 376 | .Dl mount_mfs -s 131072 -o nosuid,nodev,nosymfollow /dev/da0s1b /tmp |
| 377 | .Pp |
| 378 | Mount a 64 MB large memory file system on |
| 379 | .Pa /tmp , |
| 380 | with |
| 381 | .Xr mount 8 |
| 382 | options |
| 383 | .Ar nosuid , |
| 384 | .Ar nodev , |
| 385 | and |
| 386 | .Ar nosymfollow . |
| 387 | .Sh SEE ALSO |
| 388 | .Xr fdformat 1 , |
| 389 | .Xr disktab 5 , |
| 390 | .Xr fs 5 , |
| 391 | .Xr camcontrol 8 , |
| 392 | .Xr disklabel 8 , |
| 393 | .Xr diskpart 8 , |
| 394 | .Xr dumpfs 8 , |
| 395 | .Xr fsck 8 , |
| 396 | .Xr mount 8 , |
| 397 | .Xr tunefs 8 , |
| 398 | .Xr vinum 8 |
| 399 | .Rs |
| 400 | .%A M. McKusick |
| 401 | .%A W. Joy |
| 402 | .%A S. Leffler |
| 403 | .%A R. Fabry |
| 404 | .%T A Fast File System for UNIX |
| 405 | .%J ACM Transactions on Computer Systems 2 |
| 406 | .%V 3 |
| 407 | .%P pp 181-197 |
| 408 | .%D August 1984 |
| 409 | .%O (reprinted in the BSD System Manager's Manual) |
| 410 | .Re |
| 411 | .Sh HISTORY |
| 412 | The |
| 413 | .Nm |
| 414 | command appeared in |
| 415 | .Bx 4.2 . |