Index: head/sbin/bsdlabel/bsdlabel.8 =================================================================== --- head/sbin/bsdlabel/bsdlabel.8 (revision 287395) +++ head/sbin/bsdlabel/bsdlabel.8 (revision 287396) @@ -1,500 +1,502 @@ .\" Copyright (c) 1987, 1988, 1991, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" This code is derived from software contributed to Berkeley by .\" Symmetric Computer Systems. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" @(#)disklabel.8 8.2 (Berkeley) 4/19/94 .\" $FreeBSD$ .\" .Dd October 1, 2013 .Dt BSDLABEL 8 .Os .Sh NAME .Nm bsdlabel .Nd read and write BSD label .Sh SYNOPSIS .Nm .Op Fl A .Ar disk | Fl f Ar file .Nm .Fl w .Op Fl \&An .Op Fl B Op Fl b Ar boot .Op Fl m Ar machine .Ar disk | Fl f Ar file .Op Ar type .Nm .Fl e .Op Fl \&An .Op Fl B Op Fl b Ar boot .Op Fl m Ar machine .Ar disk | Fl f Ar file .Nm .Fl R .Op Fl \&An .Op Fl B Op Fl b Ar boot .Op Fl m Ar machine .Op Fl f .Ar disk | Fl f Ar file .Ar protofile .Sh DESCRIPTION The .Nm utility installs, examines or modifies the .Bx label on a disk partition, or on a file containing a partition image. In addition, .Nm can install bootstrap code. .Ss Disk Device Name When specifying the device (i.e., when the .Fl f option is not used), the .Pa /dev/ path prefix may be omitted; the .Nm utility will automatically prepend it. .Ss General Options The .Fl A option enables processing of the historical parts of the .Bx label. If the option is not given, suitable values are set for these fields. .Pp The .Fl f option tells .Nm that the program will operate on a file instead of a disk partition. .Pp The .Fl n option stops the .Nm program right before the disk would have been modified, and displays the result instead of writing it. .Pp The .Fl m Ar machine argument forces .Nm to use a layout suitable for a different architecture. Current valid values are .Cm i386 , amd64 , and .Cm pc98 . If this option is omitted, .Nm will use a layout suitable for the current machine. .Ss Reading the Disk Label To examine the label on a disk drive, use the form .Pp .Nm .Op Fl A .Op Fl m Ar machine .Ar disk .Pp .Ar disk represents the disk in question, and may be in the form .Pa da0 or .Pa /dev/da0 . It will display the partition layout. .Ss Writing a Standard Label To write a standard label, use the form .Pp .Nm .Fl w .Op Fl \&An .Op Fl m Ar machine .Ar disk .Op Ar type .Pp If the drive .Ar type is specified, the entry of that name in the .Xr disktab 5 file is used; otherwise, or if the type is specified as 'auto', a default layout is used. .Ss Editing an Existing Disk Label To edit an existing disk label, use the form .Pp .Nm .Fl e .Op Fl \&An .Op Fl m Ar machine .Ar disk .Pp This command opens the disk label in the default editor, and when the editor exits, the label is validated and if OK written to disk. .Ss Restoring a Disk Label From a File To restore a disk label from a file, use the form .Pp .Nm .Fl R .Op Fl \&An .Op Fl m Ar machine .Ar disk protofile .Pp The .Nm utility is capable of restoring a disk label that was previously saved in a file in .Tn ASCII format. The prototype file used to create the label should be in the same format as that produced when reading or editing a label. Comments are delimited by .Ql # and newline. .Ss Installing Bootstraps If the .Fl B option is specified, bootstrap code will be read from the file .Pa /boot/boot and written to the disk. The .Fl b Ar boot option allows a different file to be used. .Sh FILES .Bl -tag -width ".Pa /etc/disktab" -compact .It Pa /boot/boot Default boot image. .It Pa /etc/disktab Disk description file. .El .Sh SAVED FILE FORMAT The .Nm utility uses an .Tn ASCII version of the label when examining, editing, or restoring a disk label. The format is: .Bd -literal -offset 4n 8 partitions: # size offset fstype [fsize bsize bps/cpg] a: 81920 16 4.2BSD 2048 16384 5128 b: 1091994 81936 swap c: 1173930 0 unused 0 0 # "raw" part, don't edit .Ed .Pp If the .Fl A option is specified, the format is: .Bd -literal -offset 4n # /dev/da1c: type: SCSI disk: da0s1 label: flags: bytes/sector: 512 sectors/track: 51 tracks/cylinder: 19 sectors/cylinder: 969 cylinders: 1211 sectors/unit: 1173930 rpm: 3600 interleave: 1 trackskew: 0 cylinderskew: 0 headswitch: 0 # milliseconds track-to-track seek: 0 # milliseconds drivedata: 0 8 partitions: # size offset fstype [fsize bsize bps/cpg] a: 81920 16 4.2BSD 1024 8192 16 b: 160000 81936 swap c: 1173930 0 unused 0 0 # "raw" part, don't edit .Ed .Pp Lines starting with a .Ql # mark are comments. .Pp The partition table can have up to 8 entries. It contains the following information: .Bl -tag -width indent .It Ar # The partition identifier is a single letter in the range .Ql a to .Ql h . By convention, partition .Ql c is reserved to describe the entire disk. .It Ar size The size of the partition in sectors, .Cm K (kilobytes - 1024), .Cm M (megabytes - 1024*1024), .Cm G (gigabytes - 1024*1024*1024), .Cm % (percentage of free space .Em after removing any fixed-size partitions other than partition .Ql c ) , or .Cm * (all remaining free space .Em after fixed-size and percentage partitions). For partition .Ql c , a size of .Cm * indicates the entire disk. Lowercase versions of suffixes .Cm K , M , and .Cm G are allowed. Size and suffix should be specified without any spaces between them. .Pp Example: 2097152, 1G, 1024M and 1048576K are all the same size (assuming 512-byte sectors). .It Ar offset The offset of the start of the partition from the beginning of the drive in sectors, or .Cm * to have .Nm calculate the correct offset to use (the end of the previous partition plus one, ignoring partition .Ql c ) . For partition .Ql c , .Cm * will be interpreted as an offset of 0. The first partition should start at offset 16, because the first 16 sectors are reserved for metadata. .It Ar fstype Describes the purpose of the partition. The above example shows all currently used partition types. For .Tn UFS file systems and .Xr ccd 4 partitions, use type .Cm 4.2BSD . For Vinum drives, use type .Cm vinum . Other common types are .Cm swap and .Cm unused . By convention, partition .Ql c represents the entire slice and should be of type .Cm unused , though .Nm does not enforce this convention. The .Nm utility also knows about a number of other partition types, none of which are in current use. (See the definitions starting with .Dv FS_UNUSED in .In sys/disklabel.h for more details.) .It Ar fsize For .Cm 4.2BSD file systems only, the fragment size; see .Xr newfs 8 . .It Ar bsize For .Cm 4.2BSD file systems only, the block size; see .Xr newfs 8 . .It Ar bps/cpg For .Cm 4.2BSD file systems, the number of cylinders in a cylinder group; see .Xr newfs 8 . .El .Sh EXAMPLES Display the label for the first slice of the .Pa da0 disk, as obtained via .Pa /dev/da0s1 : .Pp .Dl "bsdlabel da0s1" .Pp Save the in-core label for .Pa da0s1 into the file .Pa savedlabel . This file can be used with the .Fl R option to restore the label at a later date: .Pp .Dl "bsdlabel da0s1 > savedlabel" .Pp Create a label for .Pa da0s1 : .Pp .Dl "bsdlabel -w /dev/da0s1" .Pp Read the label for .Pa da0s1 , edit it, and install the result: .Pp .Dl "bsdlabel -e da0s1" .Pp Read the on-disk label for .Pa da0s1 , edit it, and display what the new label would be (in sectors). It does .Em not install the new label either in-core or on-disk: .Pp .Dl "bsdlabel -e -n da0s1" .Pp Write a default label on .Pa da0s1 . Use another .Nm Fl e command to edit the partitioning and file system information: .Pp .Dl "bsdlabel -w da0s1" .Pp Restore the on-disk and in-core label for .Pa da0s1 from information in .Pa savedlabel : .Pp .Dl "bsdlabel -R da0s1 savedlabel" .Pp Display what the label would be for .Pa da0s1 using the partition layout in .Pa label_layout . This is useful for determining how much space would be allotted for various partitions with a labeling scheme using .Cm % Ns -based or .Cm * partition sizes: .Pp .Dl "bsdlabel -R -n da0s1 label_layout" .Pp Install a new bootstrap on .Pa da0s1 . The boot code comes from .Pa /boot/boot : .Pp .Dl "bsdlabel -B da0s1" .Pp Install a new label and bootstrap. The bootstrap code comes from the file .Pa newboot in the current working directory: .Pp .Dl "bsdlabel -w -B -b newboot /dev/da0s1" .Pp Completely wipe any prior information on the disk, creating a new bootable disk with a .Tn DOS partition table containing one slice, covering the whole disk. Initialize the label on this slice, then edit it. The .Xr dd 1 commands are optional, but may be necessary for some .Tn BIOS Ns es to properly recognize the disk: .Bd -literal -offset indent dd if=/dev/zero of=/dev/da0 bs=512 count=32 -fdisk -BI da0 +gpart create -s MBR da0 +gpart add -t freebsd da0 +gpart set -a active -i 1 da0 +gpart bootcode -b /boot/mbr da0 dd if=/dev/zero of=/dev/da0s1 bs=512 count=32 bsdlabel -w -B da0s1 bsdlabel -e da0s1 .Ed .Pp This is an example disk label that uses some of the new partition size types such as .Cm % , M , G , and .Cm * , which could be used as a source file for .Dq Li "bsdlabel -R ada0s1 new_label_file" : .Bd -literal -offset 4n # /dev/ada0s1: 8 partitions: # size offset fstype [fsize bsize bps/cpg] a: 400M 16 4.2BSD 4096 16384 75 # (Cyl. 0 - 812*) b: 1G * swap c: * * unused e: 204800 * 4.2BSD f: 5g * 4.2BSD g: * * 4.2BSD .Ed .Sh DIAGNOSTICS The kernel device drivers will not allow the size of a disk partition to be decreased or the offset of a partition to be changed while it is open. .Sh COMPATIBILITY Due to the use of an .Vt uint32_t to store the number of sectors, .Bx labels are restricted to a maximum of 2^32-1 sectors. This usually means 2TB of disk space. Larger disks should be partitioned using another method such as .Xr gpart 8 . .Pp The various .Bx Ns s all use slightly different versions of .Bx labels and are not generally compatible. .Sh SEE ALSO .Xr ccd 4 , .Xr geom 4 , .Xr md 4 , .Xr disktab 5 , .Xr boot0cfg 8 , -.Xr fdisk 8 , .Xr gpart 8 , .Xr newfs 8 Index: head/sbin/dumpfs/dumpfs.8 =================================================================== --- head/sbin/dumpfs/dumpfs.8 (revision 287395) +++ head/sbin/dumpfs/dumpfs.8 (revision 287396) @@ -1,111 +1,111 @@ .\" Copyright (c) 1983, 1991, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" @(#)dumpfs.8 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" .Dd May 16, 2013 .Dt DUMPFS 8 .Os .Sh NAME .Nm dumpfs .Nd dump UFS file system information .Sh SYNOPSIS .Nm .Op Fl f .Op Fl l .Op Fl m .Ar filesys | device .Sh DESCRIPTION The .Nm utility prints out the UFS super block and cylinder group information for the file system or special device specified, unless the .Fl f , .Fl l or .Fl m flag is specified. The listing is very long and detailed. This command is useful mostly for finding out certain file system information such as the file system block size and minimum free space percentage. .Pp If .Fl f is specified, a sorted list of all free fragments and free fragment ranges, as represented in cylinder group block free lists, is printed. If the flag is specified twice, contiguous free fragments are not collapsed into ranges and instead printed in a simple list. Fragment numbers may be converted to raw byte offsets by multiplying by the fragment size, which may be useful when recovering deleted data. .Pp If .Fl l is specified, the pathname to the file system's container derived from its unique identifier is printed. .Pp If .Fl m is specified, a .Xr newfs 8 command is printed that can be used to generate a new file system with equivalent settings. Please note that .Xr newfs 8 options .Fl E , .Fl R , .Fl S , and .Fl T are not handled and .Fl p is not useful in this case so is omitted. .Xr Newfs 8 options .Fl n and .Fl r are neither checked for nor output but should be. The .Fl r flag is needed if the filesystem uses .Xr gjournal 8 . .Sh SEE ALSO .Xr disktab 5 , .Xr fs 5 , -.Xr disklabel 8 , .Xr fsck 8 , +.Xr gpart 8 , .Xr newfs 8 , .Xr tunefs 8 .Sh HISTORY The .Nm utility appeared in .Bx 4.2 . Index: head/sbin/fdisk/fdisk.8 =================================================================== --- head/sbin/fdisk/fdisk.8 (revision 287395) +++ head/sbin/fdisk/fdisk.8 (revision 287396) @@ -1,501 +1,508 @@ .\" $FreeBSD$ .\" .Dd October 1, 2013 .Dt FDISK 8 .Os .Sh NAME .Nm fdisk .Nd PC slice table maintenance utility .Sh SYNOPSIS .Nm .Op Fl BIaipqstu .Op Fl b Ar bootcode .Op Fl 1234 .Op Ar disk .Nm .Fl f Ar configfile .Op Fl itv .Op Ar disk .Sh PROLOGUE In order for the BIOS to boot the kernel, certain conventions must be adhered to. Sector 0 of the disk must contain boot code, a slice table, and a magic number. BIOS slices can be used to break the disk up into several pieces. The BIOS brings in sector 0 and verifies the magic number. The sector 0 boot code then searches the slice table to determine which slice is marked .Dq active . This boot code then brings in the bootstrap from the active slice and, if marked bootable, runs it. Under .Tn DOS , you can have one or more slices with one active. The .Tn DOS .Nm utility can be used to divide space on the disk into slices and set one active. .Sh DESCRIPTION +.Bf -symbolic +This command is obsolete. +Users are advised to use +.Xr gpart 8 +instead. +.Ef +.Pp The .Fx utility, .Nm , serves a similar purpose to the .Tn DOS utility. The first form is used to display slice information or to interactively edit the slice table. The second is used to write a slice table using a .Ar configfile , and is designed to be used by other scripts/programs. .Pp Options are: .Bl -tag -width indent .It Fl a Change the active slice only. Ignored if .Fl f is given. .It Fl b Ar bootcode Get the boot code from the file .Ar bootcode . Default is .Pa /boot/mbr . .It Fl B Reinitialize the boot code contained in sector 0 of the disk. Ignored if .Fl f is given. .It Fl f Ar configfile Set slice values using the file .Ar configfile . The .Ar configfile only modifies explicitly specified slices, unless .Fl i is also given, in which case all existing slices are deleted (marked as .Dq unused ) before the .Ar configfile is read. The .Ar configfile can be .Sq Fl , in which case standard input is read. See .Sx CONFIGURATION FILE , below, for file syntax. .Pp .Em WARNING : when .Fl f is used, you are not asked if you really want to write the slices table (as you are in the interactive mode). Use with caution! .It Fl i Initialize sector 0 of the disk. Existing slice entries will be cleared (marked as unused) before editing. (Compare with .Fl u . ) .It Fl I Initialize sector 0 slice table for one .Fx slice covering the entire disk. .It Fl p Print a slice table in .Nm configuration file format and exit; see .Sx CONFIGURATION FILE , below. .It Fl q Be quiet. Benign warnings (such as "GEOM not found") are suppressed. .It Fl s Print summary information and exit. .It Fl t Test mode; do not write slice values. Generally used with the .Fl f option to see what would be written to the slice table. Implies .Fl v . .It Fl u Update (edit) the disk's sector 0 slice table. Ignored if .Fl f is given. .It Fl v Be verbose. When .Fl f is used, .Nm prints out the slice table that is written to the disk. .It Fl 1234 Operate on a single slice table entry only. Ignored if .Fl f is given. .El .Pp The final disk name can be provided as a .Dq bare disk name only, e.g.\& .Pa da0 , or as a full pathname. If omitted, .Nm tries to figure out the default disk device name from the mounted root device. .Pp When called with no arguments, it prints the sector 0 slice table. An example follows: .Bd -literal ******* Working on device /dev/ada0 ******* parameters extracted from in-core disklabel are: cylinders=769 heads=15 sectors/track=33 (495 blks/cyl) parameters to be used for BIOS calculations are: cylinders=769 heads=15 sectors/track=33 (495 blks/cyl) Warning: BIOS sector numbering starts with sector 1 Information from DOS bootblock is: The data for partition 1 is: sysid 165,(FreeBSD/NetBSD/386BSD) start 495, size 380160 (185 Meg), flag 0 beg: cyl 1/ sector 1/ head 0; end: cyl 768/ sector 33/ head 14 The data for partition 2 is: sysid 164,(unknown) start 378180, size 2475 (1 Meg), flag 0 beg: cyl 764/ sector 1/ head 0; end: cyl 768/ sector 33/ head 14 The data for partition 3 is: The data for partition 4 is: sysid 99,(ISC UNIX, other System V/386, GNU HURD or Mach) start 380656, size 224234 (109 Meg), flag 80 beg: cyl 769/ sector 2/ head 0; end: cyl 197/ sector 33/ head 14 .Ed .Pp The disk is divided into three slices that happen to fill the disk. The second slice overlaps the end of the first. (Used for debugging purposes.) .Bl -tag -width ".Em cyl , sector No and Em head" .It Em sysid is used to label the slice. .Fx reserves the magic number 165 decimal (A5 in hex). .It Xo .Em start and .Em size .Xc fields provide the start address and size of a slice in sectors. .It Em "flag 80" specifies that this is the active slice. .It Xo .Em cyl , sector and .Em head .Xc fields are used to specify the beginning and end addresses of the slice. .El .Pp .Em Note : these numbers are calculated using BIOS's understanding of the disk geometry and saved in the bootblock. .Pp The .Fl i and .Fl u flags are used to indicate that the slice data is to be updated. Unless the .Fl f option is also given, .Nm will enter a conversational mode. In this mode, no changes will be written to disk unless you explicitly tell .Nm to. .Pp The .Nm utility will display each slice and ask whether you want to edit it. If you say yes, .Nm will step through each field, show you the old value, and ask you for a new one. When you are done with the slice, .Nm will display it and ask you whether it is correct. It will then proceed to the next entry. .Pp Getting the .Em cyl , sector , and .Em head fields correct is tricky, so by default, they will be calculated for you; you can specify them if you choose to though. .Pp After all the slices are processed, you are given the option to change the .Dq active slice. Finally, when all the new data for sector 0 has been accumulated, you are asked to confirm whether you really want to rewrite it. .Pp The difference between the .Fl u and .Fl i flags is that the .Fl u flag edits (updates) the existing slice parameters while the .Fl i flag is used to .Dq initialize them (old values will be ignored); if you edit the first slice, .Fl i will also set it up to use the whole disk for .Fx and make it active. .Sh NOTES The automatic calculation of starting cylinder etc.\& uses a set of figures that represent what the BIOS thinks the geometry of the drive is. These figures are taken from the in-core disklabel by default, but .Nm initially gives you an opportunity to change them. This allows you to create a bootblock that can work with drives that use geometry translation under the BIOS. .Pp If you hand craft your disk layout, please make sure that the .Fx slice starts on a cylinder boundary. .Pp Editing an existing slice will most likely result in the loss of all data in that slice. .Pp You should run .Nm interactively once or twice to see how it works. This is completely safe as long as you answer the last question in the negative. There are subtleties that .Nm detects that are not fully explained in this manual page. .Sh CONFIGURATION FILE When the .Fl f option is given, a disk's slice table can be written using values from a .Ar configfile . The syntax of this file is very simple; each line is either a comment or a specification, as follows: .Bl -tag -width indent .It Ic # Ar comment ... Lines beginning with a .Ic # are comments and are ignored. .It Ic g Ar spec1 spec2 spec3 Set the BIOS geometry used in slice calculations. There must be three values specified, with a letter preceding each number: .Bl -tag -width indent .It Cm c Ns Ar num Set the number of cylinders to .Ar num . .It Cm h Ns Ar num Set the number of heads to .Ar num . .It Cm s Ns Ar num Set the number of sectors/track to .Ar num . .El .Pp These specs can occur in any order, as the leading letter determines which value is which; however, all three must be specified. .Pp This line must occur before any lines that specify slice information. .Pp It is an error if the following is not true: .Bd -literal -offset indent 1 <= number of cylinders 1 <= number of heads <= 256 1 <= number of sectors/track < 64 .Ed .Pp The number of cylinders should be less than or equal to 1024, but this is not enforced, although a warning will be printed. Note that bootable .Fx slices (the .Dq Pa / file system) must lie completely within the first 1024 cylinders; if this is not true, booting may fail. Non-bootable slices do not have this restriction. .Pp Example (all of these are equivalent), for a disk with 1019 cylinders, 39 heads, and 63 sectors: .Bd -literal -offset indent g c1019 h39 s63 g h39 c1019 s63 g s63 h39 c1019 .Ed .It Ic p Ar slice type start length Set the slice given by .Ar slice (1-4) to type .Ar type , starting at sector .Ar start for .Ar length sectors. If the .Ar start or .Ar length is suffixed with a .Em K , .Em M or .Em G , it is taken as a .Em Kilobyte , .Em Megabyte or .Em Gigabyte measurement respectively. If the .Ar start is given as .Qq * it is set to the value of the previous partition end. If the .Ar length is given as .Qq * the partition end is set to the end of the disk. .Pp Only those slices explicitly mentioned by these lines are modified; any slice not referenced by a .Ic p line will not be modified. However, if an invalid slice table is present, or the .Fl i option is specified, all existing slice entries will be cleared (marked as unused), and these .Ic p lines will have to be used to explicitly set slice information. If multiple slices need to be set, multiple .Ic p lines must be specified; one for each slice. .Pp These slice lines must occur after any geometry specification lines, if one is present. .Pp The .Ar type is 165 for .Fx slices. Specifying a slice type of zero is the same as clearing the slice and marking it as unused; however, dummy values (such as .Dq 0 ) must still be specified for .Ar start and .Ar length . .Pp Note: the start offset will be rounded upwards to a head boundary if necessary, and the end offset will be rounded downwards to a cylinder boundary if necessary. .Pp Example: to clear slice 4 and mark it as unused: .Pp .Dl "p 4 0 0 0" .Pp Example: to set slice 1 to a .Fx slice, starting at sector 1 for 2503871 sectors (note: these numbers will be rounded upwards and downwards to correspond to head and cylinder boundaries): .Pp .Dl "p 1 165 1 2503871" .Pp Example: to set slices 1, 2 and 4 to .Fx slices, the first being 2 Gigabytes, the second being 10 Gigabytes and the forth being the remainder of the disk (again, numbers will be rounded appropriately): .Pp .Dl "p 1 165 63 2G" .Dl "p 2 165 * 10G" .Dl "p 3 0 0 0" .Dl "p 4 165 * *" .It Ic a Ar slice Make .Ar slice the active slice. Can occur anywhere in the config file, but only one must be present. .Pp Example: to make slice 1 the active slice: .Pp .Dl "a 1" .El .Sh FILES .Bl -tag -width ".Pa /boot/mbr" -compact .It Pa /boot/mbr The default boot code. .El .Sh SEE ALSO .Xr boot0cfg 8 , .Xr bsdlabel 8 , .Xr gpart 8 , .Xr newfs 8 .Sh BUGS The default boot code will not necessarily handle all slice types correctly, in particular those introduced since .Tn MS-DOS 6.x. .Pp The entire utility should be made more user-friendly. .Pp Most users new to .Fx do not understand the difference between .Dq slice and .Dq partition , causing difficulty to adjust. .Pp You cannot use this command to completely dedicate a disk to .Fx . The .Xr bsdlabel 8 command must be used for this. Index: head/sbin/ffsinfo/ffsinfo.8 =================================================================== --- head/sbin/ffsinfo/ffsinfo.8 (revision 287395) +++ head/sbin/ffsinfo/ffsinfo.8 (revision 287396) @@ -1,145 +1,145 @@ .\" Copyright (c) 2000 Christoph Herrmann, Thomas-Henning von Kamptz .\" Copyright (c) 1980, 1989, 1993 The Regents of the University of California. .\" All rights reserved. .\" .\" This code is derived from software contributed to Berkeley by .\" Christoph Herrmann and Thomas-Henning von Kamptz, Munich and Frankfurt. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgment: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors, as well as Christoph .\" Herrmann and Thomas-Henning von Kamptz. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" $TSHeader: src/sbin/ffsinfo/ffsinfo.8,v 1.3 2000/12/12 19:30:55 tomsoft Exp $ .\" $FreeBSD$ .\" .Dd September 8, 2000 .Dt FFSINFO 8 .Os .Sh NAME .Nm ffsinfo .Nd "dump all meta information of an existing ufs file system" .Sh SYNOPSIS .Nm .Op Fl g Ar cylinder_group .Op Fl i Ar inode .Op Fl l Ar level .Op Fl o Ar outfile .Ar special | file .Sh DESCRIPTION The .Nm utility extends the .Xr dumpfs 8 utility. .Pp The output is appended to the file .Pa outfile . Also expect the output file to be rather large. Up to 2 percent of the size of the specified file system is not uncommon. .Pp The following options are available: .Bl -tag -width indent .It Fl g Ar cylinder_group This restricts the dump to information about this cylinder group only. Here .Ar 0 means the first cylinder group and .Ar -1 the last one. .It Fl i Ar inode This restricts the dump to information about this particular inode only. Here the minimum acceptable inode is .Ar 2 . If this option is omitted but a cylinder group is defined then only inodes within that cylinder group are dumped. .It Fl l Ar level The level of detail which will be dumped. This value defaults to .Ar 255 and is the .Dq bitwise or of the following table: .Pp .Bl -hang -width indent -compact .It Ar 0x001 initial superblock .It Ar 0x002 superblock copies in each cylinder group .It Ar 0x004 cylinder group summary in initial cylinder group .It Ar 0x008 cylinder group information .It Ar 0x010 inode allocation bitmap .It Ar 0x020 fragment allocation bitmap .It Ar 0x040 cluster maps and summary .It Ar 0x100 inode information .It Ar 0x200 indirect block dump .El .It Fl o Ar outfile This sets the output filename where the dump is written to, and must be specified. If .Fl is provided, output will be sent to stdout. .El .Sh EXAMPLES .Dl ffsinfo -o /var/tmp/ffsinfo -l 1023 /dev/vinum/testvol .Pp will dump .Pa /dev/vinum/testvol to .Pa /var/tmp/ffsinfo with all available information. .Sh SEE ALSO -.Xr disklabel 8 , .Xr dumpfs 8 , .Xr fsck 8 , +.Xr gpart 8 , .Xr growfs 8 , .Xr gvinum 8 , .Xr newfs 8 , .Xr tunefs 8 .Sh HISTORY The .Nm utility first appeared in .Fx 4.4 . .Sh AUTHORS .An Christoph Herrmann Aq Mt chm@FreeBSD.org .An Thomas-Henning von Kamptz Aq Mt tomsoft@FreeBSD.org .An The GROWFS team Aq Mt growfs@Tomsoft.COM .Sh BUGS Snapshots are handled like plain files. They should get their own level to provide for independent control of the amount of what gets dumped. It probably also makes sense to some extend to dump the snapshot as a file system. Index: head/sbin/mdconfig/mdconfig.8 =================================================================== --- head/sbin/mdconfig/mdconfig.8 (revision 287395) +++ head/sbin/mdconfig/mdconfig.8 (revision 287396) @@ -1,321 +1,320 @@ .\" Copyright (c) 1993 University of Utah. .\" Copyright (c) 1980, 1989, 1991, 1993 .\" The Regents of the University of California. All rights reserved. .\" Copyright (c) 2000 .\" Poul-Henning Kamp All rights reserved. .\" .\" This code is derived from software contributed to Berkeley by .\" the Systems Programming Group of the University of Utah Computer .\" Science Department. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" @(#)vnconfig.8 8.1 (Berkeley) 6/5/93 .\" from: src/usr.sbin/vnconfig/vnconfig.8,v 1.19 2000/12/27 15:30:29 .\" .\" $FreeBSD$ .\" .Dd August 6, 2015 .Dt MDCONFIG 8 .Os .Sh NAME .Nm mdconfig .Nd create and control memory disks .Sh SYNOPSIS .Nm .Fl a .Fl t Ar type .Op Fl n .Oo Fl o Oo Cm no Oc Ns Ar option Oc ... .Op Fl f Ar file .Op Fl s Ar size .Op Fl S Ar sectorsize .Op Fl u Ar unit .Op Fl x Ar sectors/track .Op Fl y Ar heads/cylinder .Nm .Fl d .Fl u Ar unit .Op Fl o Oo Cm no Oc Ns Ar force .Nm .Fl r .Fl u Ar unit .Fl s Ar size .Op Fl o Oo Cm no Oc Ns Ar force .Nm .Fl l .Op Fl n .Op Fl v .Op Fl f Ar file .Op Fl u Ar unit .Nm .Ar file .Sh DESCRIPTION The .Nm utility creates and controls .Xr md 4 devices. .Pp Options indicate an action to be performed: .Bl -tag -width indent .It Fl a Attach a memory disk. This will configure and attach a memory disk with the parameters specified and attach it to the system. If the .Fl u Ar unit option is not provided, the newly created device name will be printed on stdout. .It Fl d Detach a memory disk from the system and release all resources. .It Fl r Resize a memory disk. .It Fl t Ar type Select the type of the memory disk. .Bl -tag -width "malloc" .It Cm malloc Storage for this type of memory disk is allocated with .Xr malloc 9 . This limits the size to the malloc bucket limit in the kernel. If the .Fl o Cm reserve option is not set, creating and filling a large malloc-backed memory disk is a very easy way to panic the system. .It Cm vnode A file specified with .Fl f Ar file becomes the backing store for this memory disk. .It Cm swap Storage for this type of memory disk is allocated from buffer memory. Pages get pushed out to swap when the system is under memory pressure, otherwise they stay in the operating memory. Using .Cm swap backing is generally preferred instead of using .Cm malloc backing. .It Cm null Bitsink; all writes do nothing, all reads return zeroes. .El .It Fl f Ar file Filename to use for the vnode type memory disk. The .Fl a and .Fl t Ar vnode options are implied if not specified. .It Fl l List configured devices. If given with .Fl u , display details about that particular device. If given with .Fl f Ar file , display .Xr md 4 device names of which .Ar file is used as the backing store. If both of .Fl u and .Fl f options are specified, display devices which match the two conditions. If the .Fl v option is specified, show all details. .It Fl n When printing .Xr md 4 device names, print only the unit number without the .Xr md 4 prefix. .It Fl s Ar size Size of the memory disk. .Ar Size is the number of 512 byte sectors unless suffixed with a .Cm b , k , m , g , or .Cm t which denotes byte, kilobyte, megabyte, gigabyte and terabyte respectively. When used without the .Fl r option, the .Fl a and .Fl t Ar swap options are implied if not specified. .It Fl S Ar sectorsize Sectorsize to use for the memory disk, in bytes. .It Fl x Ar sectors/track See the description of the .Fl y option below. .It Fl y Ar heads/cylinder For .Cm malloc or .Cm vnode backed devices, the .Fl x and .Fl y options can be used to specify a synthetic geometry. This is useful for constructing bootable images for later download to other devices. .It Fl o Oo Cm no Oc Ns Ar option Set or reset options. .Bl -tag -width indent .It Oo Cm no Oc Ns Cm async For .Cm vnode backed devices: avoid .Dv IO_SYNC for increased performance but at the risk of deadlocking the entire kernel. .It Oo Cm no Oc Ns Cm reserve Allocate and reserve all needed storage from the start, rather than as needed. .It Oo Cm no Oc Ns Cm cluster Enable clustering on this disk. .It Oo Cm no Oc Ns Cm compress Enable/disable compression features to reduce memory usage. .It Oo Cm no Oc Ns Cm force Disable/enable extra sanity checks to prevent the user from doing something that might adversely affect the system. This can be used with the .Fl d flag to forcibly destroy an .Xr md 4 disk that is still in use. .It Oo Cm no Oc Ns Cm readonly Enable/disable readonly mode. .El .It Fl u Ar unit Request a specific unit number or device name for the .Xr md 4 device instead of automatic allocation. If a device name is specified, it must be start with .Dq md followed by the unit number. .El .Pp The last form, .Nm .Ar file , is provided for convenience as an abbreviation of .Nm .Fl a .Fl t Ar vnode .Fl f Ar file . .Sh EXAMPLES Create a disk with .Pa /tmp/boot.flp as backing storage. The name of the allocated unit will be printed on stdout, such as .Dq Li md0 : .Bd -literal -offset indent mdconfig /tmp/boot.flp .Ed .Pp Create a 1 gigabyte swap backed memory disk named .Dq Li md3 : .Bd -literal -offset indent mdconfig -s 1g -u md3 .Ed .Pp Detach and free all resources used by .Pa /dev/md3 : .Bd -literal -offset indent mdconfig -du md3 .Ed .Pp Show detailed information on current memory disks: .Bd -literal -offset indent mdconfig -lv .Ed .Pp Resize the .Dq Li md3 memory disk to 2 gigabytes: .Bd -literal -offset indent mdconfig -rs 2g -u md3 .Ed .Pp Create a 1 gigabyte swap backed disk, initialize an .Xr ffs 7 file system on it, and mount it on .Pa /tmp : .Bd -literal -offset indent mdconfig -s 1g -u md10 newfs -U /dev/md10 mount /dev/md10 /tmp chmod 1777 /tmp .Ed .Pp Create a memory disk out of an ISO 9660 CD image file, using the first available .Xr md 4 device, and then mount it: .Bd -literal -offset indent mount -t cd9660 /dev/`mdconfig -f cdimage.iso` /mnt .Ed .Pp Create a file-backed device from a hard disk image that begins with 512K of raw header information. .Xr gnop 8 is used to skip over the header information, positioning .Pa md1.nop to the start of the filesystem in the image. .Bd -literal -offset indent mdconfig -u md1 -f diskimage.img gnop create -o 512K md1 mount /dev/md1.nop /mnt .Ed .Sh SEE ALSO .Xr md 4 , .Xr ffs 7 , -.Xr bsdlabel 8 , -.Xr fdisk 8 , +.Xr gpart 8 , .Xr mdmfs 8 , .Xr malloc 9 .Sh HISTORY The .Nm utility first appeared in .Fx 5.0 as a cleaner replacement for the .Xr vn 4 and .Xr vnconfig 8 combo. .Sh AUTHORS The .Nm utility was written by .An Poul-Henning Kamp Aq Mt phk@FreeBSD.org . Index: head/sbin/newfs/newfs.8 =================================================================== --- head/sbin/newfs/newfs.8 (revision 287395) +++ head/sbin/newfs/newfs.8 (revision 287396) @@ -1,333 +1,333 @@ .\" Copyright (c) 1983, 1987, 1991, 1993, 1994 .\" The Regents of the University of California. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" @(#)newfs.8 8.6 (Berkeley) 5/3/95 .\" $FreeBSD$ .\" .Dd July 15, 2015 .Dt NEWFS 8 .Os .Sh NAME .Nm newfs .Nd construct a new UFS1/UFS2 file system .Sh SYNOPSIS .Nm .Op Fl EJNUjlnt .Op Fl L Ar volname .Op Fl O Ar filesystem-type .Op Fl S Ar sector-size .Op Fl T Ar disktype .Op Fl a Ar maxcontig .Op Fl b Ar block-size .Op Fl c Ar blocks-per-cylinder-group .Op Fl d Ar max-extent-size .Op Fl e Ar maxbpg .Op Fl f Ar frag-size .Op Fl g Ar avgfilesize .Op Fl h Ar avgfpdir .Op Fl i Ar bytes .Op Fl k Ar held-for-metadata-blocks .Op Fl m Ar free-space .Op Fl o Ar optimization .Op Fl p Ar partition .Op Fl r Ar reserved .Op Fl s Ar size .Ar special .Sh DESCRIPTION The .Nm utility is used to initialize and clear file systems before first use. The .Nm utility builds a file system on the specified special file. (We often refer to the .Dq special file as the .Dq disk , although the special file need not be a physical disk. In fact, it need not even be special.) Typically the defaults are reasonable, however .Nm has numerous options to allow the defaults to be selectively overridden. .Pp The following options define the general layout policies: .Bl -tag -width indent .It Fl E Erase the content of the disk before making the filesystem. The reserved area in front of the superblock (for bootcode) will not be erased. .Pp This option is only relevant for flash based storage devices that use wear-leveling algorithms. .Pp Erasing may take a long time as it writes to every sector on the disk. .It Fl J Enable journaling on the new file system via gjournal. See .Xr gjournal 8 for details. .It Fl L Ar volname Add a volume label to the new file system. .It Fl N Cause the file system parameters to be printed out without really creating the file system. .It Fl O Ar filesystem-type Use 1 to specify that a UFS1 format file system be built; use 2 to specify that a UFS2 format file system be built. The default format is UFS2. .It Fl T Ar disktype For backward compatibility. .It Fl U Enable soft updates on the new file system. .It Fl a Ar maxcontig Specify the maximum number of contiguous blocks that will be laid out before forcing a rotational delay. The default value is 16. See .Xr tunefs 8 for more details on how to set this option. .It Fl b Ar block-size The block size of the file system, in bytes. It must be a power of 2. The default size is 32768 bytes, and the smallest allowable size is 4096 bytes. The optimal block:fragment ratio is 8:1. Other ratios are possible, but are not recommended, and may produce poor results. .It Fl c Ar blocks-per-cylinder-group The number of blocks 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 parameters, in particular the block size and the number of bytes per inode. .It Fl d Ar max-extent-size The file system may choose to store large files using extents. This parameter specifies the largest extent size that may be used. The default value is the file system blocksize. It is presently limited to a maximum value of 16 times the file system blocksize and a minimum value of the file system blocksize. .It Fl e Ar maxbpg Indicate 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 .Xr tunefs 8 for more details on how to set this option. .It Fl f Ar frag-size The fragment size of the file system in bytes. It must be a power of two ranging in value between .Ar blocksize Ns /8 and .Ar blocksize . The default is 4096 bytes. .It Fl g Ar avgfilesize The expected average file size for the file system. .It Fl h Ar avgfpdir The expected average number of files per directory on the file system. .It Fl i Ar bytes Specify the density of inodes in the file system. The default is to create an inode for every .Pq 2 * Ar frag-size 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. One inode is required for each distinct file, so this value effectively specifies the average file size on the file system. .It Fl j Enable soft updates journaling on the new file system. This flag is implemented by running the .Xr tunefs 8 utility found in the user's .Dv $PATH . .It Fl k Ar held-for-metadata-blocks Set the amount of space to be held for metadata blocks in each cylinder group. When set, the file system preference routines will try to save the specified amount of space immediately following the inode blocks in each cylinder group for use by metadata blocks. Clustering the metadata blocks speeds up random file access and decreases the running time of .Xr fsck 8 . By default .Nm sets it to half of the space reserved to minfree. .It Fl l Enable multilabel MAC on the new file system. .It Fl m Ar free-space The percentage of space reserved from normal users; the minimum free space threshold. The default value used is defined by .Dv MINFREE from .In ufs/ffs/fs.h , currently 8%. See .Xr tunefs 8 for more details on how to set this option. .It Fl n Do not create a .Pa .snap directory on the new file system. The resulting file system will not support snapshot generation, so .Xr dump 8 in live mode and background .Xr fsck 8 will not function properly. The traditional .Xr fsck 8 and offline .Xr dump 8 will work on the file system. This option is intended primarily for memory or vnode-backed file systems that do not require .Xr dump 8 or .Xr fsck 8 support. .It Fl o Ar optimization .Cm ( space or .Cm 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 8%, the default is to optimize for .Cm space ; if the value of minfree is greater than or equal to 8%, the default is to optimize for .Cm time . See .Xr tunefs 8 for more details on how to set this option. .It Fl p Ar partition The partition name (a..h) you want to use in case the underlying image is a file, so you do not have access to individual partitions through the filesystem. Can also be used with a device, e.g., .Nm .Fl p Ar f .Ar /dev/da1s3 is equivalent to .Nm .Ar /dev/da1s3f . .It Fl r Ar reserved The size, in sectors, of reserved space at the end of the partition specified in .Ar special . This space will not be occupied by the file system; it can be used by other consumers such as .Xr geom 4 . Defaults to 0. .It Fl s Ar size The size of the file system in sectors. This value defaults to the size of the raw partition specified in .Ar special less the .Ar reserved space at its end (see .Fl r ) . A .Ar size of 0 can also be used to choose the default value. A valid .Ar size value cannot be larger than the default one, which means that the file system cannot extend into the reserved space. .It Fl t Turn on the TRIM enable flag. If enabled, and if the underlying device supports the BIO_DELETE command, the file system will send a delete request to the underlying device for each freed block. The trim enable flag is typically set when the underlying device uses flash-memory as the device can use the delete command to pre-zero or at least avoid copying blocks that have been deleted. .El .Pp 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 .Nm 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 impossible for .Xr fsck 8 to find the alternate superblocks if the standard superblock is lost. .Bl -tag -width indent .It Fl S Ar sector-size The size of a sector in bytes (almost never anything but 512). .El .Sh EXAMPLES .Dl newfs /dev/ada3s1a .Pp Creates a new ufs file system on .Pa ada3s1a . The .Nm utility will use a block size of 32768 bytes, a fragment size of 4096 bytes and the largest possible number of blocks per cylinders group. These values tend to produce better performance for most applications than the historical defaults (8192 byte block size and 1024 byte fragment size). This large fragment size may lead to much wasted space on file systems that contain many small files. .Sh SEE ALSO .Xr fdformat 1 , .Xr geom 4 , .Xr disktab 5 , .Xr fs 5 , -.Xr bsdlabel 8 , .Xr camcontrol 8 , .Xr dump 8 , .Xr dumpfs 8 , .Xr fsck 8 , +.Xr gpart 8 , .Xr gjournal 8 , .Xr growfs 8 , .Xr gvinum 8 , .Xr makefs 8 , .Xr mount 8 , .Xr tunefs 8 .Rs .%A M. McKusick .%A W. Joy .%A S. Leffler .%A R. Fabry .%T A Fast File System for UNIX .%J ACM Transactions on Computer Systems 2 .%V 3 .%P pp 181-197 .%D August 1984 .%O (reprinted in the BSD System Manager's Manual) .Re .Sh HISTORY The .Nm utility appeared in .Bx 4.2 . Index: head/sbin/newfs_msdos/newfs_msdos.8 =================================================================== --- head/sbin/newfs_msdos/newfs_msdos.8 (revision 287395) +++ head/sbin/newfs_msdos/newfs_msdos.8 (revision 287396) @@ -1,241 +1,239 @@ .\" Copyright (c) 1998 Robert Nordier .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in .\" the documentation and/or other materials provided with the .\" distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS .\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY .\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE .\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER .\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN .\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" .\" $FreeBSD$ .\" .Dd April 9, 2015 .Dt NEWFS_MSDOS 8 .Os .Sh NAME .Nm newfs_msdos .Nd construct a new MS-DOS (FAT) file system .Sh SYNOPSIS .Nm .Op Fl N .Op Fl @ Ar offset .Op Fl B Ar boot .Op Fl C Ar create-size .Op Fl F Ar FAT-type .Op Fl I Ar VolumeId .Op Fl L Ar label .Op Fl O Ar OEM .Op Fl S Ar sector-size .Op Fl a Ar FAT-size .Op Fl b Ar block-size .Op Fl c Ar cluster-size .Op Fl e Ar DirEnts .Op Fl f Ar format .Op Fl h Ar heads .Op Fl i Ar info .Op Fl k Ar backup .Op Fl m Ar media .Op Fl n Ar FATs .Op Fl o Ar hidden .Op Fl r Ar reserved .Op Fl s Ar total .Op Fl u Ar track-size .Ar special .Op Ar disktype .Sh DESCRIPTION The .Nm utility creates a FAT12, FAT16, or FAT32 file system on device or file named .Ar special , using .Xr disktab 5 entry .Ar disktype to determine geometry, if required. .Pp If .Ar special does not contain a .Ar / and .Fl C is not used, it is assumed to be a device name and .Ar /dev/ is prepended to the name to construct the actual device name. To work a file in the current directory use .Ar ./filename .Pp The options are as follow: .Bl -tag -width indent .It Fl N Do not create a file system: just print out parameters. .It Fl @ Ar offset Build the filesystem at the specified offset in bytes in the device or file. A suffix s, k, m, g (lower or upper case) appended to the offset specifies that the number is in sectors, kilobytes, megabytes or gigabytes, respectively. .It Fl B Ar boot Get bootstrap from file. .It Fl C Ar create-size Create the image file with the specified size. A suffix character appended to the size is interpreted as for the .Fl @ option. The file is created by truncating any existing file with the same name and resizing it to the requested size. If the file system supports sparse files, the space occupied on disk may be smaller than the size specified as parameter. .It Fl F Ar FAT-type FAT type (one of 12, 16, or 32). .It Fl I Ar VolumeID Volume ID, a 32 bit number in decimal or hexadecimal (0x...) format. .It Fl L Ar label Volume label (up to 11 characters). The label should consist of only those characters permitted in regular DOS (8+3) filenames. .It Fl O Ar OEM OEM string (up to 8 characters). The default is .Qq Li "BSD4.4 " . .It Fl S Ar sector-size Number of bytes per sector. Acceptable values are powers of 2 in the range 512 through 32768, inclusive. .It Fl a Ar FAT-size Number of sectors per FAT. .It Fl b Ar block-size File system block size (bytes per cluster). This should resolve to an acceptable number of sectors per cluster (see below). .It Fl c Ar cluster-size Sectors per cluster. Acceptable values are powers of 2 in the range 1 through 128. If the block or cluster size are not specified, the code uses a cluster between 512 bytes and 32K depending on the filesystem size. .It Fl e Ar DirEnts Number of root directory entries (FAT12 and FAT16 only). .It Fl f Ar format Specify a standard (floppy disk) format. The standard formats are (capacities in kilobytes): 160, 180, 320, 360, 640, 720, 1200, 1232, 1440, 2880. .It Fl h Ar heads Number of drive heads. .It Fl i Ar info Location of the file system info sector (FAT32 only). A value of 0xffff signifies no info sector. .It Fl k Ar backup Location of the backup boot sector (FAT32 only). A value of 0xffff signifies no backup sector. .It Fl m Ar media Media descriptor (acceptable range 0xf0 to 0xff). .It Fl n Ar FATs Number of FATs. Acceptable values are 1 to 16 inclusive. The default is 2. .It Fl o Ar hidden Number of hidden sectors. .It Fl r Ar reserved Number of reserved sectors. .It Fl s Ar total File system size. .It Fl u Ar track-size Number of sectors per track. .El .Sh NOTES If some parameters (e.g. size, number of sectors, etc.) are not specified through options or disktype, the program tries to generate them automatically. In particular, the size is determined as the device or file size minus the offset specified with the .Fl @ option. When the geometry is not available, it is assumed to be 63 sectors, 255 heads. The size is then rounded to become a multiple of the track size and avoid complaints by some filesystem code. .Pp FAT file system parameters occupy a "Boot Sector BPB (BIOS Parameter Block)" in the first of the "reserved" sectors which precede the actual file system. For reference purposes, this structure is presented below. .Bd -literal struct bsbpb { uint16_t bpbBytesPerSec; /* [-S] bytes per sector */ uint8_t bpbSecPerClust; /* [-c] sectors per cluster */ uint16_t bpbResSectors; /* [-r] reserved sectors */ uint8_t bpbFATs; /* [-n] number of FATs */ uint16_t bpbRootDirEnts; /* [-e] root directory entries */ uint16_t bpbSectors; /* [-s] total sectors */ uint8_t bpbMedia; /* [-m] media descriptor */ uint16_t bpbFATsecs; /* [-a] sectors per FAT */ uint16_t bpbSecPerTrack; /* [-u] sectors per track */ uint16_t bpbHeads; /* [-h] drive heads */ uint32_t bpbHiddenSecs; /* [-o] hidden sectors */ uint32_t bpbHugeSectors; /* [-s] big total sectors */ }; /* FAT32 extensions */ struct bsxbpb { uint32_t bpbBigFATsecs; /* [-a] big sectors per FAT */ uint16_t bpbExtFlags; /* control flags */ uint16_t bpbFSVers; /* file system version */ uint32_t bpbRootClust; /* root directory start cluster */ uint16_t bpbFSInfo; /* [-i] file system info sector */ uint16_t bpbBackup; /* [-k] backup boot sector */ }; .Ed .Sh LIMITATION The maximum file size is 4GB, even if the file system itself is bigger. .Sh EXIT STATUS Exit status is 0 on success and 1 on error. .Sh EXAMPLES Create a file system, using default parameters, on .Pa /dev/ada0s1 : .Bd -literal -offset indent newfs_msdos /dev/ada0s1 .Ed .Pp Create a standard 1.44M file system, with volume label .Ar foo , on .Pa /dev/fd0 : .Bd -literal -offset indent newfs_msdos -f 1440 -L foo fd0 .Ed .Pp Create a 30MB image file, with the FAT partition starting 63 sectors within the image file: .Bd -literal -offset indent newfs_msdos -C 30M -@63s ./somefile .Ed .Sh SEE ALSO -.Xr disktab 5 , -.Xr disklabel 8 , -.Xr fdisk 8 , +.Xr gpart 8 , .Xr newfs 8 .Sh HISTORY The .Nm utility first appeared in .Fx 3.0 . .Sh AUTHORS .An Robert Nordier Aq Mt rnordier@FreeBSD.org Index: head/sbin/newfs_nandfs/newfs_nandfs.8 =================================================================== --- head/sbin/newfs_nandfs/newfs_nandfs.8 (revision 287395) +++ head/sbin/newfs_nandfs/newfs_nandfs.8 (revision 287396) @@ -1,76 +1,74 @@ .\" .\" Copyright (c) 2010 Semihalf .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" $FreeBSD$ .\" .Dd October 1, 2013 .Dt NEWFS_NANDFS 8 .Os .Sh NAME .Nm newfs_nandfs .Nd construct a new NAND FS file system .Sh SYNOPSIS .Nm .Op Fl b Ar blocsize .Op Fl B Ar blocks-per-segment .Op Fl L Ar label .Op Fl m Ar reserved-segment-percent .Ar device .Sh DESCRIPTION The .Nm utility creates a NAND FS file system on device. .Pp The options are as follow: .Bl -tag -width indent .It Fl b Ar blocksize Size of block (1024 if not specified). .It Fl B Ar blocks_per_segment Number of blocks per segment (2048 if not specified). .It Fl L Ar label Volume label (up to 16 characters). .It Fl m Ar reserved_block_percent Percentage of reserved blocks (5 if not specified). .El .Sh EXIT STATUS Exit status is 0 on success and 1 on error. .Sh EXAMPLES Create a file system, using default parameters, on .Pa /dev/ada0s1 : .Bd -literal -offset indent newfs_nandfs /dev/ada0s1 .Ed .Sh SEE ALSO -.Xr disktab 5 , -.Xr disklabel 8 , -.Xr fdisk 8 , +.Xr gpart 8 , .Xr newfs 8 .Sh HISTORY The .Nm utility first appeared in .Fx 10.0 . .Sh AUTHORS .An Grzegorz Bernacki Index: head/sbin/reboot/boot_i386.8 =================================================================== --- head/sbin/reboot/boot_i386.8 (revision 287395) +++ head/sbin/reboot/boot_i386.8 (revision 287396) @@ -1,379 +1,379 @@ .\" Copyright (c) 1991, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" This code is derived from software written and contributed .\" to Berkeley by William Jolitz. .\" .\" Almost completely rewritten for FreeBSD 2.1 by Joerg Wunsch. .\" .\" Substantially revised for FreeBSD 3.1 by Robert Nordier. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" @(#)boot_i386.8 8.2 (Berkeley) 4/19/94 .\" .\" $FreeBSD$ .\" .Dd November 14, 2014 .Dt BOOT 8 i386 .Os .Sh NAME .Nm boot .Nd system bootstrapping procedures .Sh DESCRIPTION .Sy Power fail and crash recovery . Normally, the system will reboot itself at power-up or after crashes. An automatic consistency check of the file systems will be performed, and unless this fails, the system will resume multi-user operations. .Pp .Sy Cold starts . Most i386 PCs attempt to boot first from floppy disk drive 0 (sometimes known as drive A:) and, failing that, from hard disk drive 0 (sometimes known as drive C:, or as drive 0x80 to the BIOS). Some BIOSes allow you to change this default sequence, and may also include a CD-ROM drive as a boot device. .Pp Some newer PCs boot using UEFI firmware, not BIOS. That process is described in .Xr uefi 8 . .Pp By default, a three-stage bootstrap is employed, and control is automatically passed from the boot blocks (bootstrap stages one and two) to a separate third-stage bootstrap program, .Xr loader 8 . This third stage provides more sophisticated control over the booting process than it is possible to achieve in the boot blocks, which are constrained by occupying limited fixed space on a given disk or slice. .Pp However, it is possible to dispense with the third stage altogether, either by specifying a kernel name in the boot block parameter file, .Pa /boot.config , or, unless option .Fl n is set, by hitting a key during a brief pause (while one of the characters .Sy - , .Sy \e , .Sy \&| , or .Sy / is displayed) before .Xr loader 8 is invoked. Booting will also be attempted at stage two, if the third stage cannot be loaded. .Pp The remainder of this subsection deals only with the boot blocks. The .Xr loader 8 program is documented separately. .Pp After the boot blocks have been loaded, you should see a prompt similar to the following: .Bd -literal >> FreeBSD/i386 BOOT Default: 0:ad(0,a)/boot/loader boot: .Ed .Pp The automatic boot will attempt to load .Pa /boot/loader from partition .Ql a of either the floppy or the hard disk. This boot may be aborted by typing any character on the keyboard at the .Ql boot: prompt. At this time, the following input will be accepted: .Bl -tag -width indent .It Ic \&? Give a short listing of the files in the root directory of the default boot device, as a hint about available boot files. (A .Ic ?\& may also be specified as the last segment of a path, in which case the listing will be of the relevant subdirectory.) .It Xo .Sm off .Ar bios_drive : interface ( unit , Oo Ar slice , Oc Ar part ) .Ar filename .Sm on .Op Fl aCcDdghmnPprsv .Op Fl S Ns Ar speed .Xc Specify boot file and flags. .Bl -tag -width indent .It Ar bios_drive The drive number as recognized by the BIOS. 0 for the first drive, 1 for the second drive, etc. .It Ar interface The type of controller to boot from. Note that the controller is required to have BIOS support since the BIOS services are used to load the boot file image. .Pp The supported interfaces are: .Pp .Bl -tag -width "adXX" -compact .It ad ST506, IDE, ESDI, RLL disks on a WD100[2367] or lookalike controller .It fd 5 1/4" or 3 1/2" High density floppies .It da SCSI disk on any supported SCSI controller .\".It cd .\"boot from CDROM .El .It Ar unit The unit number of the drive on the interface being used. 0 for the first drive, 1 for the second drive, etc. .It Oo Ar slice , Oc Ns Ar part The partition letter inside the .Bx portion of the disk. See .Xr bsdlabel 8 . By convention, only partition .Ql a contains a bootable image. If sliced disks are used .Pq Dq fdisk partitions , any .Ar slice (1 for the first slice, 2 for the second slice, etc.\&) can be booted from, with the default (if not specified) being the active slice or, otherwise, the first .Fx slice. If .Ar slice is specified as 0, the first .Fx slice (also known as .Dq compatibility slice) is booted from. .It Ar filename The pathname of the file to boot (relative to the root directory on the specified partition). Defaults to .Pa /boot/kernel/kernel . Symbolic links are not supported (hard links are). .It Xo Op Fl aCcDdghmnPpqrsv .Op Fl S Ns Ar speed .Xc Boot flags: .Pp .Bl -tag -width "-CXX" -compact .It Fl a during kernel initialization, ask for the device to mount as the root file system. .It Fl C try to mount root file system from a CD-ROM. .It Fl c this flag is currently a no-op. .It Fl D boot with the dual console configuration. In the single configuration, the console will be either the internal display or the serial port, depending on the state of the .Fl h option below. In the dual console configuration, both the internal display and the serial port will become the console at the same time, regardless of the state of the .Fl h option. .It Fl d enter the DDB kernel debugger (see .Xr ddb 4 ) as early as possible in kernel initialization. .It Fl g use the GDB remote debugging protocol. .It Fl h force the serial console. For instance, if you boot from the internal console, you can use the .Fl h option to force the kernel to use the serial port as its console device. The serial port driver .Xr sio 4 (but not .Xr uart 4 ) has a flag (0x20) to override this option. If that flag is set, the serial port will always be used as the console, regardless of the .Fl h option described here. .It Fl m mute the console to suppress all console input and output during the boot. .It Fl n ignore key press to interrupt boot before .Xr loader 8 is invoked. .It Fl P probe the keyboard. If no keyboard is found, the .Fl D and .Fl h options are automatically set. .It Fl p pause after each attached device during the device probing phase. .It Fl q be quiet, do not write anything to the console unless automatic boot fails or is disabled. This option only affects second-stage bootstrap, to prevent next stages from writing to the console use in combination with the .Fl m option. .It Fl r use the statically configured default for the device containing the root file system (see .Xr config 8 ) . Normally, the root file system is on the device that the kernel was loaded from. .It Fl s boot into single-user mode; if the console is marked as .Dq insecure (see .Xr ttys 5 ) , the root password must be entered. .It Fl S Ns Ar speed set the speed of the serial console to .Ar speed . The default is 9600 unless it has been overridden by setting .Va BOOT_COMCONSOLE_SPEED in .Xr make.conf 5 and recompiling and reinstalling the boot blocks. .It Fl v be verbose during device probing (and later). .El .El .El .Pp Use the .Pa /boot.config file to set the default configuration options for the boot block code. See .Xr boot.config 5 for more information about the .Pa /boot.config file. .Sh FILES .Bl -tag -width /boot/loader -compact .It Pa /boot.config parameters for the boot blocks (optional) .It Pa /boot/boot1 first stage bootstrap file .It Pa /boot/boot2 second stage bootstrap file .It Pa /boot/loader third stage bootstrap .It Pa /boot/kernel/kernel default kernel .It Pa /boot/kernel.old/kernel typical non-default kernel (optional) .El .Sh DIAGNOSTICS When disk-related errors occur, these are reported by the second-stage bootstrap using the same error codes returned by the BIOS, for example .Dq Disk error 0x1 (lba=0x12345678) . Here is a partial list of these error codes: .Pp .Bl -tag -width "0x80" -compact .It 0x1 Invalid argument .It 0x2 Address mark not found .It 0x4 Sector not found .It 0x8 DMA overrun .It 0x9 DMA attempt across 64K boundary .It 0xc Invalid media .It 0x10 Uncorrectable CRC/ECC error .It 0x20 Controller failure .It 0x40 Seek failed .It 0x80 Timeout .El .Pp .Sy "NOTE" : On older machines, or otherwise where EDD support (disk packet interface support) is not available, all boot-related files and structures (including the kernel) that need to be accessed during the boot phase must reside on the disk at or below cylinder 1023 (as the BIOS understands the geometry). When a .Dq Disk error 0x1 is reported by the second-stage bootstrap, it generally means that this requirement has not been adhered to. .Sh SEE ALSO .Xr ddb 4 , .Xr boot.config 5 , .Xr make.conf 5 , .Xr ttys 5 , .Xr boot0cfg 8 , -.Xr bsdlabel 8 , .Xr btxld 8 , .Xr config 8 , +.Xr gpart 8 , .Xr gptboot 8 , .Xr halt 8 , .Xr loader 8 , .Xr nextboot 8 , .Xr reboot 8 , .Xr shutdown 8 , .Xr uefi 8 .Sh BUGS The bsdlabel format used by this version of .Bx is quite different from that of other architectures. .Pp Due to space constraints, the keyboard probe initiated by the .Fl P option is simply a test that the BIOS has detected an .Dq extended keyboard. If an .Dq XT/AT keyboard (with no F11 and F12 keys, etc.) is attached, the probe will fail. Index: head/share/man/man4/da.4 =================================================================== --- head/share/man/man4/da.4 (revision 287395) +++ head/share/man/man4/da.4 (revision 287396) @@ -1,224 +1,223 @@ .\" Copyright (c) 1996 .\" Julian Elischer . All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" $FreeBSD$ .\" .Dd October 22, 2014 .Dt DA 4 .Os .Sh NAME .Nm da .Nd SCSI Direct Access device driver .Sh SYNOPSIS .Cd device da .Sh DESCRIPTION The .Nm driver provides support for all .Tn SCSI devices of the direct access class that are attached to the system through a supported .Tn SCSI Host Adapter. The direct access class includes disk, magneto-optical, and solid-state devices. .Pp A .Tn SCSI Host adapter must also be separately configured into the system before a .Tn SCSI direct access device can be configured. .Sh CACHE EFFECTS Many direct access devices are equipped with read and/or write caches. Parameters affecting the device's cache are stored in mode page 8, the caching control page. Mode pages can be examined and modified via the .Xr camcontrol 8 utility. .Pp The read cache is used to store data from device-initiated read ahead operations as well as frequently used data. The read cache is transparent to the user and can be enabled without any adverse effect. Most devices with a read cache come from the factory with it enabled. The read cache can be disabled by setting the .Tn RCD (Read Cache Disable) bit in the caching control mode page. .Pp The write cache can greatly decrease the latency of write operations and allows the device to reorganize writes to increase efficiency and performance. This performance gain comes at a price. Should the device lose power while its cache contains uncommitted write operations, these writes will be lost. The effect of a loss of write transactions on a file system is non-deterministic and can cause corruption. Most devices age write transactions to limit vulnerability to a few transactions recently reported as complete, but it is none-the-less recommended that systems with write cache enabled devices reside on an Uninterruptible Power Supply (UPS). The .Nm device driver ensures that the cache and media are synchronized upon final close of the device or an unexpected shutdown (panic) event. This ensures that it is safe to disconnect power once the operating system has reported that it has halted. The write cache can be enabled by setting the .Tn WCE (Write Cache Enable) bit in the caching control mode page. .Sh TAGGED QUEUING The .Nm device driver will take full advantage of the SCSI feature known as tagged queueing. Tagged queueing allows the device to process multiple transactions concurrently, often re-ordering them to reduce the number and length of seeks. To ensure that transactions to distant portions of the media, which may be deferred indefinitely by servicing requests nearer the current head position, are completed in a timely fashion, an ordered tagged transaction is sent every 15 seconds during continuous device operation. .Sh BAD BLOCK RECOVERY Direct Access devices have the capability of mapping out portions of defective media. Media recovery parameters are located in mode page 1, the Read-Write Error Recovery mode page. The most important media remapping features are 'Auto Write Reallocation' and 'Auto Read Reallocation' which can be enabled via the AWRE and ARRE bits, respectively, of the Read-Write Error Recovery page. Many devices do not ship from the factory with these feature enabled. Mode pages can be examined and modified via the .Xr camcontrol 8 utility. .Sh KERNEL CONFIGURATION It is only necessary to explicitly configure one .Nm device; data structures are dynamically allocated as disks are found on the .Tn SCSI bus. .Sh SYSCTL VARIABLES The following variables are available as both .Xr sysctl 8 variables and .Xr loader 8 tunables: .Bl -tag -width 12 .It kern.cam.da.retry_count .Pp This variable determines how many times the .Nm driver will retry a READ or WRITE command. This does not affect the number of retries used during probe time or for the .Nm driver dump routine. This value currently defaults to 4. .It kern.cam.da.default_timeout .Pp This variable determines how long the .Nm driver will wait before timing out an outstanding command. The units for this value are seconds, and the default is currently 60 seconds. .It Va kern.cam.sort_io_queue .It Va kern.cam.da. Ns Ar X Ns Va .sort_io_queue .Pp These variables determine whether request queue should be sorted trying to optimize head seeks. Set to 1 to enable sorting, 0 to disable, -1 to leave it as-is. The default is sorting enabled for HDDs and disabled for SSDs. .It kern.cam.da.%d.minimum_cmd_size .Pp This variable determines what the minimum READ/WRITE CDB size is for a given .Nm unit. (The %d above denotes the unit number of the .Nm driver instance, e.g.\& 1, 2, 4, 8, etc.) Valid minimum command size values are 6, 10, 12 and 16 bytes. The default is 6 bytes. .Pp The .Nm driver issues a CAM Path Inquiry CCB at probe time to determine whether the protocol the device in question speaks (e.g.\& ATAPI) typically does not allow 6 byte commands. If it does not, the .Nm driver will default to using at least 10 byte CDBs. If a 6 byte READ or WRITE fails with an ILLEGAL REQUEST error, the .Nm driver will then increase the default CDB size for the device to 10 bytes and retry the command. CDB size is always chosen as the smallest READ/WRITE CDB that will satisfy the specified minimum command size, and the LBA and length of the READ or WRITE in question. (e.g., a write to an LBA larger than 2^32 will require a 16 byte CDB.) .El .Sh NOTES If a device becomes invalidated (media is removed, device becomes unresponsive) the disklabel and information held within the kernel about the device will be invalidated. To avoid corruption of a newly inserted piece of media or a replacement device, all accesses to the device will be discarded until the last file descriptor referencing the old device is closed. During this period, all new open attempts will be rejected. .Sh FILES .Bl -tag -width ".Pa /dev/da*" -compact .It Pa /dev/da* SCSI disk device nodes .El .Sh DIAGNOSTICS None. .Sh SEE ALSO .Xr ada 4 , .Xr cam 4 , .Xr geom 4 , -.Xr bsdlabel 8 , -.Xr fdisk 8 +.Xr gpart 8 .Sh HISTORY The .Nm driver was written for the .Tn CAM .Tn SCSI subsystem by .An Justin T. Gibbs . Many ideas were gleaned from the .Nm sd device driver written and ported from .Tn Mach 2.5 by .An Julian Elischer . Index: head/share/man/man4/md.4 =================================================================== --- head/share/man/man4/md.4 (revision 287395) +++ head/share/man/man4/md.4 (revision 287396) @@ -1,113 +1,112 @@ .\" ---------------------------------------------------------------------------- .\" "THE BEER-WARE LICENSE" (Revision 42): .\" wrote this file. As long as you retain this notice you .\" can do whatever you want with this stuff. If we meet some day, and you think .\" this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp .\" ---------------------------------------------------------------------------- .\" .\" $FreeBSD$ .\" .Dd October 30, 2007 .Dt MD 4 .Os .Sh NAME .Nm md .Nd memory disk .Sh SYNOPSIS .Cd device md .Sh DESCRIPTION The .Nm driver provides support for four kinds of memory backed virtual disks: .Bl -tag -width preload .It Cm malloc Backing store is allocated using .Xr malloc 9 . Only one malloc-bucket is used, which means that all .Nm devices with .Cm malloc backing must share the malloc-per-bucket-quota. The exact size of this quota varies, in particular with the amount of RAM in the system. The exact value can be determined with .Xr vmstat 8 . .It Cm preload A file loaded by .Xr loader 8 with type .Sq md_image is used for backing store. For backwards compatibility the type .Sq mfs_root is also recognized. If the kernel is created with option .Dv MD_ROOT the first preloaded image found will become the root file system. .It Cm vnode A regular file is used as backing store. This allows for mounting ISO images without the tedious detour over actual physical media. .It Cm swap Backing store is allocated from buffer memory. Pages get pushed out to the swap when the system is under memory pressure, otherwise they stay in the operating memory. Using .Cm swap backing is generally preferable over .Cm malloc backing. .El .Pp For more information, please see .Xr mdconfig 8 . .Sh EXAMPLES To create a kernel with a ramdisk or MD file system, your kernel config needs the following options: .Bd -literal -offset indent options MD_ROOT # MD is a potential root device options MD_ROOT_SIZE=8192 # 8MB ram disk makeoptions MFS_IMAGE=/h/foo/ARM-MD options ROOTDEVNAME=\\"ufs:md0\\" .Ed .Pp The image in .Pa /h/foo/ARM-MD will be loaded as the initial image each boot. To create the image to use, please follow the steps to create a file-backed disk found in the .Xr mdconfig 8 man page. Other tools will also create these images, such as NanoBSD. .Sh SEE ALSO -.Xr disklabel 8 , -.Xr fdisk 8 , +.Xr gpart 8 , .Xr loader 8 , .Xr mdconfig 8 , .Xr mdmfs 8 , .Xr newfs 8 , .Xr vmstat 8 .Sh HISTORY The .Nm driver first appeared in .Fx 4.0 as a cleaner replacement for the MFS functionality previously used in .Tn PicoBSD and in the .Fx installation process. .Pp The .Nm driver did a hostile takeover of the .Xr vn 4 driver in .Fx 5.0 . .Sh AUTHORS The .Nm driver was written by .An Poul-Henning Kamp Aq Mt phk@FreeBSD.org . Index: head/share/man/man4/vpo.4 =================================================================== --- head/share/man/man4/vpo.4 (revision 287395) +++ head/share/man/man4/vpo.4 (revision 287396) @@ -1,105 +1,105 @@ .\" Copyright (c) 1998, 1999, Nicolas Souchu .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" $FreeBSD$ .\" .Dd December 14, 2004 .Dt VPO 4 .Os .Sh NAME .Nm vpo .Nd parallel to SCSI interface driver .Sh SYNOPSIS .Cd "device vpo" .Pp For one or more SCSI busses: .Cd "device scbus" .Sh DESCRIPTION The .Nm driver provide access to parallel port Iomega Zip and Jaz drives. .Sh HARDWARE The .Nm driver supports the following parallel to SCSI interfaces: .Pp .Bl -bullet -compact .It Adaptec AIC-7110 Parallel to SCSI interface (built-in to Iomega ZIP drives) .It Iomega Jaz Traveller interface .It Iomega MatchMaker SCSI interface (built-in to Iomega ZIP+ drives) .El .Sh USAGE The driver should let you use a printer connected to the drive while transferring data. .Pp DOS and .Fx file systems are supported. When mounting a DOS file system or formatting a .Fx file system, check the slice of the disk with the -.Xr fdisk 8 +.Xr gpart 8 utility. .Pp In order to unixify a ZIP disk, put the following in /etc/disktab: .Bd -literal zip|zip 100:\\ :ty=removable:se#512:nc#96:nt#64:ns#32:\\ :pa#196608:oa#0:ba#4096:fa#512:\\ :pb#196608:ob#0:bb#4096:fb#512:\\ :pc#196608:oc#0:bc#4096:fc#512: .Ed .Pp and use .Xr bsdlabel 8 . .Pp If you have trouble with your driver, your parallel chipset may not run properly at the detected mode (NIBBLE, PS2 or EPP). Tune the .Xr ppc 4 bootflags to force other modes. .Sh SEE ALSO .Xr da 4 , .Xr lpt 4 , .Xr ppbus 4 , .Xr ppc 4 , .Xr scsi 4 .Sh HISTORY The .Nm manual page first appeared in .Fx 3.0 . .Sh AUTHORS This manual page was written by .An Nicolas Souchu . .Sh BUGS During boot, the driver first tries to detect a classic ZIP, then a ZIP+. The ZIP+ detection is intrusive and may send erroneous characters to your printer if the drive is not connected to your parallel port. Index: head/share/man/man7/tuning.7 =================================================================== --- head/share/man/man7/tuning.7 (revision 287395) +++ head/share/man/man7/tuning.7 (revision 287396) @@ -1,781 +1,781 @@ .\" Copyright (C) 2001 Matthew Dillon. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" $FreeBSD$ .\" .Dd December 8, 2012 .Dt TUNING 7 .Os .Sh NAME .Nm tuning .Nd performance tuning under FreeBSD .Sh SYSTEM SETUP - DISKLABEL, NEWFS, TUNEFS, SWAP The swap partition should typically be approximately 2x the size of main memory for systems with less than 4GB of RAM, or approximately equal to the size of main memory if you have more. Keep in mind future memory expansion when sizing the swap partition. Configuring too little swap can lead to inefficiencies in the VM page scanning code as well as create issues later on if you add more memory to your machine. On larger systems with multiple SCSI disks (or multiple IDE disks operating on different controllers), configure swap on each drive. The swap partitions on the drives should be approximately the same size. The kernel can handle arbitrary sizes but internal data structures scale to 4 times the largest swap partition. Keeping the swap partitions near the same size will allow the kernel to optimally stripe swap space across the N disks. Do not worry about overdoing it a little, swap space is the saving grace of .Ux and even if you do not normally use much swap, it can give you more time to recover from a runaway program before being forced to reboot. .Pp It is not a good idea to make one large partition. First, each partition has different operational characteristics and separating them allows the file system to tune itself to those characteristics. For example, the root and .Pa /usr partitions are read-mostly, with very little writing, while a lot of reading and writing could occur in .Pa /var/tmp . By properly partitioning your system fragmentation introduced in the smaller more heavily write-loaded partitions will not bleed over into the mostly-read partitions. .Pp Properly partitioning your system also allows you to tune .Xr newfs 8 , and .Xr tunefs 8 parameters. The only .Xr tunefs 8 option worthwhile turning on is .Em softupdates with .Dq Li "tunefs -n enable /filesystem" . Softupdates drastically improves meta-data performance, mainly file creation and deletion. We recommend enabling softupdates on most file systems; however, there are two limitations to softupdates that you should be aware of when determining whether to use it on a file system. First, softupdates guarantees file system consistency in the case of a crash but could very easily be several seconds (even a minute!\&) behind on pending write to the physical disk. If you crash you may lose more work than otherwise. Secondly, softupdates delays the freeing of file system blocks. If you have a file system (such as the root file system) which is close to full, doing a major update of it, e.g.,\& .Dq Li "make installworld" , can run it out of space and cause the update to fail. For this reason, softupdates will not be enabled on the root file system during a typical install. There is no loss of performance since the root file system is rarely written to. .Pp A number of run-time .Xr mount 8 options exist that can help you tune the system. The most obvious and most dangerous one is .Cm async . Only use this option in conjunction with .Xr gjournal 8 , as it is far too dangerous on a normal file system. A less dangerous and more useful .Xr mount 8 option is called .Cm noatime . .Ux file systems normally update the last-accessed time of a file or directory whenever it is accessed. This operation is handled in .Fx with a delayed write and normally does not create a burden on the system. However, if your system is accessing a huge number of files on a continuing basis the buffer cache can wind up getting polluted with atime updates, creating a burden on the system. For example, if you are running a heavily loaded web site, or a news server with lots of readers, you might want to consider turning off atime updates on your larger partitions with this .Xr mount 8 option. However, you should not gratuitously turn off atime updates everywhere. For example, the .Pa /var file system customarily holds mailboxes, and atime (in combination with mtime) is used to determine whether a mailbox has new mail. You might as well leave atime turned on for mostly read-only partitions such as .Pa / and .Pa /usr as well. This is especially useful for .Pa / since some system utilities use the atime field for reporting. .Sh STRIPING DISKS In larger systems you can stripe partitions from several drives together to create a much larger overall partition. Striping can also improve the performance of a file system by splitting I/O operations across two or more disks. The .Xr gstripe 8 , .Xr gvinum 8 , and .Xr ccdconfig 8 utilities may be used to create simple striped file systems. Generally speaking, striping smaller partitions such as the root and .Pa /var/tmp , or essentially read-only partitions such as .Pa /usr is a complete waste of time. You should only stripe partitions that require serious I/O performance, typically .Pa /var , /home , or custom partitions used to hold databases and web pages. Choosing the proper stripe size is also important. File systems tend to store meta-data on power-of-2 boundaries and you usually want to reduce seeking rather than increase seeking. This means you want to use a large off-center stripe size such as 1152 sectors so sequential I/O does not seek both disks and so meta-data is distributed across both disks rather than concentrated on a single disk. If you really need to get sophisticated, we recommend using a real hardware RAID controller from the list of .Fx supported controllers. .Sh SYSCTL TUNING .Xr sysctl 8 variables permit system behavior to be monitored and controlled at run-time. Some sysctls simply report on the behavior of the system; others allow the system behavior to be modified; some may be set at boot time using .Xr rc.conf 5 , but most will be set via .Xr sysctl.conf 5 . There are several hundred sysctls in the system, including many that appear to be candidates for tuning but actually are not. In this document we will only cover the ones that have the greatest effect on the system. .Pp The .Va vm.overcommit sysctl defines the overcommit behaviour of the vm subsystem. The virtual memory system always does accounting of the swap space reservation, both total for system and per-user. Corresponding values are available through sysctl .Va vm.swap_total , that gives the total bytes available for swapping, and .Va vm.swap_reserved , that gives number of bytes that may be needed to back all currently allocated anonymous memory. .Pp Setting bit 0 of the .Va vm.overcommit sysctl causes the virtual memory system to return failure to the process when allocation of memory causes .Va vm.swap_reserved to exceed .Va vm.swap_total . Bit 1 of the sysctl enforces .Dv RLIMIT_SWAP limit (see .Xr getrlimit 2 ) . Root is exempt from this limit. Bit 2 allows to count most of the physical memory as allocatable, except wired and free reserved pages (accounted by .Va vm.stats.vm.v_free_target and .Va vm.stats.vm.v_wire_count sysctls, respectively). .Pp The .Va kern.ipc.maxpipekva loader tunable is used to set a hard limit on the amount of kernel address space allocated to mapping of pipe buffers. Use of the mapping allows the kernel to eliminate a copy of the data from writer address space into the kernel, directly copying the content of mapped buffer to the reader. Increasing this value to a higher setting, such as `25165824' might improve performance on systems where space for mapping pipe buffers is quickly exhausted. This exhaustion is not fatal; however, and it will only cause pipes to fall back to using double-copy. .Pp The .Va kern.ipc.shm_use_phys sysctl defaults to 0 (off) and may be set to 0 (off) or 1 (on). Setting this parameter to 1 will cause all System V shared memory segments to be mapped to unpageable physical RAM. This feature only has an effect if you are either (A) mapping small amounts of shared memory across many (hundreds) of processes, or (B) mapping large amounts of shared memory across any number of processes. This feature allows the kernel to remove a great deal of internal memory management page-tracking overhead at the cost of wiring the shared memory into core, making it unswappable. .Pp The .Va vfs.vmiodirenable sysctl defaults to 1 (on). This parameter controls how directories are cached by the system. Most directories are small and use but a single fragment (typically 2K) in the file system and even less (typically 512 bytes) in the buffer cache. However, when operating in the default mode the buffer cache will only cache a fixed number of directories even if you have a huge amount of memory. Turning on this sysctl allows the buffer cache to use the VM Page Cache to cache the directories. The advantage is that all of memory is now available for caching directories. The disadvantage is that the minimum in-core memory used to cache a directory is the physical page size (typically 4K) rather than 512 bytes. We recommend turning this option off in memory-constrained environments; however, when on, it will substantially improve the performance of services that manipulate a large number of files. Such services can include web caches, large mail systems, and news systems. Turning on this option will generally not reduce performance even with the wasted memory but you should experiment to find out. .Pp The .Va vfs.write_behind sysctl defaults to 1 (on). This tells the file system to issue media writes as full clusters are collected, which typically occurs when writing large sequential files. The idea is to avoid saturating the buffer cache with dirty buffers when it would not benefit I/O performance. However, this may stall processes and under certain circumstances you may wish to turn it off. .Pp The .Va vfs.hirunningspace sysctl determines how much outstanding write I/O may be queued to disk controllers system-wide at any given time. It is used by the UFS file system. The default is self-tuned and usually sufficient but on machines with advanced controllers and lots of disks this may be tuned up to match what the controllers buffer. Configuring this setting to match tagged queuing capabilities of controllers or drives with average IO size used in production works best (for example: 16 MiB will use 128 tags with IO requests of 128 KiB). Note that setting too high a value (exceeding the buffer cache's write threshold) can lead to extremely bad clustering performance. Do not set this value arbitrarily high! Higher write queuing values may also add latency to reads occurring at the same time. .Pp The .Va vfs.read_max sysctl governs VFS read-ahead and is expressed as the number of blocks to pre-read if the heuristics algorithm decides that the reads are issued sequentially. It is used by the UFS, ext2fs and msdosfs file systems. With the default UFS block size of 32 KiB, a setting of 64 will allow speculatively reading up to 2 MiB. This setting may be increased to get around disk I/O latencies, especially where these latencies are large such as in virtual machine emulated environments. It may be tuned down in specific cases where the I/O load is such that read-ahead adversely affects performance or where system memory is really low. .Pp The .Va vfs.ncsizefactor sysctl defines how large VFS namecache may grow. The number of currently allocated entries in namecache is provided by .Va debug.numcache sysctl and the condition debug.numcache < kern.maxvnodes * vfs.ncsizefactor is adhered to. .Pp The .Va vfs.ncnegfactor sysctl defines how many negative entries VFS namecache is allowed to create. The number of currently allocated negative entries is provided by .Va debug.numneg sysctl and the condition vfs.ncnegfactor * debug.numneg < debug.numcache is adhered to. .Pp There are various other buffer-cache and VM page cache related sysctls. We do not recommend modifying these values. As of .Fx 4.3 , the VM system does an extremely good job tuning itself. .Pp The .Va net.inet.tcp.sendspace and .Va net.inet.tcp.recvspace sysctls are of particular interest if you are running network intensive applications. They control the amount of send and receive buffer space allowed for any given TCP connection. The default sending buffer is 32K; the default receiving buffer is 64K. You can often improve bandwidth utilization by increasing the default at the cost of eating up more kernel memory for each connection. We do not recommend increasing the defaults if you are serving hundreds or thousands of simultaneous connections because it is possible to quickly run the system out of memory due to stalled connections building up. But if you need high bandwidth over a fewer number of connections, especially if you have gigabit Ethernet, increasing these defaults can make a huge difference. You can adjust the buffer size for incoming and outgoing data separately. For example, if your machine is primarily doing web serving you may want to decrease the recvspace in order to be able to increase the sendspace without eating too much kernel memory. Note that the routing table (see .Xr route 8 ) can be used to introduce route-specific send and receive buffer size defaults. .Pp As an additional management tool you can use pipes in your firewall rules (see .Xr ipfw 8 ) to limit the bandwidth going to or from particular IP blocks or ports. For example, if you have a T1 you might want to limit your web traffic to 70% of the T1's bandwidth in order to leave the remainder available for mail and interactive use. Normally a heavily loaded web server will not introduce significant latencies into other services even if the network link is maxed out, but enforcing a limit can smooth things out and lead to longer term stability. Many people also enforce artificial bandwidth limitations in order to ensure that they are not charged for using too much bandwidth. .Pp Setting the send or receive TCP buffer to values larger than 65535 will result in a marginal performance improvement unless both hosts support the window scaling extension of the TCP protocol, which is controlled by the .Va net.inet.tcp.rfc1323 sysctl. These extensions should be enabled and the TCP buffer size should be set to a value larger than 65536 in order to obtain good performance from certain types of network links; specifically, gigabit WAN links and high-latency satellite links. RFC1323 support is enabled by default. .Pp The .Va net.inet.tcp.always_keepalive sysctl determines whether or not the TCP implementation should attempt to detect dead TCP connections by intermittently delivering .Dq keepalives on the connection. By default, this is enabled for all applications; by setting this sysctl to 0, only applications that specifically request keepalives will use them. In most environments, TCP keepalives will improve the management of system state by expiring dead TCP connections, particularly for systems serving dialup users who may not always terminate individual TCP connections before disconnecting from the network. However, in some environments, temporary network outages may be incorrectly identified as dead sessions, resulting in unexpectedly terminated TCP connections. In such environments, setting the sysctl to 0 may reduce the occurrence of TCP session disconnections. .Pp The .Va net.inet.tcp.delayed_ack TCP feature is largely misunderstood. Historically speaking, this feature was designed to allow the acknowledgement to transmitted data to be returned along with the response. For example, when you type over a remote shell, the acknowledgement to the character you send can be returned along with the data representing the echo of the character. With delayed acks turned off, the acknowledgement may be sent in its own packet, before the remote service has a chance to echo the data it just received. This same concept also applies to any interactive protocol (e.g.,\& SMTP, WWW, POP3), and can cut the number of tiny packets flowing across the network in half. The .Fx delayed ACK implementation also follows the TCP protocol rule that at least every other packet be acknowledged even if the standard 100ms timeout has not yet passed. Normally the worst a delayed ACK can do is slightly delay the teardown of a connection, or slightly delay the ramp-up of a slow-start TCP connection. While we are not sure we believe that the several FAQs related to packages such as SAMBA and SQUID which advise turning off delayed acks may be referring to the slow-start issue. In .Fx , it would be more beneficial to increase the slow-start flightsize via the .Va net.inet.tcp.slowstart_flightsize sysctl rather than disable delayed acks. .Pp The .Va net.inet.ip.portrange.* sysctls control the port number ranges automatically bound to TCP and UDP sockets. There are three ranges: a low range, a default range, and a high range, selectable via the .Dv IP_PORTRANGE .Xr setsockopt 2 call. Most network programs use the default range which is controlled by .Va net.inet.ip.portrange.first and .Va net.inet.ip.portrange.last , which default to 49152 and 65535, respectively. Bound port ranges are used for outgoing connections, and it is possible to run the system out of ports under certain circumstances. This most commonly occurs when you are running a heavily loaded web proxy. The port range is not an issue when running a server which handles mainly incoming connections, such as a normal web server, or has a limited number of outgoing connections, such as a mail relay. For situations where you may run out of ports, we recommend decreasing .Va net.inet.ip.portrange.first modestly. A range of 10000 to 30000 ports may be reasonable. You should also consider firewall effects when changing the port range. Some firewalls may block large ranges of ports (usually low-numbered ports) and expect systems to use higher ranges of ports for outgoing connections. By default .Va net.inet.ip.portrange.last is set at the maximum allowable port number. .Pp The .Va kern.ipc.somaxconn sysctl limits the size of the listen queue for accepting new TCP connections. The default value of 128 is typically too low for robust handling of new connections in a heavily loaded web server environment. For such environments, we recommend increasing this value to 1024 or higher. The service daemon may itself limit the listen queue size (e.g.,\& .Xr sendmail 8 , apache) but will often have a directive in its configuration file to adjust the queue size up. Larger listen queues also do a better job of fending off denial of service attacks. .Pp The .Va kern.maxfiles sysctl determines how many open files the system supports. The default is typically a few thousand but you may need to bump this up to ten or twenty thousand if you are running databases or large descriptor-heavy daemons. The read-only .Va kern.openfiles sysctl may be interrogated to determine the current number of open files on the system. .Pp The .Va vm.swap_idle_enabled sysctl is useful in large multi-user systems where you have lots of users entering and leaving the system and lots of idle processes. Such systems tend to generate a great deal of continuous pressure on free memory reserves. Turning this feature on and adjusting the swapout hysteresis (in idle seconds) via .Va vm.swap_idle_threshold1 and .Va vm.swap_idle_threshold2 allows you to depress the priority of pages associated with idle processes more quickly then the normal pageout algorithm. This gives a helping hand to the pageout daemon. Do not turn this option on unless you need it, because the tradeoff you are making is to essentially pre-page memory sooner rather than later, eating more swap and disk bandwidth. In a small system this option will have a detrimental effect but in a large system that is already doing moderate paging this option allows the VM system to stage whole processes into and out of memory more easily. .Sh LOADER TUNABLES Some aspects of the system behavior may not be tunable at runtime because memory allocations they perform must occur early in the boot process. To change loader tunables, you must set their values in .Xr loader.conf 5 and reboot the system. .Pp .Va kern.maxusers controls the scaling of a number of static system tables, including defaults for the maximum number of open files, sizing of network memory resources, etc. As of .Fx 4.5 , .Va kern.maxusers is automatically sized at boot based on the amount of memory available in the system, and may be determined at run-time by inspecting the value of the read-only .Va kern.maxusers sysctl. Some sites will require larger or smaller values of .Va kern.maxusers and may set it as a loader tunable; values of 64, 128, and 256 are not uncommon. We do not recommend going above 256 unless you need a huge number of file descriptors; many of the tunable values set to their defaults by .Va kern.maxusers may be individually overridden at boot-time or run-time as described elsewhere in this document. Systems older than .Fx 4.4 must set this value via the kernel .Xr config 8 option .Cd maxusers instead. .Pp The .Va kern.dfldsiz and .Va kern.dflssiz tunables set the default soft limits for process data and stack size respectively. Processes may increase these up to the hard limits by calling .Xr setrlimit 2 . The .Va kern.maxdsiz , .Va kern.maxssiz , and .Va kern.maxtsiz tunables set the hard limits for process data, stack, and text size respectively; processes may not exceed these limits. The .Va kern.sgrowsiz tunable controls how much the stack segment will grow when a process needs to allocate more stack. .Pp .Va kern.ipc.nmbclusters may be adjusted to increase the number of network mbufs the system is willing to allocate. Each cluster represents approximately 2K of memory, so a value of 1024 represents 2M of kernel memory reserved for network buffers. You can do a simple calculation to figure out how many you need. If you have a web server which maxes out at 1000 simultaneous connections, and each connection eats a 16K receive and 16K send buffer, you need approximately 32MB worth of network buffers to deal with it. A good rule of thumb is to multiply by 2, so 32MBx2 = 64MB/2K = 32768. So for this case you would want to set .Va kern.ipc.nmbclusters to 32768. We recommend values between 1024 and 4096 for machines with moderates amount of memory, and between 4096 and 32768 for machines with greater amounts of memory. Under no circumstances should you specify an arbitrarily high value for this parameter, it could lead to a boot-time crash. The .Fl m option to .Xr netstat 1 may be used to observe network cluster use. Older versions of .Fx do not have this tunable and require that the kernel .Xr config 8 option .Dv NMBCLUSTERS be set instead. .Pp More and more programs are using the .Xr sendfile 2 system call to transmit files over the network. The .Va kern.ipc.nsfbufs sysctl controls the number of file system buffers .Xr sendfile 2 is allowed to use to perform its work. This parameter nominally scales with .Va kern.maxusers so you should not need to modify this parameter except under extreme circumstances. See the .Sx TUNING section in the .Xr sendfile 2 manual page for details. .Sh KERNEL CONFIG TUNING There are a number of kernel options that you may have to fiddle with in a large-scale system. In order to change these options you need to be able to compile a new kernel from source. The .Xr config 8 manual page and the handbook are good starting points for learning how to do this. Generally the first thing you do when creating your own custom kernel is to strip out all the drivers and services you do not use. Removing things like .Dv INET6 and drivers you do not have will reduce the size of your kernel, sometimes by a megabyte or more, leaving more memory available for applications. .Pp .Dv SCSI_DELAY may be used to reduce system boot times. The defaults are fairly high and can be responsible for 5+ seconds of delay in the boot process. Reducing .Dv SCSI_DELAY to something below 5 seconds could work (especially with modern drives). .Pp There are a number of .Dv *_CPU options that can be commented out. If you only want the kernel to run on a Pentium class CPU, you can easily remove .Dv I486_CPU , but only remove .Dv I586_CPU if you are sure your CPU is being recognized as a Pentium II or better. Some clones may be recognized as a Pentium or even a 486 and not be able to boot without those options. If it works, great! The operating system will be able to better use higher-end CPU features for MMU, task switching, timebase, and even device operations. Additionally, higher-end CPUs support 4MB MMU pages, which the kernel uses to map the kernel itself into memory, increasing its efficiency under heavy syscall loads. .Sh CPU, MEMORY, DISK, NETWORK The type of tuning you do depends heavily on where your system begins to bottleneck as load increases. If your system runs out of CPU (idle times are perpetually 0%) then you need to consider upgrading the CPU or perhaps you need to revisit the programs that are causing the load and try to optimize them. If your system is paging to swap a lot you need to consider adding more memory. If your system is saturating the disk you typically see high CPU idle times and total disk saturation. .Xr systat 1 can be used to monitor this. There are many solutions to saturated disks: increasing memory for caching, mirroring disks, distributing operations across several machines, and so forth. If disk performance is an issue and you are using IDE drives, switching to SCSI can help a great deal. While modern IDE drives compare with SCSI in raw sequential bandwidth, the moment you start seeking around the disk SCSI drives usually win. .Pp Finally, you might run out of network suds. Optimize the network path as much as possible. For example, in .Xr firewall 7 we describe a firewall protecting internal hosts with a topology where the externally visible hosts are not routed through it. Use 1000BaseT rather than 100BaseT, depending on your needs. Most bottlenecks occur at the WAN link (e.g.,\& modem, T1, DSL, whatever). If expanding the link is not an option it may be possible to use the .Xr dummynet 4 feature to implement peak shaving or other forms of traffic shaping to prevent the overloaded service (such as web services) from affecting other services (such as email), or vice versa. In home installations this could be used to give interactive traffic (your browser, .Xr ssh 1 logins) priority over services you export from your box (web services, email). .Sh SEE ALSO .Xr netstat 1 , .Xr systat 1 , .Xr sendfile 2 , .Xr ata 4 , .Xr dummynet 4 , .Xr login.conf 5 , .Xr rc.conf 5 , .Xr sysctl.conf 5 , .Xr eventtimers 7 , .Xr firewall 7 , .Xr hier 7 , .Xr ports 7 , .Xr boot 8 , .Xr bsdinstall 8 , -.Xr bsdlabel 8 , .Xr ccdconfig 8 , .Xr config 8 , .Xr fsck 8 , +.Xr gpart 8 , .Xr gjournal 8 , .Xr gstripe 8 , .Xr gvinum 8 , .Xr ifconfig 8 , .Xr ipfw 8 , .Xr loader 8 , .Xr mount 8 , .Xr newfs 8 , .Xr route 8 , .Xr sysctl 8 , .Xr tunefs 8 .Sh HISTORY The .Nm manual page was originally written by .An Matthew Dillon and first appeared in .Fx 4.3 , May 2001. The manual page was greatly modified by .An Eitan Adler Aq Mt eadler@FreeBSD.org . Index: head/share/man/man8/picobsd.8 =================================================================== --- head/share/man/man8/picobsd.8 (revision 287395) +++ head/share/man/man8/picobsd.8 (revision 287396) @@ -1,662 +1,662 @@ .\" -*- nroff-fill -*- .\" $FreeBSD$ .Dd October 1, 2013 .Dt PICOBSD 8 .Os .Sh NAME .Nm picobsd .Nd building small FreeBSD disk images .Sh SYNOPSIS .Nm .Op Ar options .Op Ar config-name Op Ar site-name .Sh DESCRIPTION The .Nm utility is a script which produces a minimal implementation of .Fx (historically called .Nm PicoBSD ) which typically fits on a small media such as a floppy disk, or can be downloaded as a single image file from some media such as CDROM, flash memory, or through etherboot. .Pp The .Nm utility was originally created to build simple standalone systems such as firewalls or bridges, but because of the ability to cross-build images with different source trees than the one in the server, it can be extremely useful to developers to test their code without having to reinstall the system. .Pp The boot media (historically a floppy disk, but also small CDROM or USB keys) contains a boot loader and a compressed kernel which includes a memory file system. Depending on the media, it might also contain a number of additional files, which can be updated at run time, and are used to override/update those in the memory file system. .Pp The system loads the kernel in the normal way, uncompresses the memory file system and mounts it as root. It then updates the memory file system with files from the boot media (if present), and executes a specialized version of .Pa /etc/rc . The boot media (floppy, etc.) is required for loading only, and typically used read-only. After the boot phase, the system runs entirely from RAM. .Pp The following options are available (but also check the .Nm script for more details). The most important options for common operations are .Fl src , .Fl init , .Fl n and .Fl v . .Bl -tag -width indent .\" .It Fl -all_in_mfs Put the entire contents of the file system in the memory file system image which is contained in the kernel. This is the default behaviour, and is extremely useful as the kernel itself can be loaded, using etherboot or .Xr pxeboot 8 , .\" .It Fl c , Fl clean Clean the product of previous builds. .\" .It Fl -cfg Ar file Specify a file that contains additional config commands. .\" .It Fl -floppy_size Ar size Set the size of the disk image. Typical values for a floppy disk are 1440 or 2880, but other values can be used for other media (flash memories, CDROM, network booted kernels). Note that this option is overridden by the content of the config files (config in the image tree, or the one specified with .Fl Fl cfg ) .\" .It Fl -init When used together with the .Fl -src option, this initializes the .Ao Ar SRC_PATH Ac Ns Pa /../usr subtree as necessary to subsequently build .Nm images. .\" .It Fl -iso Generate an ISO image, .Pa picobsd.iso , in addition to the disk image .Pa picobsd.bin . .\" .It Fl -modules Also build kernel modules. These are not stored on the .Nm image but are left available in the build directory. .\" .It Fl n Make the script non-interactive, skipping the initial menu and proceeding with the build process without requiring user input. .\" .It Fl -no_all_in_mfs Leaves files contained in the .Pa floppy.tree on the .Nm image, so they can be loaded separately from the kernel (and updated individually to customize the image). .\" .It Fl -no_loader Omit /boot/loader, just rely on boot2 to load the kernel. This saves some space but may have problems with kernels > 4MB. .\" .It Fl -objdir Ar directory Specify a directory with the result of a previous buildworld. This saves the need for an .Fl Fl init call before creating an image. .\" .It Fl -src Ar SRC_PATH Use the source tree at .Ar SRC_PATH instead the one at .Pa /usr/src . This can be useful for cross-building .Nm images. When using this option, you must also create and initialize the subtree at .Ao Ar SRC_PATH Ac Ns Pa /../usr with the correct header files, libraries, and tools (such as the .Xr config 8 program) that are necessary for the cross-build (see the .Fl -init option). The source files are unmodified by the .Nm script. However the source tree is not completely read-only, because .Xr config 8 expects the kernel configuration file to be in one of its subdirectories, and also the process of initializing the .Pa usr subtree touches some parts of the source tree (this is a bug in the release build scripts which might go away with time). .\" .It Fl v Make the script verbose, showing commands to be executed and waiting for user input before executing each of them. Useful for debugging. as a fully functional system. .El .Sh ENVIRONMENT As a result of extreme size limitations, the .Nm environment differs from the normal .Fx in a number of ways: .Bl -bullet .It There are no dynamic libraries, and there is no directory .Pa /usr/lib . As a result, only static executables may be executed. .It In order to reduce the size of the executables, all executables on a specific floppy are joined together as a single executable built with .Xr crunchgen 1 . .It Some programs are supplied in minimalistic versions, specifically .Nm ns , a cut-down version of .Xr netstat 1 , and .Nm vm , a cut-down version of .Xr vmstat 8 . .El .Sh BUILDING PicoBSD The .Nm sources reside in the hierarchy .Pa /usr/src/release/picobsd . In the following discussion, all relative path names are relative to this directory. .Pp The supported build script is .Pa /usr/src/release/picobsd/build/picobsd which can be run from anywhere, and relies on the .Xr sysutils/makefs port to build a filesystem without requiring .Xr mdconfig or root privileges to mount a filesystem. When run in interactive mode (the default without the .Fl n option), the script will let you configure the various parameters used to build the PicoBSD image. An image is configured using the files and directories described below. The base system contains a template, called .Pa bridge for historical reasons, that can be used as a base for building various kinds of network appliances. .Pp You can define your own PicoBSD configuration, by creating a directory with a name of your choice (e.g.\& .Pa FOO ) which contains some of the following files and directories. For more information on how to construct these files, look at one of the standard .Nm configurations as a reference. .Bl -tag -width indent .It Pa PICOBSD The kernel configuration file (required). This is a mostly standard kernel configuration file, possibly stripped down by removing unnecessary drivers and options to reduce the kernel's size. .Pp To be recognised as a .Nm kernel config file, the file must also contain the line beginning with .Dq Li #PicoBSD below, and a matching .Dv MD_ROOT_SIZE option: .Bd -literal -offset indent #marker def_sz init MFS_inodes floppy_inodes #PicoBSD 4200 init 8192 32768 options MD_ROOT_SIZE=4200 # same as def_sz .Ed .Pp This informs the script of the size of the memory file system and provides a few other details on how to build the image. .It Pa crunch.conf .Xr crunchgen 1 configuration (required). It contains the list of directories containing program sources, the list of binaries to be built, and the list of libraries that these programs use. See the .Xr crunchgen 1 manpage for the exact details on the syntax of this file. .Pp The following issues are particularly important when dealing with .Nm configurations: .Bl -bullet .It We can pass build options to those makefiles which understand that, in order to reduce the size of the programs. This is achieved with a line of the form .Pp .Dl "buildopts -DNO_PAM -DRELEASE_CRUNCH ..." .It When providing the list of directories where source files are, it is convenient to list the following entry first: .Pp .Dl "srcdirs /usr/src/release/picobsd/tinyware" .Pp so that .Nm Ns -specific versions of the programs will be found there. .It The string .Dq Li @__CWD__@ is replaced with the full pathname of the directory where the .Nm configuration resides (i.e., the one where we find .Pa PICOBSD , crunch.conf , and so on). This can be useful to refer source code that resides within a configuration, e.g.\& .Pp .Dl "srcdirs @__CWD__@/src" .El .It Pa config Shell variables, sourced by the .Nm script (optional). The most important variables here are: .Bl -tag -width ".Va MY_DEVS" .It Va MY_DEVS (Not used in .Fx 5.0 where we have .Xr devfs 5 ) . Should be set to the list of devices to be created in the .Pa /dev directory of the image (it is really the argument passed to .Xr MAKEDEV 8 , so refer to that manpage for the names). .It Va fd_size Size (in kilobytes) of the .Nm image. By default, .Va fd_size is set to 1440 which produces an image suitable for a standard floppy. .Pp If you plan to store the image on a CDROM (e.g.\& using the .Dq "El Torito" floppy emulation), you can set .Va fd_size equal to 2880. If you are planning to dump the image onto a hard disk (either in a partition or on the whole disk), you are not restricted to one of the standard floppy sizes. Using a large image size per se does not waste RAM at runtime, because only the files that are actually loaded from the image contribute to the memory usage. .It Va import_files Contains a list of files to be imported in the floppy tree. Absolute names refer to the standard file system, relative names refer to the root of the source tree being used (i.e.\& .Va SRC_PATH/.. ) . You can normally use this option if you want to import files such as shared libraries, or databases, without having to replicate them first in your configuration under the .Pa floppy.tree/ directory. .El .It Pa floppy.tree.exclude List of files from the standard floppy tree which we do not want to be copied (optional). .It Pa floppy.tree/ Local additions to the standard floppy tree (optional). The content of this subtree will be copied as-is into the floppy image. .It Pa floppy.tree. Ns Aq Ar site-name Same as above, but site-specific (optional). .El .Pp More information on the build process can be found in the comments in the .Nm script. .Sh USING ALTERNATE SOURCE TREES The build script can be instructed to use an alternate source tree using the .Fl -src Ar SRC_PATH option. The tree that you specify must contain full sources for the kernel and for all programs that you want to include in your image. As an example, to cross-build the .Pa bridge floppy using RELENG_4 sources, you can do the following: .Bd -literal -offset indent cd mkdir FOO (cd FOO; cvs -d co -rRELENG_4 src) picobsd --src FOO/src --init # this is needed only once picobsd --src FOO/src -n -v bridge .Ed .Pp If the build is successful, the directory .Pa build_dir-bridge/ will contain a .Pa kernel that can be downloaded with etherboot, a floppy image called .Pa picobsd.bin , plus the products of the compilation in other directories. If you want to modify the source tree in .Pa FOO/src , a new image can be produced by simply running .Pp .Dl "picobsd --src FOO/src -n -v bridge" .Pp whereas if the change affects include files or libraries you first need to update them, e.g.\& by re-running .Pp .Dl "picobsd --src FOO/src --init # this is needed only once" .Pp as you would normally do for any change of this kind. .Sh INSTALLING PicoBSD .Ss Floppy Install Historically, .Nm is run from a floppy disk, where it can be installed with a simple .Pp .Dl "dd if=picobsd.bin of=/dev/rfd0" .Pp and the floppy is ready to boot. .Ss Hard Disk Install The same process can be used to store the image on a hard disk (entire volume or one of the slices): .Bd -literal -offset indent dd if=picobsd.bin of=/dev/ada2 dd if=picobsd.bin of=/dev/ada2s3 dd if=picobsd.bin of=/dev/ada2 oseek=NN .Ed .Pp The first form will install the image on the entire disk, and it should work in the same way as for a floppy. .Pp The second form will install the image on slice number 3 (which should be large enough to store the contents of the image). However, the process will only have success if the partition does not contain a valid disklabel, otherwise the kernel will likely prevent overwriting the label. In this case you can use the third form, replacing .Ar NN with the actual start of the partition (which you can determine using -.Xr fdisk 8 ) . +.Xr gpart 8 ) . Note that after saving the image to the slice, it will not yet be recognised. You have to use the .Xr disklabel 8 command to properly initialize the label (do not ask why!). One way to do this is .Bd -literal -offset indent disklabel -w ada0s2 auto disklabel -e ada0s2 .Ed .Pp and from the editor enter a line corresponding to the actual partition, e.g.\& if the image has 2.88MB (5760 sectors) you need to enter the following line for the partition: .Pp .Dl "a: 5760 0 4.2BSD 512 4096" .Pp At this point the partition is bootable. Note that the image size can be smaller than the slice size (indicated as partition .Dq Li c: ) . .Ss CDROM Install .Nm can produce an ISO image named picobsd.iso, which does not use .Dq "El Torito" emulation, so it has no size restrictions. Installing means just burning a media with the file. .Ss Booting From The Network Yet another way to use .Nm is to boot the image off the network. For this purpose you should use the uncompressed kernel which is available as a byproduct of the compilation. Refer to the documentation for network booting for more details, the .Nm kernel is bootable as a standard .Fx kernel. .Sh BOOTING PicoBSD To boot .Nm , insert the floppy and reset the machine. The boot procedure is similar to the standard .Fx boot. Booting from a floppy is normally rather slow (in the order of 1-2 minutes), things are much faster if you store your image on a hard disk, Compact Flash, or CDROM. .Pp You can also use etherboot to load the preloaded, uncompressed kernel image which is a byproduct of the .Nm build. In this case the load time is a matter of a few seconds, even on a 10Mbit/s ethernet. .Pp After booting, .Nm loads the root file system from the memory file system, starts .Pa /sbin/init , and passes control to a first startup script, .Pa /etc/rc . The latter populates the .Pa /etc and .Pa /root directories with the default files, then tries to identify the boot device (floppy, hard disk partition) and possibly override the contents of the root file system with files read from the boot device. This allows you to store local configuration on the same media. After this phase the boot device is no longer used, unless the user specifically does it. .Pp After this, control is transferred to a second script, .Pa /etc/rc1 (which can be overridden from the boot device). This script tries to associate a hostname to the system by using the MAC address of the first ethernet interface as a key, and .Pa /etc/hosts as a lookup table. Then control is passed to the main user configuration script, .Pa /etc/rc.conf , which is supposed to override the value of a number of configuration variables which have been pre-set in .Pa /etc/rc.conf.defaults . You can use the .Va hostname variable to create different configurations from the same file. After taking control back, .Pa /etc/rc1 completes the initializations, and as part of this it configures network interfaces and optionally calls the firewall configuration script, .Pa /etc/rc.firewall , where the user can store his own firewall configuration. .Pp Note that by default .Nm runs entirely from main memory, and has no swap space, unless you explicitly request it. The boot device is also not used anymore after .Pa /etc/rc1 takes control, again, unless you explicitly request it. .Sh CONFIGURING a PicoBSD system The operation of a .Nm system can be configured through a few files which are read at boot time, very much like a standard .Fx system. There are, however, some minor differences to reduce the number of files to store and/or customize, thus saving space. Among the files to configure we have the following: .Bl -tag -width indent .It Pa /etc/hosts Traditionally, this file contains the IP-to-hostname mappings. In addition to this, the .Nm version of this file also contains a mapping between Ethernet (MAC) addresses and hostnames, as follows: .Bd -literal -offset indent #ethertable start of the ethernet->hostname mapping # mac_address hostname # 00:12:34:56:78:9a pinco # 12:34:56:* pallino # * this-matches-all .Ed .Pp where the line containing .Dq Li #ethertable marks the start of the table. .Pp If the MAC address is not found, the script will prompt you to enter a hostname and IP address for the system, and this information will be stored in the .Pa /etc/hosts file (in memory) so you can simply store them on disk later. .Pp Note that you can use wildcards in the address part, so a line like the last one in the example will match any MAC address and avoid the request. .It Pa /etc/rc.conf This file contains a number of variables which control the operation of the system, such as interface configuration, router setup, network service startup, etc. For the exact list and meaning of these variables see .Pa /etc/rc.conf.defaults . .Pp It is worth mentioning that some of the variables let you overwrite the contents of some files in .Pa /etc . This option is available at the moment for .Pa /etc/host.conf and .Pa /etc/resolv.conf , whose contents are generally very short and suitable for this type of updating. In case you use these variables, remember to use newlines as appropriate, e.g.\& .Bd -literal -offset indent host_conf="# this goes into /etc/host.conf hosts bind" .Ed .Pp Although not mandatory, in this file you should only set the variables indicated in .Pa /etc/rc.conf.defaults , and avoid starting services which depend on having the network running. This can be done at a later time: if you set .Va firewall_enable Ns = Ns Qq Li YES , the .Pa /etc/rc.firewall script will be run after configuring the network interfaces, so you can set up your firewall and safely start network services or enable things such as routing and bridging. .It Pa /etc/rc.firewall This script can be used to configure the .Xr ipfw 4 firewall. On entry, the .Va fwcmd variable is set to the pathname of the firewall command, .Va firewall_type contains the value set in .Pa /etc/rc.conf , and .Va hostname contains the name assigned to the host. .El .Pp There is a small script called .Nm update which can be used to edit and/or save to disk a copy of the files you have modified after booting. The script takes one or more absolute pathnames, runs the editor on the files passed as arguments, and then saves a compressed copy of the files on the disk (mounting and unmounting the latter around the operation). .Pp If invoked without arguments, .Nm update edits and saves .Pa rc.conf , rc.firewall , and .Pa master.passwd . .Pp If one of the arguments is .Pa /etc (the directory name alone), then the command saves to disk (without editing) all the files in the directory for which a copy already exists on disk (e.g.\& as a result of a previous update). .Sh SEE ALSO .Xr crunchgen 1 , .Xr mdconfig 8 , .Xr nanobsd 8 , .Xr swapon 8 .Sh AUTHORS .An -nosplit .An Andrzej Bialecki Aq Mt abial@FreeBSD.org , with subsequent work on the scripts by .An Luigi Rizzo Aq Mt luigi@iet.unipi.it and others. Man page and .Pa Makefiles created by .An Greg Lehey Aq Mt grog@lemis.com . .Sh BUGS Documentation is still incomplete. Index: head/usr.sbin/boot0cfg/boot0cfg.8 =================================================================== --- head/usr.sbin/boot0cfg/boot0cfg.8 (revision 287395) +++ head/usr.sbin/boot0cfg/boot0cfg.8 (revision 287396) @@ -1,205 +1,204 @@ .\" Copyright (c) 1999 Robert Nordier .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, .\" OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT .\" OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR .\" BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, .\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE .\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, .\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" .\" $FreeBSD$ .\" .Dd October 1, 2013 .Dt BOOT0CFG 8 .Os .Sh NAME .Nm boot0cfg .Nd boot manager installation/configuration utility .Sh SYNOPSIS .Nm .Op Fl Bv .Op Fl b Ar boot0 .Op Fl d Ar drive .Op Fl e Ar bell character .Op Fl f Ar file .Op Fl i Ar volume-id .Op Fl m Ar mask .Op Fl o Ar options .Op Fl s Ar slice .Op Fl t Ar ticks .Ar disk .Sh DESCRIPTION The .Fx .Sq boot0 boot manager permits the operator to select from which disk and slice an i386 machine (PC) is booted. .Pp Note that what are referred to here as .Dq slices are typically called .Dq partitions in .No non- Ns Bx documentation relating to the PC. Typically, only non-removable disks are sliced. .Pp The .Nm utility optionally installs the .Sq boot0 boot manager on the specified .Ar disk ; and allows various operational parameters to be configured. .Pp On PCs, a boot manager typically occupies sector 0 of a disk, which is known as the Master Boot Record (MBR). The MBR contains both code (to which control is passed by the PC BIOS) and data (an embedded table of defined slices). .Pp The options are: .Bl -tag -width indent .It Fl B Install the .Sq boot0 boot manager. This option causes MBR code to be replaced, without affecting the embedded slice table. .It Fl b Ar boot0 Specify which .Sq boot0 image to use. The default is .Pa /boot/boot0 which will use the video card as output, alternatively .Pa /boot/boot0sio can be used for output to the COM1 port. (Be aware that nothing will be output to the COM1 port unless the modem signals DSR and CTS are active.) .It Fl d Ar drive Specify the drive number used by the PC BIOS in referencing the drive which contains the specified .Ar disk . Typically this will be 0x80 for the first hard drive, 0x81 for the second hard drive, and so on; however any integer between 0 and 0xff is acceptable here. .It Fl e Ar bell character Set the character to be printed in case of input error. .It Fl f Ar file Specify that a backup copy of the preexisting MBR should be written to .Ar file . This file is created if it does not exist, and replaced if it does. .It Fl i Ar volume-id Specifies a volume-id (in the form XXXX-XXXX) to be saved at location 0x1b8 in the MBR. This information is sometimes used by NT, XP and Vista to identify the disk drive. The option is only compatible with version 2.00 of the 512-byte boot block. .It Fl m Ar mask Specify slices to be enabled/disabled, where .Ar mask is an integer between 0 (no slices enabled) and 0xf (all four slices enabled). Each mask bit enables corresponding slice if set to 1. The least significant bit of the mask corresponds to slice 1, the most significant bit of the mask corresponds to slice 4. .It Fl o Ar options A comma-separated string of any of the following options may be specified (with .Dq no prepended as necessary): .Bl -tag -width indent .It packet Use the disk packet (BIOS INT 0x13 extensions) interface, as opposed to the legacy (CHS) interface, when doing disk I/O. This allows booting above cylinder 1023, but requires specific BIOS support. The default is .Sq packet . .It setdrv Forces the drive containing the disk to be referenced using drive number definable by means of the -d option. The default is .Sq nosetdrv . .It update Allow the MBR to be updated by the boot manager. (The MBR may be updated to flag slices as .Sq active , and to save slice selection information.) This is the default; a .Sq noupdate option causes the MBR to be treated as read-only. .El .It Fl s Ar slice Set the default boot selection to .Ar slice . Values between 1 and 4 refer to slices; a value of 5 refers to the option of booting from a second disk. The special string .Dq PXE or a value of 6 can be used to boot via PXE. .It Fl t Ar ticks Set the timeout value to .Ar ticks . (There are approximately 18.2 ticks per second.) .It Fl v Verbose: display information about the slices defined, etc. .El .Sh FILES .Bl -tag -width /boot/boot0sio -compact .It Pa /boot/boot0 The default .Sq boot0 image .It Pa /boot/boot0sio Image for serial consoles (COM1,9600,8,N,1,MODEM) .El .Sh EXIT STATUS .Ex -std .Sh EXAMPLES To boot slice 2 on the next boot: .Pp .Dl "boot0cfg -s 2 ada0" .Pp To enable just slices 1 and 3 in the menu: .Pp .Dl "boot0cfg -m 0x5 ada0" .Pp To go back to non-interactive booting, use -.Xr fdisk 8 +.Xr gpart 8 to install the default MBR: .Pp -.Dl "fdisk -B ada0" +.Dl "gpart bootcode -b /boot/mbr ada0" .Sh SEE ALSO .Xr geom 4 , .Xr boot 8 , -.Xr fdisk 8 , .Xr gpart 8 .Sh AUTHORS .An Robert Nordier Aq Mt rnordier@FreeBSD.org .Sh BUGS Use of the .Sq packet option may cause .Sq boot0 to fail, depending on the nature of BIOS support. .Pp Use of the .Sq setdrv option with an incorrect -d operand may cause the boot0 code to write the MBR to the wrong disk, thus trashing its previous content. Be careful.