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