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