xref: /freebsd/usr.sbin/fdformat/fdformat.8 (revision b077aed33b7b6aefca7b17ddb250cf521f938613)
1.\" Copyright (C) 1993, 1994, 1995, 2001 by Joerg Wunsch, Dresden
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 the
11.\"    documentation and/or other materials provided with the distribution.
12.\"
13.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS
14.\" OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
16.\" DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT,
17.\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
18.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
19.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
21.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
22.\" IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
23.\" POSSIBILITY OF SUCH DAMAGE.
24.\"
25.\" $FreeBSD$
26.\"
27.Dd May 23, 2020
28.Dt FDFORMAT 8
29.Os
30.Sh NAME
31.Nm fdformat
32.Nd format floppy disks
33.Sh SYNOPSIS
34.Nm
35.Op Fl F Ar fill
36.Op Fl f Ar fmt
37.Op Fl s Ar fmtstr
38.Op Fl nqvy
39.Ar device
40.Sh DESCRIPTION
41The
42.Nm
43utility formats a floppy disk at
44.Ar device ,
45where
46.Ar device
47may either be given as a full path
48name of a device node for a floppy disk drive
49(e.g.,\&
50.Pa /dev/fd0 ) ,
51or using an abbreviated name that will be looked up
52under
53.Pa /dev
54(e.g.,\&
55.Dq Li fd0 ) .
56.Pp
57The options are as follows:
58.Bl -tag -width ".Fl s Ar fmtstr"
59.It Fl F Ar fill
60Use
61.Ar fill
62as the fill byte for newly formatted sectors.
63The
64.Ar fill
65argument
66must be a number in the range 0 through 255 using common C
67language notation.
68The default value is
69.Dq Li 0xf6 .
70.It Fl f Ar fmt
71Specify the density settings for a
72.Ar fmt
73kilobyte format, as described in
74.Xr fdcontrol 8 .
75.It Fl s Ar fmtstr
76Specify the density settings using explicit parameters, as
77described in
78.Xr fdcontrol 8 .
79.It Fl n
80Do not verify floppy after formatting.
81.It Fl q
82Suppress any normal output from the command, and do not ask the
83user for a confirmation whether to format the floppy disk at
84.Ar device .
85.It Fl v
86Do not format, verify only.
87.It Fl y
88Do not ask for confirmation whether to format the floppy disk but
89still report formatting status.
90.El
91.Pp
92For non-autoselecting subdevices, neither
93.Fl f Ar fmt
94nor
95.Fl s Ar fmtstr
96may be specified, since the preconfigured media density settings
97from the kernel driver will always be used.
98However, if
99.Ar device
100is a device with automatic media density selection (see
101.Xr fdc 4 ) ,
102both methods can be used to override the density settings for the
103newly formatted medium (without permanently changing the density
104settings of
105.Ar device ) .
106.Pp
107If the
108.Fl q
109flag has not been specified, the user is asked for a confirmation
110of the intended formatting process.
111In order to continue, an answer
112of
113.Ql y
114must be given.
115.Pp
116Note that
117.Nm
118does only perform low-level formatting.
119In order to create
120a file system on the medium, see the commands
121.Xr newfs 8
122for a
123.Tn UFS
124file system, or
125.Xr newfs_msdos 8
126for an
127.Tn MS-DOS
128(FAT)
129file system.
130.Sh EXIT STATUS
131An exit status of 0 is returned upon successful operation.
132Exit status
1331 is returned on any errors during floppy formatting, and an exit status
134of 2 reflects invalid arguments given to the program (along with an
135appropriate information written to diagnostic output).
136.Sh EXAMPLES
137To format a new double-sided, high-density (HD) 1.44 MB disk
138inserted in the first floppy disk drive, issue:
139.Pp
140.Dl "/usr/sbin/fdformat -f 1440 /dev/fd0"
141.Pp
142After low-level formatting the disk with
143.Nm ,
144create a disk label so that the system can determine the size and
145geometry of the disk.
146The supported geometry values are listed in
147.Pa /etc/disktab ,
148and we will use
149.Va fd1440
150for this example.
151To write the disk label, use
152.Xr bsdlabel 8 :
153.Pp
154.Dl "/sbin/bsdlabel -B -w /dev/fd0 fd1440"
155.Pp
156The floppy is now ready to be high-level formatted with a file system.
157To format the floppy disk with FAT, issue:
158.Pp
159.Dl "/sbin/newfs_msdos /dev/fd0"
160.Sh DIAGNOSTICS
161Unless
162.Fl q
163has been specified, a single letter is printed to standard output
164to inform the user about the progress of work.
165First, an
166.Ql F
167is printed when the track is being formatted, then a
168.Ql V
169while it is being verified, and if an error has been detected, it
170will finally change to
171.Ql E .
172Detailed status information (cylinder, head and sector number, and the
173exact cause of the error) will be printed for up to 10 errors after the
174entire formatting process has completed.
175.Sh SEE ALSO
176.Xr fdc 4 ,
177.Xr bsdlabel 8 ,
178.Xr fdcontrol 8 ,
179.Xr newfs 8 ,
180.Xr newfs_msdos 8
181.Sh HISTORY
182The
183.Nm
184utility
185has been developed for
186.Bx 386 0.1
187and upgraded to the new
188.Xr fdc 4
189floppy disk driver.
190It later became part of the
191.Fx 1.1
192system.
193Starting with
194.Fx 5.0 ,
195it uses the unified density specifications as described in
196.Xr fdcontrol 8 .
197.Sh AUTHORS
198.An -nosplit
199The program has been contributed by
200.An J\(:org Wunsch ,
201Dresden, with changes by
202.An Serge Vakulenko
203and
204.An Andrey A. Chernov ,
205Moscow.
206