1.\" $OpenBSD: newfs_msdos.8,v 1.23 2009/07/27 18:11:07 halex 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.\" $FreeBSD: src/sbin/newfs_msdos/newfs_msdos.8,v 1.6 1999/08/28 00:13:52 peter Exp $ 29.\" 30.Dd $Mdocdate: July 27 2009 $ 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 newfs_msdos 38.Bk -words 39.Op Fl N 40.Op Fl a Ar FAT-size 41.Op Fl B Ar boot 42.Op Fl b Ar block-size 43.Op Fl c Ar cluster-size 44.Op Fl e Ar dirents 45.Op Fl F Ar FAT-type 46.Op Fl f Ar format 47.Op Fl h Ar heads 48.Op Fl I Ar volid 49.Op Fl i Ar info 50.Op Fl k Ar backup 51.Op Fl L Ar label 52.Op Fl m Ar media 53.Op Fl n Ar FATs 54.Op Fl O Ar OEM 55.Op Fl o Ar hidden 56.Op Fl r Ar reserved 57.Op Fl S Ar sector-size 58.Op Fl s Ar total 59.Op Fl u Ar track-size 60.Ar special 61.Op Ar disktype 62.Ek 63.Sh DESCRIPTION 64The 65.Nm 66utility creates a FAT12, FAT16, or FAT32 file system on device 67.Ar special , 68using 69.Xr disktab 5 70entry 71.Ar disktype 72to determine geometry, if required. 73.Pp 74The 75.Ar special 76file should be a raw device, 77for example 78.Pa /dev/rsd0i ; 79if a relative path like 80.Pa sd0i 81is specified, 82the corresponding raw device is used. 83.Pp 84The options are as follows: 85.Bl -tag -width Ds 86.It Fl a Ar FAT-size 87Number of sectors per FAT. 88.It Fl B Ar boot 89Get bootstrap from file. 90.It Fl b Ar block-size 91File system block size (bytes per cluster). 92This should resolve to an acceptable number of sectors per cluster (see below). 93.It Fl c Ar cluster-size 94Sectors per cluster. 95Acceptable values are powers of 2 in the range 1 through 128. 96.It Fl e Ar dirents 97Number of root directory entries (FAT12 and FAT16 only). 98.It Fl F Ar FAT-type 99FAT type (one of 12, 16, or 32). 100.It Fl f Ar format 101Specify a standard (floppy disk) format. 102The eight standard formats 103are (capacities in kilobytes): 160, 180, 320, 360, 720, 1200, 1440, 1042880. 105.It Fl h Ar heads 106Number of drive heads. 107.It Fl I Ar volid 108Volume ID. 109.It Fl i Ar info 110Location of the file system info sector (FAT32 only). 111A value of 0xffff signifies no info sector. 112.It Fl k Ar backup 113Location of the backup boot sector (FAT32 only). 114A value of 0xffff signifies no backup sector. 115.It Fl L Ar label 116Volume label (up to 11 characters). 117The label should consist of 118only those characters permitted in regular DOS (8+3) filenames. 119.It Fl m Ar media 120Media descriptor (acceptable range 0xf0 to 0xff). 121.It Fl N 122Don't create a file system: just print out parameters. 123.It Fl n Ar FATs 124Number of FATs. 125Acceptable values are 1 to 16 inclusive. 126The default is 2. 127.It Fl O Ar OEM 128OEM string (up to 8 characters). 129The default is 130"BSD 4.4". 131.It Fl o Ar hidden 132Number of hidden sectors. 133.It Fl r Ar reserved 134Number of reserved sectors. 135.It Fl S Ar sector-size 136Number of bytes per sector. 137Acceptable values are powers of 2 in the range 128 through 32768. 138.It Fl s Ar total 139File system size. 140.It Fl u Ar track-size 141Number of sectors per track. 142.El 143.Sh NOTES 144FAT file system parameters occupy a "Boot Sector BPB (BIOS Parameter 145Block)" in the first of the "reserved" sectors which precede the actual 146file system. 147For reference purposes, this structure is presented below. 148.Bd -literal 149struct bsbpb { 150 u_int16_t bps; /* [-S] bytes per sector */ 151 u_int8_t spc; /* [-c] sectors per cluster */ 152 u_int16_t res; /* [-r] reserved sectors */ 153 u_int8_t nft; /* [-n] number of FATs */ 154 u_int16_t rde; /* [-e] root directory entries */ 155 u_int16_t sec; /* [-s] total sectors */ 156 u_int8_t mid; /* [-m] media descriptor */ 157 u_int16_t spf; /* [-a] sectors per FAT */ 158 u_int16_t spt; /* [-u] sectors per track */ 159 u_int16_t hds; /* [-h] drive heads */ 160 u_int32_t hid; /* [-o] hidden sectors */ 161 u_int32_t bsec; /* [-s] big total sectors */ 162}; 163 164/* FAT32 extensions */ 165struct bsxbpb { 166 u_int32_t bspf; /* [-a] big sectors per FAT */ 167 u_int16_t xflg; /* control flags */ 168 u_int16_t vers; /* file system version */ 169 u_int32_t rdcl; /* root directory start cluster */ 170 u_int16_t infs; /* [-i] file system info sector */ 171 u_int16_t bkbs; /* [-k] backup boot sector */ 172}; 173.Ed 174.Sh EXAMPLES 175Create a file system, using default parameters, on /dev/rwd0i. 176.Dl newfs_msdos /dev/rwd0i 177.Pp 178Create a standard 1.44M file system, with volume label "foo", on 179/dev/rfd0c. 180.Dl newfs_msdos -f 1440 -L foo fd0c 181.Sh DIAGNOSTICS 182Exit status is 0 on success and 1 on error. 183.Sh SEE ALSO 184.Xr disktab 5 , 185.Xr disklabel 8 , 186.Xr fdisk 8 , 187.Xr newfs 8 188.Sh HISTORY 189The 190.Nm 191command first appeared in 192.Ox 2.1 . 193.Sh AUTHORS 194.An Robert Nordier Aq rnordier@FreeBSD.org . 195