1.\" $NetBSD: newfs_msdos.8,v 1.15 2006/11/25 12:29:33 scw Exp $ 2.\" 3.\" Copyright (c) 1998 Robert Nordier 4.\" All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in 13.\" the documentation and/or other materials provided with the 14.\" distribution. 15.\" 16.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS 17.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY 20.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 22.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 24.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 25.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27.\" 28.\" From: $FreeBSD: src/sbin/newfs_msdos/newfs_msdos.8,v 1.13 2001/08/14 10:01:48 ru Exp $ 29.\" 30.Dd November 25, 2006 31.Dt NEWFS_MSDOS 8 32.Os 33.Sh NAME 34.Nm newfs_msdos 35.Nd construct a new MS-DOS (FAT) file system 36.Sh SYNOPSIS 37.Nm 38.Op Fl N 39.Op Fl B Ar boot 40.Op Fl F Ar FAT-type 41.Op Fl I Ar volid 42.Op Fl L Ar label 43.Op Fl O Ar OEM 44.Op Fl S Ar sector-size 45.Op Fl a Ar FAT-size 46.Op Fl b Ar block-size 47.Op Fl c Ar cluster-size 48.Op Fl e Ar dirents 49.Op Fl f Ar format 50.Op Fl h Ar heads 51.Op Fl i Ar info 52.Op Fl k Ar backup 53.Op Fl m Ar media 54.Op Fl n Ar FATs 55.Op Fl o Ar hidden 56.Op Fl r Ar reserved 57.Op Fl s Ar total 58.Op Fl u Ar track-size 59.Ar special 60.Op Ar disktype 61.Sh DESCRIPTION 62The 63.Nm 64utility creates a FAT12, FAT16, or FAT32 file system on device 65.Ar special , 66using 67.Xr disktab 5 68entry 69.Ar disktype 70to determine geometry, if required. 71.Pp 72The options are as follow: 73.Bl -tag -width indent 74.It Fl N 75Don't create a file system: just print out parameters. 76.It Fl B Ar boot 77Get bootstrap from file. 78.It Fl F Ar FAT-type 79FAT type (one of 12, 16, or 32). 80.It Fl I Ar volid 81Volume ID. 82.It Fl L Ar label 83Volume label (up to 11 characters). 84The label should consist of only those characters permitted 85in regular DOS (8+3) filenames. 86The default is 87.Qq Li "NO_NAME" . 88.It Fl O Ar OEM 89OEM string (up to 8 characters). 90The default is 91.Qq Li "NetBSD" . 92.It Fl S Ar sector-size 93Number of bytes per sector. 94Acceptable values are powers of 2 in the range 512 through 32768. 95.It Fl a Ar FAT-size 96Number of sectors per FAT. 97.It Fl b Ar block-size 98File system block size (bytes per cluster). 99This should resolve to an acceptable number of sectors 100per cluster (see below). 101.It Fl c Ar cluster-size 102Sectors per cluster. 103Acceptable values are powers of 2 in the range 1 through 128. 104.It Fl e Ar dirents 105Number of root directory entries (FAT12 and FAT16 only). 106.It Fl f Ar format 107Specify a standard (floppy disk) format. 108The standard formats are (capacities in kilobytes): 109160, 180, 320, 360, 640, 720, 1200, 1232, 1440, 2880. 110.It Fl h Ar heads 111Number of drive heads. 112.It Fl i Ar info 113Location of the file system info sector (FAT32 only). 114A value of 0xffff signifies no info sector. 115.It Fl k Ar backup 116Location of the backup boot sector (FAT32 only). 117A value of 0xffff signifies no backup sector. 118.It Fl m Ar media 119Media descriptor (acceptable range 0xf0 to 0xff). 120.It Fl n Ar FATs 121Number of FATs. 122Acceptable values are 1 to 16 inclusive. 123The default is 2. 124.It Fl o Ar hidden 125Number of hidden sectors. 126.It Fl r Ar reserved 127Number of reserved sectors. 128.It Fl s Ar total 129File system size. 130.It Fl u Ar track-size 131Number of sectors per track. 132.El 133.Pp 134If 135.Nm 136receives a 137.Dv SIGINFO 138signal 139(see the 140.Sy status 141argument for 142.Xr stty 1 ) , 143a line will be written to the standard error output indicating 144the name of the device currently being formatted, the sector 145number being written, and the total number of sectors to be written. 146.Sh NOTES 147FAT file system parameters occupy a "Boot Sector BPB (BIOS Parameter 148Block)" in the first of the "reserved" sectors which precede the actual 149file system. 150For reference purposes, this structure is presented below. 151.Bd -literal 152struct bsbpb { 153 u_int16_t bps; /* [-S] bytes per sector */ 154 u_int8_t spc; /* [-c] sectors per cluster */ 155 u_int16_t res; /* [-r] reserved sectors */ 156 u_int8_t nft; /* [-n] number of FATs */ 157 u_int16_t rde; /* [-e] root directory entries */ 158 u_int16_t sec; /* [-s] total sectors */ 159 u_int8_t mid; /* [-m] media descriptor */ 160 u_int16_t spf; /* [-a] sectors per FAT */ 161 u_int16_t spt; /* [-u] sectors per track */ 162 u_int16_t hds; /* [-h] drive heads */ 163 u_int32_t hid; /* [-o] hidden sectors */ 164 u_int32_t bsec; /* [-s] big total sectors */ 165}; 166/* FAT32 extensions */ 167struct bsxbpb { 168 u_int32_t bspf; /* [-a] big sectors per FAT */ 169 u_int16_t xflg; /* control flags */ 170 u_int16_t vers; /* file system version */ 171 u_int32_t rdcl; /* root directory start cluster */ 172 u_int16_t infs; /* [-i] file system info sector */ 173 u_int16_t bkbs; /* [-k] backup boot sector */ 174}; 175.Ed 176.Sh EXAMPLES 177.Bd -literal -offset indent 178newfs_msdos /dev/rwd1a 179.Ed 180.Pp 181Create a file system, using default parameters, on 182.Pa /dev/rwd1a . 183.Bd -literal -offset indent 184newfs_msdos -f 1440 -L foo /dev/rfd0a 185.Ed 186.Pp 187Create a standard 1.44M file system, with volume label 188.Ar foo , 189on 190.Pa /dev/rfd0a . 191.Sh DIAGNOSTICS 192Exit status is 0 on success and 1 on error. 193.Sh SEE ALSO 194.Xr disktab 5 , 195.Xr disklabel 8 , 196.Xr fdisk 8 , 197.Xr newfs 8 198.Sh HISTORY 199The 200.Nm 201command first appeared in 202.Nx 1.3 . 203.Sh AUTHORS 204.An Robert Nordier Aq rnordier@FreeBSD.org . 205