xref: /dragonfly/sbin/newfs_msdos/newfs_msdos.8 (revision b40e316c)
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: src/sbin/newfs_msdos/newfs_msdos.8,v 1.7.2.7 2003/02/24 00:56:42 trhodes Exp $
27.\" $DragonFly: src/sbin/newfs_msdos/newfs_msdos.8,v 1.2 2003/06/17 04:27:34 dillon Exp $
28.\"
29.Dd July 6, 1998
30.Dt NEWFS_MSDOS 8
31.Os
32.Sh NAME
33.Nm newfs_msdos
34.Nd construct a new MS-DOS (FAT) file system
35.Sh SYNOPSIS
36.Nm
37.Op Fl N
38.Op Fl B Ar boot
39.Op Fl F Ar FAT-type
40.Op Fl I Ar volid
41.Op Fl L Ar label
42.Op Fl O Ar OEM
43.Op Fl S Ar sector-size
44.Op Fl a Ar FAT-size
45.Op Fl b Ar block-size
46.Op Fl c Ar cluster-size
47.Op Fl e Ar dirents
48.Op Fl f Ar format
49.Op Fl h Ar heads
50.Op Fl i Ar info
51.Op Fl k Ar backup
52.Op Fl m Ar media
53.Op Fl n Ar FATs
54.Op Fl o Ar hidden
55.Op Fl r Ar reserved
56.Op Fl s Ar total
57.Op Fl u Ar track-size
58.Ar special
59.Op Ar disktype
60.Sh DESCRIPTION
61The
62.Nm
63utility creates a FAT12, FAT16, or FAT32 file system on device
64.Ar special ,
65using
66.Xr disktab 5
67entry
68.Ar disktype
69to determine geometry, if required.
70.Pp
71The options are as follow:
72.Bl -tag -width indent
73.It Fl N
74Don't create a file system: just print out parameters.
75.It Fl B Ar boot
76Get bootstrap from file.
77.It Fl F Ar FAT-type
78FAT type (one of 12, 16, or 32).
79.It Fl I Ar volid
80Volume ID.
81.It Fl L Ar label
82Volume label (up to 11 characters).  The 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).  The default is
86.Qq Li "BSD  4.4" .
87.It Fl S Ar sector-size
88Number of bytes per sector.  Acceptable values are powers of 2
89in the range 128 through 32768.
90.It Fl a Ar FAT-size
91Number of sectors per FAT.
92.It Fl b Ar block-size
93File system block size (bytes per cluster).  This should resolve to an
94acceptable number of sectors per cluster (see below).
95.It Fl c Ar cluster-size
96Sectors per cluster.  Acceptable values are powers of 2 in the range
971 through 128.
98.It Fl e Ar dirents
99Number of root directory entries (FAT12 and FAT16 only).
100.It Fl f Ar format
101Specify a standard (floppy disk) format.  The standard formats
102are (capacities in kilobytes): 160, 180, 320, 360, 640, 720, 1200,
1031232, 1440, 2880.
104.It Fl h Ar heads
105Number of drive heads.
106.It Fl i Ar info
107Location of the file system info sector (FAT32 only).
108A value of 0xffff signifies no info sector.
109.It Fl k Ar backup
110Location of the backup boot sector (FAT32 only).  A value
111of 0xffff signifies no backup sector.
112.It Fl m Ar media
113Media descriptor (acceptable range 0xf0 to 0xff).
114.It Fl n Ar FATs
115Number of FATs.  Acceptable values are 1 to 16 inclusive.
116The default
117is 2.
118.It Fl o Ar hidden
119Number of hidden sectors.
120.It Fl r Ar reserved
121Number of reserved sectors.
122.It Fl s Ar total
123File system size.
124.It Fl u Ar track-size
125Number of sectors per track.
126.El
127.Sh NOTES
128FAT file system parameters occupy a "Boot Sector BPB (BIOS Parameter
129Block)" in the first of the "reserved" sectors which precede the actual
130file system.  For reference purposes, this structure is presented
131below.
132.Bd -literal
133struct bsbpb {
134    u_int16_t	bps;		/* [-S] bytes per sector */
135    u_int8_t	spc;		/* [-c] sectors per cluster */
136    u_int16_t	res;		/* [-r] reserved sectors */
137    u_int8_t	nft;		/* [-n] number of FATs */
138    u_int16_t	rde;		/* [-e] root directory entries */
139    u_int16_t	sec;		/* [-s] total sectors */
140    u_int8_t	mid;		/* [-m] media descriptor */
141    u_int16_t	spf;		/* [-a] sectors per FAT */
142    u_int16_t	spt;		/* [-u] sectors per track */
143    u_int16_t	hds;		/* [-h] drive heads */
144    u_int32_t	hid;		/* [-o] hidden sectors */
145    u_int32_t	bsec;		/* [-s] big total sectors */
146};
147/* FAT32 extensions */
148struct bsxbpb {
149    u_int32_t	bspf;		/* [-a] big sectors per FAT */
150    u_int16_t	xflg;		/* control flags */
151    u_int16_t	vers;		/* file system version */
152    u_int32_t	rdcl;		/* root directory start cluster */
153    u_int16_t	infs;		/* [-i] file system info sector */
154    u_int16_t	bkbs;		/* [-k] backup boot sector */
155};
156.Ed
157.Sh EXAMPLES
158.Bd -literal -offset indent
159newfs_msdos /dev/ad0s1
160.Ed
161.Pp
162Create a file system, using default parameters, on
163.Pa /dev/ad0s1 .
164.Bd -literal -offset indent
165newfs_msdos -f 1440 -L foo fd0
166.Ed
167.Pp
168Create a standard 1.44M file system, with volume label
169.Ar foo ,
170on
171.Pa /dev/fd0 .
172.Sh SEE ALSO
173.Xr disktab 5 ,
174.Xr disklabel 8 ,
175.Xr fdisk 8 ,
176.Xr newfs 8
177.Sh DIAGNOSTICS
178Exit status is 0 on success and 1 on error.
179.Sh HISTORY
180The
181.Nm
182utility first appeared in
183.Fx 3.0 .
184.Sh AUTHORS
185.An Robert Nordier Aq rnordier@FreeBSD.org .
186