1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
|
'\" t
.TH mformat 1 "21Mar23" mtools-4.0.43
.SH Name
mformat - add an MSDOS filesystem to a low-level formatted floppy disk
'\" t
.de TQ
.br
.ns
.TP \\$1
..
.tr \(is'
.tr \(if`
.tr \(pd"
.SH Note\ of\ warning
This manpage has been automatically generated from mtools's texinfo
documentation, and may not be entirely accurate or complete. See the
end of this man page for details.
.PP
.SH Description
.PP
The \fR\&\f(CWmformat\fR command is used to add an MS-DOS file system to a
low-level formatted diskette. Its syntax is:
.PP
.ft I
.nf
\&\fR\&\f(CWmformat\fR [\fR\&\f(CW-t\fR \fIcylinders\fR|\fR\&\f(CW-T\fR \fItot_sectors\fR] [\fR\&\f(CW-h\fR \fIheads\fR] [\fR\&\f(CW-s\fR \fIsectors\fR]
[\fR\&\f(CW-f\fR \fIsize\fR] [\fR\&\f(CW-1\fR] [\fR\&\f(CW-4\fR] [\fR\&\f(CW-8\fR]
[\fR\&\f(CW-v\fR \fIvolume_label\fR]
[\fR\&\f(CW-F\fR] [\fR\&\f(CW-S\fR \fIsizecode\fR]
[\fR\&\f(CW-M\fR \fIsoftware_sector_size\fR]
[\fR\&\f(CW-N\fR \fIserial_number\fR] [\fR\&\f(CW-a\fR]
[\fR\&\f(CW-C\fR] [\fR\&\f(CW-H\fR \fIhidden_sectors\fR] [\fR\&\f(CW-I\fR \fIfsVersion\fR]
[\fR\&\f(CW-r\fR \fIroot_sectors\fR] [\fR\&\f(CW-L\fR \fIfat_len\fR]
[\fR\&\f(CW-B\fR \fIboot_sector\fR] [\fR\&\f(CW-k\fR]
[\fR\&\f(CW-m\fR \fImedia_descriptor\fR]
[\fR\&\f(CW-K\fR \fIbackup_boot\fR]
[\fR\&\f(CW-R\fR \fInb_reserved_sectors\fR]
[\fR\&\f(CW-c\fR \fIclusters_per_sector\fR]
[\fR\&\f(CW-d\fR \fIfat_copies\fR]
[\fR\&\f(CW-X\fR] [\fR\&\f(CW-2\fR \fIsectors_on_track_0\fR] [\fR\&\f(CW-3\fR]
[\fR\&\f(CW-0\fR \fIrate_on_track_0\fR] [\fR\&\f(CW-A\fR \fIrate_on_other_tracks\fR]
\fIdrive:\fR
.fi
.ft R
.PP
\&\fR\&\f(CWMformat\fR adds a minimal MS-DOS file system (boot sector, FAT, and
root directory) to a diskette that has already been formatted by a Unix
low-level format.
.PP
The following options are supported: (The S, 2, 1 and M options may not
exist if this copy of mtools has been compiled without the USE_2M
option)
.PP
The following options are the same as for MS-DOS's format command:
.PP
.SH Options
.TP
\&\fR\&\f(CWv\fR\
Specifies the volume label. A volume label identifies the disk and can
be a maximum of 11 characters. If you omit the -v switch, mformat will
assign no label to the disk.
.TP
\&\fR\&\f(CWf\fR\
Specifies the size of the DOS file system to format. Only a certain
number of predefined sizes are supported by this flag; for others use
the -h/-t/-s flags. The following sizes are supported:
.RS
.TP
160\
160K, single-sided, 8 sectors per track, 40 cylinders (for 5 1/4 DD)
.TP
180\
160K, single-sided, 9 sectors per track, 40 cylinders (for 5 1/4 DD)
.TP
320\
320K, double-sided, 8 sectors per track, 40 cylinders (for 5 1/4 DD)
.TP
360\
360K, double-sided, 9 sectors per track, 40 cylinders (for 5 1/4 DD)
.TP
720\
720K, double-sided, 9 sectors per track, 80 cylinders (for 3 1/2 DD)
.TP
1200\
1200K, double-sided, 15 sectors per track, 80 cylinders (for 5 1/4 HD)
.TP
1440\
1440K, double-sided, 18 sectors per track, 80 cylinders (for 3 1/2 HD)
.TP
2880\
2880K, double-sided, 36 sectors per track, 80 cylinders (for 3 1/2 ED)
.RE
.TP
\&\fR\&\f(CWt\fR\
Specifies the number of tracks on the disk.
.TP
\&\fR\&\f(CWT\fR\
Specifies the number of total sectors on the disk. Only one of these 2
options may be specified (tracks or total sectors)
.TP
\&\fR\&\f(CWh\fR\
The number of heads (sides).
.TP
\&\fR\&\f(CWs\fR\
Specifies the number of sectors per track. If the 2m option is given,
number of 512-byte sector equivalents on generic tracks (i.e. not head 0
track 0). If the 2m option is not given, number of physical sectors per
track (which may be bigger than 512 bytes).
.TP
\&\fR\&\f(CW1\fR\
Formats a single side (equivalent to -h 1)
.TP
\&\fR\&\f(CW4\fR\
Formats a 360K double-sided disk (equivalent to -f 360). When used
together with -the 1 switch, this switch formats a 180K disk
.TP
\&\fR\&\f(CW8\fR\
Formats a disk with 8 sectors per track.
.PP
MS-DOS format's \fR\&\f(CWq\fR, \fR\&\f(CWu\fR and \fR\&\f(CWb\fR options are not
supported, and \fR\&\f(CWs\fR has a different meaning.
.PP
The following options are specific to mtools:
.IP
.TP
\&\fR\&\f(CWF\fR\
Format the partition as FAT32.
.TP
\&\fR\&\f(CWS\fR\
The size code. The size of the sector is 2 ^ (sizecode + 7).
.TP
\&\fR\&\f(CWX\fR\
formats the disk as an XDF disk. See section XDF, for more details. The disk
has first to be low-level formatted using the xdfcopy utility included
in the fdutils package. XDF disks are used for instance for OS/2 install
disks.
.TP
\&\fR\&\f(CW2\fR\
2m format. The parameter to this option describes the number of
sectors on track 0, head 0. This option is recommended for sectors
bigger than normal.
.TP
\&\fR\&\f(CW3\fR\
don't use a 2m format, even if the current geometry of the disk is a 2m
geometry.
.TP
\&\fR\&\f(CW0\fR\
Data transfer rate on track 0
.TP
\&\fR\&\f(CWA\fR\
Data transfer rate on tracks other than 0
.TP
\&\fR\&\f(CWM\fR\
software sector size. This parameter describes the sector size in bytes used
by the MS-DOS file system. By default it is the physical sector size.
.TP
\&\fR\&\f(CWN\fR\
Uses the requested serial number, instead of generating one
automatically
.TP
\&\fR\&\f(CWa\fR\
If this option is given, an Atari style serial number is generated.
Ataris store their serial number in the OEM label.
.TP
\&\fR\&\f(CWC\fR\
creates the disk image file to install the MS-DOS file system on
it. Obviously, this is useless on physical devices such as floppies
and hard disk partitions, but is interesting for image files.
.TP
\&\fR\&\f(CWH\fR\
number of hidden sectors. This parameter is useful for formatting hard
disk partition, which are not aligned on track boundaries (i.e. first
head of first track doesn't belong to the partition, but contains a
partition table). In that case the number of hidden sectors is in
general the number of sectors per cylinder. This is untested.
.TP
\&\fR\&\f(CWI\fR\
Sets the fsVersion id when formatting a FAT32 drive. In order to find
this out, run minfo on an existing FAT32 drive, and mail me about it, so
I can include the correct value in future versions of mtools.
.TP
\&\fR\&\f(CWc\fR\
Sets the size of a cluster (in sectors). If this cluster size would
generate a FAT that too big for its number of bits, mtools automatically
increases the cluster size, until the FAT is small enough. If no
cluster size is specified explicitly, mtools uses a default value as
described in section ``Number of sectors per cluster'' below.
.TP
\&\fR\&\f(CWd\fR\
Sets the number of FAT copies. Default is 2. This setting can also be
specified using the \fR\&\f(CWMTOOLS_NFATS\fR environment variable.
.TP
\&\fR\&\f(CWr\fR\
Sets the size of the root directory (in sectors). Only applicable to 12
and 16 bit FATs. This setting can also be specified using the
\&\fR\&\f(CWMTOOLS_DIR_LEN\fR environment variable.
.TP
\&\fR\&\f(CWL\fR\
Sets the length of the FAT.
.TP
\&\fR\&\f(CWB\fR\
Use the boot sector stored in the given file or device, instead of using
its own. Only the geometry fields are updated to match the target disks
parameters.
.TP
\&\fR\&\f(CWk\fR\
Keep the existing boot sector as much as possible. Only the geometry
fields and other similar file system data are updated to match the target
disks parameters.
.TP
\&\fR\&\f(CWK\fR\
Sets the sector number where the backup of the boot sector should be
stored (only relevant on FAT32).
.TP
\&\fR\&\f(CWR\fR\
Sets the number of reserved sectors for this filesystem. This must be
at least 1 for non-FAT32 disks, and at least 3 for FAT disks (in order
to accommodate the boot sector, the info sector and the backup boot
sector).
.TP
\&\fR\&\f(CWm\fR\
Use a non-standard media descriptor byte for this disk. The media
descriptor is stored at position 21 of the boot sector, and as first
byte in each FAT copy. Using this option may confuse DOS or older mtools
version, and may make the disk unreadable. Only use if you know what you
are doing.
.TP
\&\fR\&\f(CWb\fR\
Use a non-standard bios disk number for this disk. By default, bios
disk number is inferred from media descriptor: 0x80 for media
descriptor 0xf8, or 0x00 otherwise.
.PP
To format a diskette at a density other than the default, you must supply
(at least) those command line parameters that are different from the
default.
.PP
\&\fR\&\f(CWMformat\fR returns 0 on success or 1 on failure.
.PP
It doesn't record bad block information to the Fat, use
\&\fR\&\f(CWmbadblocks\fR for that.
.PP
.SH Number\ of\ sectors\ per\ cluster
.PP
If the user indicates no cluster size, mformat figures out a default
value for it.
.PP
For FAT32 it uses the following table to determine the number of
sectors per cluster, depending on the total number of sectors on the
filesystem.
.PP
more than 32*1024*1024*2: 64 sectors
.br
between 16*1024*1024*2 and 32*1024*1024*2: 32 sectors
.br
between 8*1024*1024*2 and 16*1024*1024*2: 16 sectors
.br
between 260*1024*2 and 81024*1024*2: 1 sectors
.br
.PP
This is derived from information on page 20 of Microsoft's
\&\fR\&\f(CWfatgen103\fR document, which currently can be found at the
following address:
.PP
\&\fR\&\f(CWhttps://staff.washington.edu/dittrich/misc/fatgen103.pdf\fR
.PP
For FAT12 and FAT16, mformat uses an iterative approach, where it
starts with a set value, which it doubles until it is able to fill up
the disk using that cluster size and a number of cluster less than the
maximum allowed.
.PP
The starting value is 1 for disks with one head or less than 2000
sectors, and 2 for disks with more than one head, and more than 2000
sectors.
.PP
The number of sectors per cluster cannot go beyond 128.
.PP
.SH See\ Also
Mtools' texinfo doc
.SH Viewing\ the\ texi\ doc
This manpage has been automatically generated from mtools's texinfo
documentation. However, this process is only approximative, and some
items, such as crossreferences, footnotes and indices are lost in this
translation process. Indeed, these items have no appropriate
representation in the manpage format. Moreover, not all information has
been translated into the manpage version. Thus I strongly advise you to
use the original texinfo doc. See the end of this manpage for
instructions how to view the texinfo doc.
.TP
* \ \
To generate a printable copy from the texinfo doc, run the following
commands:
.nf
.ft 3
.in +0.3i
./configure; make dvi; dvips mtools.dvi
.fi
.in -0.3i
.ft R
.PP
\&\fR
.TP
* \ \
To generate a html copy, run:
.nf
.ft 3
.in +0.3i
./configure; make html
.fi
.in -0.3i
.ft R
.PP
\&\fRA premade html can be found at
\&\fR\&\f(CW\(ifhttp://www.gnu.org/software/mtools/manual/mtools.html\(is\fR
.TP
* \ \
To generate an info copy (browsable using emacs' info mode), run:
.nf
.ft 3
.in +0.3i
./configure; make info
.fi
.in -0.3i
.ft R
.PP
\&\fR
.PP
The texinfo doc looks most pretty when printed or as html. Indeed, in
the info version certain examples are difficult to read due to the
quoting conventions used in info.
.PP
|