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