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