Alistair Delva | beaee83 | 2021-02-24 11:27:23 -0800 | [diff] [blame] | 1 | \input texinfo @c -*-texinfo-*- |
| 2 | @comment %**start of header |
| 3 | @setfilename mtools.info |
| 4 | @include version.texi |
| 5 | @settitle Mtools @value{VERSION} |
| 6 | @syncodeindex pg cp |
| 7 | @comment %**end of header |
| 8 | |
| 9 | @comment MANskip 5 |
| 10 | |
| 11 | @copying |
| 12 | This manual is for Mtools (version @value{VERSION}, @value{UPDATED}), |
| 13 | which is a collection of tools to allow Unix systems to manipulate |
| 14 | MS-DOS files. |
| 15 | |
| 16 | Copyright @copyright{} 2007, 2009 Free Software Foundation, Inc. |
| 17 | Copyright @copyright{} 1996-2005,2007-2011,2013 Alain Knaff. |
| 18 | |
| 19 | @quotation |
| 20 | Permission is granted to copy, distribute and/or modify this document |
| 21 | under the terms of the GNU Free Documentation License, Version 1.3 or |
| 22 | any later version published by the Free Software Foundation; with no |
| 23 | Invariant Sections, with no Front-Cover Texts, and with no Back-Cover |
| 24 | Texts. A copy of the license is included in the section entitled |
| 25 | ``GNU Free Documentation License''. |
| 26 | @end quotation |
| 27 | @end copying |
| 28 | |
| 29 | @ignore |
| 30 | @unnumbered Name |
| 31 | mtools - utilities to access DOS disks in Unix. |
| 32 | @end ignore |
| 33 | |
| 34 | @include sysconfdir.texi |
| 35 | |
| 36 | @iftex |
| 37 | @finalout |
| 38 | @end iftex |
| 39 | |
| 40 | @dircategory DOS |
| 41 | @direntry |
| 42 | * Mtools: (mtools). Mtools: utilities to access DOS disks in Unix. |
| 43 | @end direntry |
| 44 | |
| 45 | |
| 46 | @titlepage |
| 47 | @title Mtools |
| 48 | |
| 49 | @c The following two commands start the copyright page. |
| 50 | @page |
| 51 | @vskip 0pt plus 1filll |
| 52 | @insertcopying |
| 53 | @end titlepage |
| 54 | |
| 55 | @c Output the table contents at the beginning |
| 56 | @contents |
| 57 | |
| 58 | @ifnottex |
| 59 | @node Top, Location, (dir), (dir) |
| 60 | @top Mtools doc |
| 61 | |
| 62 | This is mtools' documentation. |
| 63 | @end ifnottex |
| 64 | |
| 65 | @comment MANstart 1 |
| 66 | |
| 67 | @unnumbered Introduction |
| 68 | Mtools is a collection of tools to allow Unix systems to manipulate |
| 69 | MS-DOS files: read, write, and move around files on an MS-DOS |
| 70 | file system (typically a floppy disk). Where reasonable, each program |
| 71 | attempts to emulate the MS-DOS equivalent command. However, |
| 72 | unnecessary restrictions and oddities of DOS are not emulated. For |
| 73 | instance, it is possible to move subdirectories from one subdirectory |
| 74 | to another. |
| 75 | |
| 76 | Mtools is sufficient to give access to MS-DOS file systems. For |
| 77 | instance, commands such as @code{mdir a:} work on the @code{a:} floppy |
| 78 | without any preliminary mounting or initialization (assuming the default |
| 79 | @file{@value{SYSCONFDIR}mtools.conf} works on your machine). With mtools, one can |
| 80 | change floppies too without unmounting and mounting. |
| 81 | |
| 82 | @insertcopying |
| 83 | |
| 84 | @menu |
| 85 | * Location:: Where to find mtools and early bug fixes |
| 86 | * Common features:: Common features of all mtools commands |
| 87 | * Configuration:: How to configure mtools for your environment |
| 88 | * Commands:: The available mtools commands |
| 89 | * Compiling mtools:: Architecture specific compilation flags |
| 90 | * Porting mtools:: Porting mtools to architectures which are not |
| 91 | yet supported |
| 92 | |
| 93 | * Command Index:: Command Index |
| 94 | * Variable Index:: Variable Index |
| 95 | * Concept Index:: Concept Index |
| 96 | @end menu |
| 97 | |
| 98 | @node Location, Common features, Top, Top |
| 99 | @chapter Where to get mtools |
| 100 | @cindex bugs |
| 101 | @cindex ALPHA patches |
| 102 | @cindex patches |
| 103 | @cindex diffs |
| 104 | @cindex mailing list |
| 105 | |
| 106 | Mtools can be found at the following places (and their mirrors): |
| 107 | @example |
| 108 | http://ftp.gnu.org/gnu/mtools/mtools-@value{VERSION}.tar.gz |
| 109 | @end example |
| 110 | |
| 111 | These patches are named |
| 112 | @code{mtools-}@var{version}@code{-}@var{ddmm}@code{.taz}, where version |
| 113 | stands for the base version, @var{dd} for the day and @var{mm} for the |
| 114 | month. Due to a lack of space, I usually leave only the most recent |
| 115 | patch. |
| 116 | |
| 117 | There is an mtools mailing list at info-mtools @@ gnu.org . Please |
| 118 | send all bug reports to this list. You may subscribe to the list at |
| 119 | https://lists.gnu.org/mailman/listinfo/info-mtools. (N.B. Please |
| 120 | remove the spaces around the "@@". I left them there in order to fool |
| 121 | spambots.) Announcements of new mtools versions will also be sent to |
| 122 | the list, in addition to the Linux announce newsgroups. The mailing |
| 123 | list is archived at http://lists.gnu.org/pipermail/info-mtools/ |
| 124 | |
| 125 | |
| 126 | @node Common features, Configuration, Location, Top |
| 127 | @chapter Common features of all mtools commands |
| 128 | |
| 129 | @menu |
| 130 | * arguments:: What the command line parameters of mtools |
| 131 | mean |
| 132 | * drive letters:: Which drives are defined by default |
| 133 | * directory:: Current working directory |
| 134 | * long names:: VFAT-style long filenames |
| 135 | * name clashes:: Name clash handling, and associated command |
| 136 | line options |
| 137 | * case sensitivity:: Case sensitivity |
| 138 | * high capacity formats:: How to fit more data on your floppies |
| 139 | * exit codes:: Exit codes |
| 140 | * bugs:: Happens to everybody |
| 141 | @end menu |
| 142 | |
| 143 | @node arguments, drive letters, Common features, Common features |
| 144 | @section Options and filenames |
| 145 | @cindex Filenames |
| 146 | @cindex Options |
| 147 | MS-DOS filenames are composed of a drive letter followed by a colon, a |
| 148 | subdirectory, and a filename. Only the filename part is mandatory, the |
| 149 | drive letter and the subdirectory are optional. Filenames without a |
| 150 | drive letter refer to Unix files. Subdirectory names can use either the |
| 151 | '@code{/}' or '@code{\}' separator. The use of the '@code{\}' separator |
| 152 | or wildcards requires the names to be enclosed in quotes to protect them |
| 153 | from the shell. However, wildcards in Unix filenames should not be |
| 154 | enclosed in quotes, because here we @strong{want} the shell to expand |
| 155 | them. |
| 156 | |
| 157 | The regular expression "pattern matching" routines follow the Unix-style |
| 158 | rules. For example, `@code{*}' matches all MS-DOS files in lieu of |
| 159 | `@code{*.*}'. The archive, hidden, read-only and system attribute bits |
| 160 | are ignored during pattern matching. |
| 161 | |
| 162 | All options use the @code{-} (minus) as their first character, not |
| 163 | @code{/} as you'd expect in MS-DOS. |
| 164 | |
| 165 | Most mtools commands allow multiple filename parameters, which |
| 166 | doesn't follow MS-DOS conventions, but which is more user-friendly. |
| 167 | |
Yi Kong | 39bbd96 | 2022-01-09 19:41:38 +0800 | [diff] [blame^] | 168 | Most mtools commands allow options that instruct them how to handle |
| 169 | file name clashes. @xref{name clashes}, for more details on these. |
Alistair Delva | beaee83 | 2021-02-24 11:27:23 -0800 | [diff] [blame] | 170 | |
Yi Kong | 39bbd96 | 2022-01-09 19:41:38 +0800 | [diff] [blame^] | 171 | All commands accept the @code{-i} flag which allows to specify an |
| 172 | image file (@xref{drive letters}). |
| 173 | |
| 174 | All commands accept the @code{-V} flag which prints the version, and |
| 175 | most accept the @code{-v} flag, which switches on verbose mode. In |
| 176 | verbose mode, these commands print out the name of the MS-DOS files |
| 177 | upon which they act, unless stated otherwise. @xref{Commands}, for a |
| 178 | description of the options which are specific to each command. |
Alistair Delva | beaee83 | 2021-02-24 11:27:23 -0800 | [diff] [blame] | 179 | |
| 180 | @node drive letters, directory, arguments, Common features |
| 181 | @section Drive letters |
| 182 | |
| 183 | The meaning of the drive letters depends on the target architectures. |
| 184 | However, on most target architectures, drive A is the first floppy |
| 185 | drive, drive B is the second floppy drive (if available), drive J is a |
| 186 | Jaz drive (if available), and drive Z is a Zip drive (if available). On |
| 187 | those systems where the device name is derived from the SCSI id, the Jaz |
| 188 | drive is assumed to be at SCSI target 4, and the Zip at SCSI target 5 |
| 189 | (factory default settings). On Linux, both drives are assumed to be the |
| 190 | second drive on the SCSI bus (/dev/sdb). The default settings can be |
| 191 | changes using a configuration file (@pxref{Configuration}). |
| 192 | |
| 193 | The drive letter : (colon) has a special meaning. It is used to access |
| 194 | image files which are directly specified on the command line using the |
| 195 | @code{-i} options. |
| 196 | |
| 197 | Example: |
| 198 | @example |
| 199 | mcopy -i my-image-file.bin ::file1 ::file2 . |
| 200 | @end example |
| 201 | |
| 202 | This copies @code{file1} and @code{file2} from the image file |
| 203 | (@code{my-image-file.bin}) to the @code{/tmp} directory. |
| 204 | |
| 205 | You can also supply an offset within the image file by including |
| 206 | @code{@@@@}@var{offset} into the file name. |
| 207 | |
| 208 | Example: |
| 209 | @example |
| 210 | mcopy -i my-image-file.bin@@@@1M ::file1 ::file2 . |
| 211 | @end example |
| 212 | |
| 213 | This looks for the image at the offset of 1M in the file, rather than |
| 214 | at its beginning. |
| 215 | |
| 216 | @node directory, long names, drive letters, Common features |
| 217 | @section Current working directory |
| 218 | @pindex mcd (introduction) |
| 219 | @cindex Directory |
| 220 | @cindex Working directory |
| 221 | @cindex Current working directory |
| 222 | @cindex Default directory |
| 223 | |
| 224 | The @code{mcd} command (@ref{mcd}) is used to establish the device and |
| 225 | the current working directory (relative to the MS-DOS file system), |
| 226 | otherwise the default is assumed to be @code{A:/}. However, unlike |
| 227 | MS-DOS, there is only one working directory for all drives, and not one |
| 228 | per drive. |
| 229 | |
| 230 | @node long names, name clashes, directory, Common features |
| 231 | @section VFAT-style long file names |
| 232 | @cindex Long file name |
| 233 | @cindex Windows 95-style file names |
| 234 | @cindex VFAT-style file names |
| 235 | @cindex Primary file name (long names) |
| 236 | @cindex Secondary file name (long names) |
| 237 | |
| 238 | This version of mtools supports VFAT style long filenames. If a Unix |
| 239 | filename is too long to fit in a short DOS name, it is stored as a |
| 240 | VFAT long name, and a companion short name is generated. This short |
| 241 | name is what you see when you examine the disk with a pre-7.0 version |
| 242 | of DOS. |
| 243 | The following table shows some examples of short names: |
| 244 | |
| 245 | @example |
| 246 | Long name MS-DOS name Reason for the change |
| 247 | --------- ---------- --------------------- |
| 248 | thisisatest THISIS~1 filename too long |
| 249 | alain.knaff ALAIN~1.KNA extension too long |
| 250 | prn.txt PRN~1.TXT PRN is a device name |
| 251 | .abc ABC~1 null filename |
| 252 | hot+cold HOT_CO~1 illegal character |
| 253 | @end example |
| 254 | |
| 255 | As you see, the following transformations happen to derive a short |
| 256 | name: |
| 257 | @itemize @bullet |
| 258 | @item |
| 259 | Illegal characters are replaced by underscores. The illegal characters |
| 260 | are @code{;+=[]',\"*\\<>/?:|}. |
| 261 | @item |
| 262 | Extra dots, which cannot be interpreted as a main name/extension |
| 263 | separator are removed |
| 264 | @item |
| 265 | A @code{~}@var{n} number is generated, |
| 266 | @item |
| 267 | The name is shortened so as to fit in the 8+3 limitation |
| 268 | @end itemize |
| 269 | |
| 270 | The initial Unix-style file name (whether long or short) is also called |
| 271 | the @dfn{primary} name, and the derived short name is also called the |
| 272 | @dfn{secondary} name. |
| 273 | |
| 274 | Example: |
| 275 | @example |
| 276 | mcopy /etc/motd a:Reallylongname |
| 277 | @end example |
| 278 | Mtools creates a VFAT entry for Reallylongname, and uses REALLYLO as |
| 279 | a short name. Reallylongname is the primary name, and REALLYLO is the |
| 280 | secondary name. |
| 281 | @example |
| 282 | mcopy /etc/motd a:motd |
| 283 | @end example |
| 284 | Motd fits into the DOS filename limits. Mtools doesn't need to |
| 285 | derivate another name. Motd is the primary name, and there is no |
| 286 | secondary name. |
| 287 | |
| 288 | In a nutshell: The primary name is the long name, if one exists, or |
| 289 | the short name if there is no long name. |
| 290 | |
| 291 | Although VFAT is much more flexible than FAT, there are still names |
| 292 | that are not acceptable, even in VFAT. There are still some illegal |
| 293 | characters left (@code{\"*\\<>/?:|}), and device names are still |
| 294 | reserved. |
| 295 | |
| 296 | @example |
| 297 | Unix name Long name Reason for the change |
| 298 | --------- ---------- --------------------- |
| 299 | prn prn-1 PRN is a device name |
| 300 | ab:c ab_c-1 illegal character |
| 301 | @end example |
| 302 | |
| 303 | As you see, the following transformations happen if a long name is |
| 304 | illegal: |
| 305 | @itemize @bullet |
| 306 | @item |
| 307 | Illegal characters are replaces by underscores, |
| 308 | @item |
| 309 | A @code{-}@var{n} number is generated, |
| 310 | @end itemize |
| 311 | |
| 312 | @node name clashes, case sensitivity, long names, Common features |
| 313 | @section Name clashes |
| 314 | @cindex Name clashes |
| 315 | @cindex Duplicate file names |
| 316 | @cindex Overwriting files |
| 317 | @cindex Primary file name (name clashes) |
| 318 | @cindex Secondary file name (name clashes) |
| 319 | |
| 320 | When writing a file to disk, its long name or short name may collide |
| 321 | with an already existing file or directory. This may happen for all |
| 322 | commands which create new directory entries, such as @code{mcopy}, |
| 323 | @code{mmd}, @code{mren}, @code{mmove}. When a name clash happens, mtools |
| 324 | asks you what it should do. It offers several choices: |
| 325 | |
| 326 | @table @code |
| 327 | @item overwrite |
| 328 | Overwrites the existing file. It is not possible to overwrite a |
| 329 | directory with a file. |
| 330 | @item rename |
| 331 | Renames the newly created file. Mtools prompts for the new filename |
| 332 | @item autorename |
| 333 | Renames the newly created file. Mtools chooses a name by itself, without |
| 334 | prompting |
| 335 | @item skip |
| 336 | Gives up on this file, and moves on to the next (if any) |
| 337 | @end table |
| 338 | |
| 339 | To chose one of these actions, type its first letter at the prompt. If |
| 340 | you use a lower case letter, the action only applies for this file only, |
| 341 | if you use an upper case letter, the action applies to all files, and |
| 342 | you won't be prompted again. |
| 343 | |
| 344 | You may also chose actions (for all files) on the command line, when |
| 345 | invoking mtools: |
| 346 | |
| 347 | @table @code |
| 348 | @item -D o |
| 349 | Overwrites primary names by default. |
| 350 | @item -D O |
| 351 | Overwrites secondary names by default. |
| 352 | @item -D r |
| 353 | Renames primary name by default. |
| 354 | @item -D R |
| 355 | Renames secondary name by default. |
| 356 | @item -D a |
| 357 | Autorenames primary name by default. |
| 358 | @item -D A |
| 359 | Autorenames secondary name by default. |
| 360 | @item -D s |
| 361 | Skip primary name by default. |
| 362 | @item -D S |
| 363 | Skip secondary name by default. |
| 364 | @item -D m |
| 365 | Ask user what to do with primary name. |
| 366 | @item -D M |
| 367 | Ask user what to do with secondary name. |
| 368 | @end table |
| 369 | |
| 370 | Note that for command line switches lower/upper differentiates between |
| 371 | primary/secondary name whereas for interactive choices, lower/upper |
| 372 | differentiates between just-this-time/always. |
| 373 | |
| 374 | The primary name is the name as displayed in Windows 95 or Windows NT: |
| 375 | i.e. the long name if it exists, and the short name otherwise. The |
| 376 | secondary name is the "hidden" name, i.e. the short name if a long name |
| 377 | exists. |
| 378 | |
| 379 | By default, the user is prompted if the primary name clashes, and the |
| 380 | secondary name is autorenamed. |
| 381 | |
| 382 | If a name clash occurs in a Unix directory, mtools only asks whether |
| 383 | to overwrite the file, or to skip it. |
| 384 | |
| 385 | @node case sensitivity, high capacity formats, name clashes, Common features |
| 386 | @section Case sensitivity of the VFAT file system |
| 387 | @cindex Case sensitivity |
| 388 | |
| 389 | The VFAT file system is able to remember the case of the |
| 390 | filenames. However, filenames which differ only in case are not allowed |
| 391 | to coexist in the same directory. For example if you store a file called |
| 392 | LongFileName on a VFAT file system, mdir shows this file as LongFileName, |
| 393 | and not as Longfilename. However, if you then try to add LongFilename to |
| 394 | the same directory, it is refused, because case is ignored for clash |
| 395 | checks. |
| 396 | |
| 397 | The VFAT file system allows you to store the case of a filename in the |
| 398 | attribute byte, if all letters of the filename are the same case, and if |
| 399 | all letters of the extension are the same case too. Mtools uses this |
| 400 | information when displaying the files, and also to generate the Unix |
| 401 | filename when mcopying to a Unix directory. This may have unexpected |
| 402 | results when applied to files written using an pre-7.0 version of DOS: |
| 403 | Indeed, the old style filenames map to all upper case. This is different |
| 404 | from the behavior of the old version of mtools which used to generate |
| 405 | lower case Unix filenames. |
| 406 | |
| 407 | @node high capacity formats, exit codes, case sensitivity, Common features |
| 408 | @section high capacity formats |
| 409 | @cindex Special formats |
| 410 | @cindex High capacity formats |
| 411 | @cindex Odd formats |
| 412 | @cindex Weird formats |
| 413 | @cindex Formats, high capacity |
| 414 | @cindex Linux enhancements (High Capacity Formats) |
| 415 | |
| 416 | Mtools supports a number of formats which allow storage of more data on |
| 417 | disk than usual. Due to different operating system abilities, these |
| 418 | formats are not supported on all operating systems. Mtools recognizes |
| 419 | these formats transparently where supported. |
| 420 | |
| 421 | In order to format these disks, you need to use an operating system |
| 422 | specific tool. For Linux, suitable floppy tools can be found in the |
| 423 | @code{fdutils} package at the following locations~: |
| 424 | @example |
| 425 | @code{http://www.fdutils.linux.lu/}. |
| 426 | @end example |
| 427 | |
| 428 | See the manual pages included in that package for further detail: Use |
| 429 | @code{superformat} to format all formats except XDF, and use |
| 430 | @code{xdfcopy} to format XDF. |
| 431 | |
| 432 | @menu |
| 433 | * more sectors:: Putting more sectors per track on the disk |
| 434 | * bigger sectors:: Use bigger sectors to save header space |
| 435 | * 2m:: Use a standard first track |
| 436 | * XDF:: OS/2's eXtended density format |
| 437 | @end menu |
| 438 | |
| 439 | @node more sectors, bigger sectors, high capacity formats, high capacity formats |
| 440 | @subsection More sectors |
| 441 | @cindex fdformat |
| 442 | @cindex vgacopy |
| 443 | @cindex DMF disks |
| 444 | @cindex Windows 95 (DMF disks) |
| 445 | |
| 446 | The oldest method of fitting more data on a disk is to use more sectors |
| 447 | and more cylinders. Although the standard format uses 80 cylinders and |
| 448 | 18 sectors (on a 3 1/2 high density disk), it is possible to use up to |
| 449 | 83 cylinders (on most drives) and up to 21 sectors. This method allows |
| 450 | to store up to 1743K on a 3 1/2 HD disk. However, 21 sector disks are |
| 451 | twice as slow as the standard 18 sector disks because the sectors are |
| 452 | packed so close together that we need to interleave them. This problem |
| 453 | doesn't exist for 20 sector formats. |
| 454 | |
| 455 | These formats are supported by numerous DOS shareware utilities such as |
| 456 | @code{fdformat} and @code{vgacopy}. In his infinite hubris, Bill Gate$ |
| 457 | believed that he invented this, and called it @samp{DMF disks}, or |
| 458 | @samp{Windows formatted disks}. But in reality, it has already existed |
| 459 | years before! Mtools supports these formats on Linux, on SunOS and on |
| 460 | the DELL Unix PC. |
| 461 | |
| 462 | @node bigger sectors, 2m, more sectors, high capacity formats |
| 463 | @subsection Bigger sectors |
| 464 | @cindex bigger sectors |
| 465 | By using bigger sectors it is possible to go beyond the capacity which |
| 466 | can be obtained by the standard 512-byte sectors. This is because of the |
| 467 | sector header. The sector header has the same size, regardless of how |
| 468 | many data bytes are in the sector. Thus, we save some space by using |
| 469 | @emph{fewer}, but bigger sectors. For example, 1 sector of 4K only takes |
| 470 | up header space once, whereas 8 sectors of 512 bytes have also 8 |
| 471 | headers, for the same amount of useful data. |
| 472 | |
| 473 | This method permits storage of up to 1992K on a 3 1/2 HD disk. |
| 474 | |
| 475 | Mtools supports these formats only on Linux. |
| 476 | |
| 477 | @node 2m, XDF, bigger sectors, high capacity formats |
| 478 | @subsection 2m |
| 479 | @cindex 2m |
| 480 | |
| 481 | The 2m format was originally invented by Ciriaco Garcia de Celis. It |
| 482 | also uses bigger sectors than usual in order to fit more data on the |
| 483 | disk. However, it uses the standard format (18 sectors of 512 bytes |
| 484 | each) on the first cylinder, in order to make these disks easier to |
| 485 | handle by DOS. Indeed this method allows you to have a standard sized |
| 486 | boot sector, which contains a description of how the rest of the disk |
| 487 | should be read. |
| 488 | |
| 489 | However, the drawback of this is that the first cylinder can hold less |
| 490 | data than the others. Unfortunately, DOS can only handle disks where |
| 491 | each track contains the same amount of data. Thus 2m hides the fact that |
| 492 | the first track contains less data by using a @dfn{shadow |
| 493 | FAT}. (Usually, DOS stores the FAT in two identical copies, for |
| 494 | additional safety. XDF stores only one copy, but tells DOS that it |
| 495 | stores two. Thus the space that would be taken up by the second FAT copy |
| 496 | is saved.) This also means that you should @strong{never use a 2m disk |
| 497 | to store anything else than a DOS file system}. |
| 498 | |
| 499 | Mtools supports these formats only on Linux. |
| 500 | |
| 501 | @node XDF, , 2m, high capacity formats |
| 502 | @subsection XDF |
| 503 | @cindex XDF disks |
| 504 | @cindex OS/2 (XDF disks) |
| 505 | |
| 506 | XDF is a high capacity format used by OS/2. It can hold 1840 K per |
| 507 | disk. That's lower than the best 2m formats, but its main advantage is |
| 508 | that it is fast: 600 milliseconds per track. That's faster than the 21 |
| 509 | sector format, and almost as fast as the standard 18 sector format. In |
| 510 | order to access these disks, make sure mtools has been compiled with XDF |
| 511 | support, and set the @code{use_xdf} variable for the drive in the |
| 512 | configuration file. @xref{Compiling mtools}, and @ref{miscellaneous variables}, |
| 513 | for details on how to do this. Fast XDF access is only available for |
| 514 | Linux kernels which are more recent than 1.1.34. |
| 515 | |
| 516 | Mtools supports this format only on Linux. |
| 517 | |
| 518 | @strong{Caution / Attention distributors}: If mtools is compiled on a |
| 519 | Linux kernel more recent than 1.3.34, it won't run on an older |
| 520 | kernel. However, if it has been compiled on an older kernel, it still |
| 521 | runs on a newer kernel, except that XDF access is slower. It is |
| 522 | recommended that distribution authors only include mtools binaries |
| 523 | compiled on kernels older than 1.3.34 until 2.0 comes out. When 2.0 will |
| 524 | be out, mtools binaries compiled on newer kernels may (and should) be |
| 525 | distributed. Mtools binaries compiled on kernels older than 1.3.34 won't |
| 526 | run on any 2.1 kernel or later. |
| 527 | |
| 528 | @node exit codes, bugs, high capacity formats, Common features |
| 529 | @section Exit codes |
| 530 | All the Mtools commands return 0 on success, 1 on utter failure, or 2 |
| 531 | on partial failure. All the Mtools commands perform a few sanity |
| 532 | checks before going ahead, to make sure that the disk is indeed an |
| 533 | MS-DOS disk (as opposed to, say an ext2 or MINIX disk). These checks |
| 534 | may reject partially corrupted disks, which might otherwise still be |
| 535 | readable. To avoid these checks, set the MTOOLS_SKIP_CHECK |
| 536 | environmental variable or the corresponding configuration file variable |
| 537 | (@pxref{global variables}) |
| 538 | @node bugs, , exit codes, Common features |
| 539 | @section Bugs |
| 540 | An unfortunate side effect of not guessing the proper device (when |
| 541 | multiple disk capacities are supported) is an occasional error message |
| 542 | from the device driver. These can be safely ignored. |
| 543 | |
| 544 | The fat checking code chokes on 1.72 Mb disks mformatted with pre-2.0.7 |
| 545 | mtools. Set the environmental variable MTOOLS_FAT_COMPATIBILITY (or the |
| 546 | corresponding configuration file variable, @ref{global variables}) to |
| 547 | bypass the fat checking. |
| 548 | |
| 549 | @comment MANskip 1 |
| 550 | |
| 551 | @ignore |
| 552 | @unnumbered Name |
| 553 | mtools.conf - mtools configuration files |
| 554 | |
| 555 | @comment MANend-skip 5 |
| 556 | @section Description |
| 557 | |
| 558 | This manual page describes the configuration files for mtools. They |
| 559 | @comment MANskip 5 |
| 560 | @end ignore |
| 561 | |
| 562 | |
| 563 | @node Configuration, Commands, Common features, Top |
| 564 | |
| 565 | |
| 566 | @chapter How to configure mtools for your environment |
| 567 | @section Description |
| 568 | @cindex Configuration files |
| 569 | @vindex MTOOLSRC |
| 570 | |
| 571 | This sections explains the syntax of the configurations files for |
| 572 | mtools. The configuration files |
| 573 | @comment MANend-skip 5 |
| 574 | are called @file{@value{SYSCONFDIR}mtools.conf} and @file{~/.mtoolsrc}. If |
| 575 | the environmental variable @code{MTOOLSRC} is set, its contents is used |
| 576 | as the filename for a third configuration file. These configuration |
| 577 | files describe the following items: |
| 578 | |
| 579 | @itemize @bullet |
| 580 | @item Global configuration flags and variables |
| 581 | @item Per drive flags and variables |
| 582 | @end itemize |
| 583 | |
| 584 | |
| 585 | @menu |
| 586 | * configuration file location:: Where mtools looks for its configuration files |
| 587 | * general syntax:: The layout of the configuration files |
| 588 | * default values:: Why you don't need a configuration file in most cases |
| 589 | * global variables:: Variables that are independent of the drive |
| 590 | * per drive variables:: Variables that are specific to a given drive |
| 591 | * parsing order:: Location of configuration files and parsing order |
| 592 | * old style configuration:: Backwards compatibility |
| 593 | @end menu |
| 594 | |
| 595 | @node configuration file location, general syntax, Configuration, Configuration |
| 596 | @section Location of the configuration files |
| 597 | |
| 598 | @cindex Configuration file name |
| 599 | @cindex Name of configuration files |
| 600 | @cindex Location of configuration files |
| 601 | |
| 602 | @file{@value{SYSCONFDIR}mtools.conf} is the system-wide configuration file, |
| 603 | and @file{~/.mtoolsrc} is the user's private configuration file. |
| 604 | |
| 605 | On some systems, the system-wide configuration file is called |
| 606 | @file{/etc/default/mtools.conf} instead. |
| 607 | |
| 608 | |
| 609 | @node general syntax, default values, configuration file location, Configuration |
| 610 | @subsection General configuration file syntax |
| 611 | @cindex Syntax of the configuration file |
| 612 | @cindex Configuration file syntax |
| 613 | |
| 614 | The configuration files is made up of sections. Each section starts |
| 615 | with a keyword identifying the section followed by a colon. |
| 616 | Then follow variable assignments and flags. Variable assignments take |
| 617 | the following form: |
| 618 | @display |
| 619 | name=value |
| 620 | @end display |
| 621 | Flags are lone keywords without an equal sign and value following |
| 622 | them. A section either ends at the end of the file or where the next |
| 623 | section begins. |
| 624 | |
| 625 | Lines starting with a hash (@code{#}) are comments. Newline characters |
| 626 | are equivalent to whitespace (except where ending a comment). The |
| 627 | configuration file is case insensitive, except for item enclosed in |
| 628 | quotes (such as filenames). |
| 629 | |
| 630 | @node default values, global variables, general syntax, Configuration |
| 631 | @section Default values |
| 632 | @cindex Default values |
| 633 | @cindex Default configuration |
| 634 | @cindex Configuration file |
| 635 | For most platforms, mtools contains reasonable compiled-in defaults for |
| 636 | physical floppy drives. Thus, you usually don't need to bother with the |
| 637 | configuration file, if all you want to do with mtools is to access your |
| 638 | floppy drives. On the other hand, the configuration file is needed if |
| 639 | you also want to use mtools to access your hard disk partitions and |
| 640 | DOSEMU image files. |
| 641 | |
| 642 | @node global variables, per drive variables, default values, Configuration |
| 643 | @section Global variables |
| 644 | @cindex Global configuration variables |
| 645 | @cindex Drive independent configuration variables |
| 646 | @cindex Environmental variables |
| 647 | @vindex MTOOLS_SKIP_CHECK |
| 648 | @vindex MTOOLS_FAT_COMPATIBILITY |
| 649 | @vindex MTOOLS_LOWER_CASE |
| 650 | @vindex MTOOLS_NO_VFAT |
| 651 | @vindex MTOOLS_DOTTED_DIR |
| 652 | @vindex MTOOLS_NAME_NUMERIC_TAIL |
| 653 | @vindex MTOOLS_TWENTY_FOUR_HOUR_CLOCK |
| 654 | @vindex MTOOLS_LOCK_TIMEOUT |
| 655 | @cindex FreeDOS |
| 656 | |
| 657 | Global flags may be set to 1 or to 0. |
| 658 | |
| 659 | The following global flags are recognized: |
| 660 | |
| 661 | @table @code |
| 662 | @item MTOOLS_SKIP_CHECK |
| 663 | If this is set to 1, mtools skips most of its sanity checks. This is |
| 664 | needed to read some Atari disks which have been made with the earlier |
| 665 | ROMs, and which would not be recognized otherwise. |
| 666 | @item MTOOLS_FAT_COMPATIBILITY |
| 667 | If this is set to 1, mtools skips the fat size checks. Some disks have |
| 668 | a bigger FAT than they really need to. These are rejected if this |
| 669 | option is not set. |
| 670 | @item MTOOLS_LOWER_CASE |
| 671 | If this is set to 1, mtools displays all-upper-case short filenames as |
| 672 | lowercase. This has been done to allow a behavior which is consistent |
| 673 | with older versions of mtools which didn't know about the case bits. |
| 674 | @item MTOOLS_NO_VFAT |
| 675 | If this is set to 1, mtools won't generate VFAT entries for filenames |
| 676 | which are mixed-case, but otherwise legal dos filenames. This is useful |
| 677 | when working with DOS versions which can't grok VFAT long names, such as |
| 678 | FreeDOS. |
| 679 | @item MTOOLS_DOTTED_DIR |
| 680 | In a wide directory, prints the short name with a dot instead of spaces |
| 681 | separating the basename and the extension. |
| 682 | @item MTOOLS_NAME_NUMERIC_TAIL |
| 683 | If this is set to one (default), generate numeric tails for all long |
| 684 | names (~1). If set to zero, only generate numeric tails if otherwise a |
| 685 | clash would have happened. |
| 686 | @item MTOOLS_TWENTY_FOUR_HOUR_CLOCK |
| 687 | If 1, uses the European notation for times (twenty four hour clock), |
| 688 | else uses the UK/US notation (am/pm) |
| 689 | @item MTOOLS_LOCK_TIMEOUT |
| 690 | How long, in seconds, to wait for a locked device to become free. |
| 691 | Defaults to 30. |
| 692 | @end table |
| 693 | |
| 694 | Example: |
| 695 | Inserting the following line into your configuration file instructs |
| 696 | mtools to skip the sanity checks: |
| 697 | @example |
| 698 | MTOOLS_SKIP_CHECK=1 |
| 699 | @end example |
| 700 | |
| 701 | Global variables may also be set via the environment: |
| 702 | @example |
| 703 | export MTOOLS_SKIP_CHECK=1 |
| 704 | @end example |
| 705 | |
| 706 | Global string variables may be set to any value: |
| 707 | @table @code |
| 708 | @item MTOOLS_DATE_STRING |
| 709 | The format used for printing dates of files. By default, is dd-mm-yyyy. |
| 710 | @end table |
| 711 | |
| 712 | @node per drive variables, parsing order, global variables, Configuration |
| 713 | @section Per drive flags and variables |
| 714 | @cindex Drive description |
| 715 | @cindex Drive configuration |
| 716 | |
| 717 | @menu |
| 718 | * general information:: What a drive description looks like |
| 719 | * location information:: Where is the drive data physically stored |
| 720 | * geometry description:: Describes the physical characteristics of |
| 721 | the media |
| 722 | * open flags:: Flags passed to the open system call when the |
| 723 | device is opened |
| 724 | * miscellaneous variables:: Variables which don't fit in either category |
| 725 | * miscellaneous flags:: Switch variables, which can be enabled or disabled |
| 726 | * multiple descriptions:: How to supply several descriptions for a |
| 727 | drive, to be tried one after the other. |
| 728 | @end menu |
| 729 | |
| 730 | @node general information, location information, per drive variables, per drive variables |
| 731 | @subsection General information |
| 732 | @cindex Drive description, example |
| 733 | @cindex Drive configuration, example |
| 734 | @vindex drive |
| 735 | |
| 736 | Per drive flags and values may be described in a drive section. A |
| 737 | drive section starts with |
| 738 | @code{drive} "@var{driveletter}" : |
| 739 | |
| 740 | Then follow variable-value pairs and flags. |
| 741 | |
| 742 | This is a sample drive description: |
| 743 | @example |
| 744 | drive a: |
| 745 | file="/dev/fd0" use_xdf=1 |
| 746 | @end example |
| 747 | |
| 748 | @node location information, geometry description, general information, per drive variables |
| 749 | @subsection Location information |
| 750 | @cindex Hdimage |
| 751 | |
| 752 | For each drive, you need to describe where its data is physically |
| 753 | stored (image file, physical device, partition, offset). |
| 754 | |
| 755 | @table @code |
| 756 | @item file |
| 757 | @cindex Image file |
| 758 | @cindex Name of device node |
| 759 | @cindex File name of device node |
| 760 | @vindex file |
| 761 | The name of the file or device holding the disk image. This is |
| 762 | mandatory. The file name should be enclosed in quotes. |
| 763 | |
| 764 | @item partition |
| 765 | @cindex DOSEMU hard disk image |
| 766 | @cindex Zip disks (partitions) |
| 767 | @cindex Jaz disks (partitions) |
| 768 | @cindex Syquest disks |
| 769 | @cindex Magneto-optical disks |
| 770 | @cindex OS/2 (layout of removable media) |
| 771 | @cindex Windows NT (layout of removable media) |
| 772 | @cindex Removable media |
| 773 | @cindex Partitioned image file |
| 774 | Tells mtools to treat the drive as a partitioned device, and to use the |
| 775 | given partition. Only primary partitions are accessible using this |
| 776 | method, and they are numbered from 1 to 4. For logical partitions, use |
| 777 | the more general @code{offset} variable. The @code{partition} variable |
| 778 | is intended for removable media such as Syquest disks, ZIP drives, and |
| 779 | magneto-optical disks. Although traditional DOS sees Syquest disks and |
| 780 | magneto-optical disks as @samp{giant floppy disks} which are |
| 781 | unpartitioned, OS/2 and Windows NT treat them like hard disks, |
| 782 | i.e. partitioned devices. The @code{partition} flag is also useful DOSEMU |
| 783 | hdimages. It is not recommended for hard disks for which direct access |
| 784 | to partitions is available through mounting. |
| 785 | |
| 786 | @item offset |
| 787 | @cindex Ram disk |
| 788 | @cindex Atari Ram disk |
| 789 | Describes where in the file the MS-DOS file system starts. This is useful |
| 790 | for logical partitions in DOSEMU hdimages, and for ATARI ram disks. By |
| 791 | default, this is zero, meaning that the file system starts right at the |
| 792 | beginning of the device or file. |
| 793 | @end table |
| 794 | |
| 795 | @node geometry description, open flags, location information, per drive variables |
| 796 | @subsection Disk Geometry Configuration |
| 797 | @cindex Disk Geometry |
| 798 | @cindex Configuration of disk geometry |
| 799 | @cindex Description of disk geometry |
| 800 | @cindex Format of disk |
| 801 | @cindex High density disk |
| 802 | @cindex Low density disk |
| 803 | @pindex mformat (geometry used for) |
| 804 | |
| 805 | Geometry information describes the physical characteristics about the |
| 806 | disk. Its has three purposes: |
| 807 | |
| 808 | @table @asis |
| 809 | @item formatting |
| 810 | The geometry information is written into the boot sector of the newly |
| 811 | made disk. However, you may also describe the geometry information on |
| 812 | the command line. @xref{mformat}, for details. |
| 813 | @item filtering |
| 814 | On some Unixes there are device nodes which only support one physical |
| 815 | geometry. For instance, you might need a different node to access a disk |
| 816 | as high density or as low density. The geometry is compared to the |
| 817 | actual geometry stored on the boot sector to make sure that this device |
| 818 | node is able to correctly read the disk. If the geometry doesn't match, |
| 819 | this drive entry fails, and the next drive entry bearing the same drive |
| 820 | letter is tried. @xref{multiple descriptions}, for more details on |
| 821 | supplying several descriptions for one drive letter. |
| 822 | |
| 823 | If no geometry information is supplied in the configuration file, all |
| 824 | disks are accepted. On Linux (and on SPARC) there exist device nodes |
| 825 | with configurable geometry (@file{/dev/fd0}, @file{/dev/fd1} etc), |
| 826 | and thus filtering is not needed (and ignored) for disk drives. (Mtools |
| 827 | still does do filtering on plain files (disk images) in Linux: this is |
| 828 | mainly intended for test purposes, as I don't have access to a Unix |
| 829 | which would actually need filtering). |
| 830 | |
| 831 | If you do not need filtering, but want still a default geometry for |
| 832 | mformatting, you may switch off filtering using the @code{mformat_only} |
| 833 | flag. |
| 834 | |
| 835 | If you want filtering, you should supply the @code{filter} flag. If you |
| 836 | supply a geometry, you must supply one of both flags. |
| 837 | |
| 838 | @item initial geometry |
| 839 | On devices that support it (usually floppy devices), the geometry |
| 840 | information is also used to set the initial geometry. This initial |
| 841 | geometry is applied while reading the boot sector, which contains the |
| 842 | real geometry. If no geometry information is supplied in the |
| 843 | configuration file, or if the @code{mformat_only} flag is supplied, no |
| 844 | initial configuration is done. |
| 845 | |
| 846 | On Linux, initial geometry is not really needed, as the configurable |
| 847 | devices are able to auto-detect the disk type accurately enough (for |
| 848 | most common formats) to read the boot sector. |
| 849 | @end table |
| 850 | |
| 851 | Wrong geometry information may lead to very bizarre errors. That's why I |
| 852 | strongly recommend that you add the @code{mformat_only} flag to your |
| 853 | drive description, unless you really need filtering or initial geometry. |
| 854 | |
| 855 | The following geometry related variables are available: |
| 856 | |
| 857 | @table @code |
| 858 | @item cylinders |
| 859 | @itemx tracks |
| 860 | @vindex cylinders |
| 861 | @vindex tracks |
| 862 | The number of cylinders. (@code{cylinders} is the preferred form, |
| 863 | @code{tracks} is considered obsolete) |
| 864 | @item heads |
| 865 | @vindex heads |
| 866 | The number of heads (sides). |
| 867 | @item sectors |
| 868 | @vindex sectors |
| 869 | The number of sectors per track. |
| 870 | @end table |
| 871 | |
| 872 | Example: the following drive section describes a 1.44M drive: |
| 873 | |
| 874 | @example |
| 875 | drive a: |
| 876 | file="/dev/fd0H1440" |
| 877 | fat_bits=12 |
| 878 | cylinders=80 heads=2 sectors=18 |
| 879 | mformat_only |
| 880 | @end example |
| 881 | |
| 882 | The following shorthand geometry descriptions are available: |
| 883 | |
| 884 | @table @code |
| 885 | @item 1.44m |
| 886 | high density 3 1/2 disk. Equivalent to: |
| 887 | @code{fat_bits=12 cylinders=80 heads=2 sectors=18} |
| 888 | @item 1.2m |
| 889 | high density 5 1/4 disk. Equivalent to: |
| 890 | @code{fat_bits=12 cylinders=80 heads=2 sectors=15} |
| 891 | @item 720k |
| 892 | double density 3 1/2 disk. Equivalent to: |
| 893 | @code{fat_bits=12 cylinders=80 heads=2 sectors=9} |
| 894 | @item 360k |
| 895 | double density 5 1/4 disk. Equivalent to: |
| 896 | @code{fat_bits=12 cylinders=40 heads=2 sectors=9} |
| 897 | @end table |
| 898 | |
| 899 | The shorthand format descriptions may be amended. For example, |
| 900 | @code{360k sectors=8} |
| 901 | describes a 320k disk and is equivalent to: |
| 902 | @code{fat_bits=12 cylinders=40 heads=2 sectors=8} |
| 903 | |
| 904 | @node open flags, miscellaneous variables, geometry description, per drive variables |
| 905 | @subsection Open Flags |
| 906 | @vindex sync |
| 907 | @vindex nodelay |
| 908 | @vindex exclusive |
| 909 | @cindex open flags |
| 910 | @cindex synchronous writing |
| 911 | @cindex exclusive access to a drive |
| 912 | |
| 913 | Moreover, the following flags are available: |
| 914 | |
| 915 | @table @code |
| 916 | @item sync |
| 917 | All i/o operations are done synchronously |
| 918 | @item nodelay |
| 919 | The device or file is opened with the O_NDELAY flag. This is needed on |
| 920 | some non-Linux architectures. |
| 921 | @item exclusive |
| 922 | The device or file is opened with the O_EXCL flag. On Linux, this |
| 923 | ensures exclusive access to the floppy drive. On most other |
| 924 | architectures, and for plain files it has no effect at all. |
| 925 | @end table |
| 926 | |
| 927 | |
| 928 | @node miscellaneous variables, miscellaneous flags, open flags, per drive variables |
| 929 | @subsection General Purpose Drive Variables |
| 930 | |
| 931 | The following general purpose drive variables are available. Depending |
| 932 | to their type, these variables can be set to a string (precmd) or |
| 933 | an integer (all others) |
| 934 | |
| 935 | @table @code |
| 936 | @item fat_bits |
| 937 | @vindex fat_bits |
| 938 | The number of FAT bits. This may be 12 or 16. This is very rarely |
| 939 | needed, as it can almost always be deduced from information in the |
| 940 | boot sector. On the contrary, describing the number of fat bits may |
| 941 | actually be harmful if you get it wrong. You should only use it if |
| 942 | mtools gets the auto-detected number of fat bits wrong, or if you want |
| 943 | to mformat a disk with a weird number of fat bits. |
| 944 | @item codepage |
| 945 | Describes the DOS code page used for short filenames. This is a number |
| 946 | between 1 and 999. By default, code page 850 is used. The reason for |
| 947 | this is because this code page contains most of the characters that are |
| 948 | also available in ISO-Latin-1. You may also specify a global code page |
| 949 | for all drives by using the global @code{default_codepage} parameter |
| 950 | (outside of any drive description). This parameters exists starting at |
| 951 | version 4.0.0 |
Yi Kong | 39bbd96 | 2022-01-09 19:41:38 +0800 | [diff] [blame^] | 952 | |
| 953 | @item data_map |
| 954 | Remaps data from image file. This is useful for image files which |
| 955 | might need additional zero-filled sectors to be inserted. Such is the |
| 956 | case for instance for IBM 3174 floppy images. These images represent |
| 957 | floppy disks with fewer sectors on their first cylinder. These missing |
| 958 | sectors are not stored in the image, but are still counted in the |
| 959 | filesystem layout. The data_map allows to fake these missing sectors |
| 960 | for the upper layers of mtools. A data_map is a comma-separated |
| 961 | sequence of source type and size. Source type may be @code{zero} for |
| 962 | zero-filled sectors created by map, @code{skip} for data in raw image |
| 963 | to be ignored (skipped), and nothing for data to be used as is |
| 964 | (copied) from the raw image. Datamap is automatically complemented by |
| 965 | an implicit last element of data to be used as is from current offset |
| 966 | to end of file. Each size is a number followed by a unit: @code{s} for |
| 967 | a 512 byte sector, @code{K} for Kbytes, @code{M} for megabytes, |
| 968 | @code{G} for gigabytes, and nothing for single bytes. |
| 969 | |
| 970 | Example: |
| 971 | |
| 972 | @code{data_map=1s,zero31s,28s,skip1s} would be a map for use with IBM |
| 973 | 3174 floppy images. First sector (@code{1s}, boot sector) is used as |
| 974 | is. Then follow 31 fake zero-filled sectors (@code{zero31s}), then the |
| 975 | next 28 sectors from image (@code{28s}) are used as is (they contain |
| 976 | FAT and root directory), then one sector from image is skipped |
| 977 | (@code{skip1s}), and finally the rest of image is used as is |
| 978 | (implicit) |
| 979 | |
| 980 | |
Alistair Delva | beaee83 | 2021-02-24 11:27:23 -0800 | [diff] [blame] | 981 | @item precmd |
| 982 | @cindex Solaris (volcheck) |
| 983 | @cindex Executing commands before opening the device |
| 984 | On some variants of Solaris, it is necessary to call 'volcheck -v' |
| 985 | before opening a floppy device, in order for the system to notice that |
| 986 | there is indeed a disk in the drive. @code{precmd="volcheck -v"} in the |
| 987 | drive clause establishes the desired behavior. |
| 988 | |
| 989 | @item blocksize |
| 990 | @cindex raw device |
| 991 | @cindex character devices |
| 992 | @cindex blocksize |
| 993 | This parameter represents a default block size to be always used on this |
| 994 | device. All I/O is done with multiples of this block size, |
| 995 | independently of the sector size registered in the file system's boot |
| 996 | sector. This is useful for character devices whose sector size is not |
| 997 | 512, such as for example CD-ROM drives on Solaris. |
| 998 | |
| 999 | @end table |
| 1000 | |
| 1001 | Only the @code{file} variable is mandatory. The other parameters may |
| 1002 | be left out. In that case a default value or an auto-detected value is |
| 1003 | used. |
| 1004 | |
| 1005 | |
| 1006 | |
| 1007 | @node miscellaneous flags, multiple descriptions, miscellaneous variables, per drive variables |
| 1008 | @subsection General Purpose Drive Flags |
| 1009 | |
| 1010 | A flag can either be set to 1 (enabled) or 0 (disabled). If the value is |
| 1011 | omitted, it is enabled. For example, @code{scsi} is equivalent to |
| 1012 | @code{scsi=1} |
| 1013 | |
| 1014 | @table @code |
| 1015 | @item nolock |
| 1016 | @cindex disable locking |
| 1017 | @cindex locking (disabling it) |
| 1018 | @cindex plain floppy: device xxx busy |
| 1019 | Instruct mtools to not use locking on this drive. This is needed on |
| 1020 | systems with buggy locking semantics. However, enabling this makes |
| 1021 | operation less safe in cases where several users may access the same |
| 1022 | drive at the same time. |
| 1023 | |
| 1024 | @item scsi |
| 1025 | @cindex setuid installation (needed for raw SCSI I/O) |
| 1026 | @cindex Solaris (Raw access to SCSI devices such as Zip & Jaz) |
| 1027 | @cindex SunOS (Raw access to SCSI devices such as Zip & Jaz) |
| 1028 | @cindex Zip disks (raw SCSI access) |
| 1029 | @cindex Jaz disks (raw SCSI access) |
| 1030 | @cindex Syquest disks (raw SCSI access) |
| 1031 | @cindex SCSI devices |
| 1032 | When set to 1, this option tells mtools to use raw SCSI I/O instead of |
| 1033 | the standard read/write calls to access the device. Currently, this is |
| 1034 | supported on HP-UX, Solaris and SunOS. This is needed because on some |
| 1035 | architectures, such as SunOS or Solaris, PC media can't be accessed |
| 1036 | using the @code{read} and @code{write} system calls, because the OS expects |
| 1037 | them to contain a Sun specific "disk label". |
| 1038 | |
| 1039 | As raw SCSI access always uses the whole device, you need to specify the |
| 1040 | "partition" flag in addition |
| 1041 | |
| 1042 | On some architectures, such as Solaris, mtools needs root privileges to |
| 1043 | be able to use the @code{scsi} option. Thus mtools should be installed |
| 1044 | setuid root on Solaris if you want to access Zip/Jaz drives. Thus, if |
| 1045 | the @code{scsi} flag is given, @code{privileged} is automatically |
| 1046 | implied, unless explicitly disabled by @code{privileged=0} |
| 1047 | |
| 1048 | Mtools uses its root privileges to open the device, and to issue the |
| 1049 | actual SCSI I/O calls. Moreover, root privileges are only used for |
| 1050 | drives described in a system-wide configuration file such as |
| 1051 | @file{@value{SYSCONFDIR}mtools.conf}, and not for those described in |
| 1052 | @file{~/.mtoolsrc} or @file{$MTOOLSRC}. |
| 1053 | |
| 1054 | @item privileged |
| 1055 | @cindex setuid installation |
| 1056 | @cindex setgid installation |
| 1057 | When set to 1, this instructs mtools to use its setuid and setgid |
| 1058 | privileges for opening the given drive. This option is only valid for |
| 1059 | drives described in the system-wide configuration files (such as |
| 1060 | @file{@value{SYSCONFDIR}mtools.conf}, not @file{~/.mtoolsrc} or |
| 1061 | @file{$MTOOLSRC}). Obviously, this option is also a no op if mtools is |
| 1062 | not installed setuid or setgid. This option is implied by 'scsi=1', but |
| 1063 | again only for drives defined in system-wide configuration files. |
| 1064 | Privileged may also be set explicitly to 0, in order to tell mtools not |
| 1065 | to use its privileges for a given drive even if @code{scsi=1} is set. |
| 1066 | |
| 1067 | Mtools only needs to be installed setuid if you use the |
| 1068 | @code{privileged} or @code{scsi} drive variables. If you do not use |
| 1069 | these options, mtools works perfectly well even when not installed |
| 1070 | setuid root. |
| 1071 | |
| 1072 | @item vold |
| 1073 | @cindex Solaris (vold) |
| 1074 | @cindex Vold (mediamgr) |
| 1075 | |
| 1076 | Instructs mtools to interpret the device name as a vold identifier |
| 1077 | rather than as a filename. The vold identifier is translated into a |
| 1078 | real filename using the @code{media_findname()} and |
| 1079 | @code{media_oldaliases()} functions of the @code{volmgt} library. This |
| 1080 | flag is only available if you configured mtools with the |
| 1081 | @code{--enable-new-vold} option before compilation. |
| 1082 | |
| 1083 | @item swap |
| 1084 | @cindex Atari |
| 1085 | @cindex Wordswapped |
| 1086 | |
| 1087 | Consider the media as a word-swapped Atari disk. |
| 1088 | |
| 1089 | @item use_xdf |
| 1090 | @cindex XDF disks (how to configure) |
| 1091 | @vindex use_xdf |
| 1092 | If this is set to a non-zero value, mtools also tries to access this |
| 1093 | disk as an XDF disk. XDF is a high capacity format used by OS/2. This |
| 1094 | is off by default. @xref{XDF}, for more details. |
| 1095 | @item mformat_only |
| 1096 | @vindex mformat_only |
| 1097 | Tells mtools to use the geometry for this drive only for mformatting and |
| 1098 | not for filtering. |
| 1099 | |
| 1100 | @item filter |
| 1101 | @vindex filter |
| 1102 | Tells mtools to use the geometry for this drive both for mformatting and |
| 1103 | filtering. |
| 1104 | |
| 1105 | @item remote |
| 1106 | Tells mtools to connect to floppyd (@pxref{floppyd}). |
| 1107 | @end table |
| 1108 | |
| 1109 | |
| 1110 | @node multiple descriptions, , miscellaneous flags, per drive variables |
| 1111 | @subsection Supplying multiple descriptions for a drive |
| 1112 | |
| 1113 | It is possible to supply multiple descriptions for a drive. In that |
| 1114 | case, the descriptions are tried in order until one is found that |
| 1115 | fits. Descriptions may fail for several reasons: |
| 1116 | |
| 1117 | @enumerate |
| 1118 | @item |
| 1119 | because the geometry is not appropriate, |
| 1120 | @item |
| 1121 | because there is no disk in the drive, |
| 1122 | @item |
| 1123 | or because of other problems. |
| 1124 | @end enumerate |
| 1125 | |
| 1126 | Multiple definitions are useful when using physical devices which are |
| 1127 | only able to support one single disk geometry. |
| 1128 | Example: |
| 1129 | @example |
| 1130 | drive a: file="/dev/fd0H1440" 1.44m |
| 1131 | drive a: file="/dev/fd0H720" 720k |
| 1132 | @end example |
| 1133 | |
| 1134 | This instructs mtools to use /dev/fd0H1440 for 1.44m (high density) |
| 1135 | disks and /dev/fd0H720 for 720k (double density) disks. On Linux, this |
| 1136 | feature is not really needed, as the /dev/fd0 device is able to handle |
| 1137 | any geometry. |
| 1138 | |
| 1139 | You may also use multiple drive descriptions to access both of your |
| 1140 | physical drives through one drive letter: |
| 1141 | |
| 1142 | @example |
| 1143 | drive z: file="/dev/fd0" |
| 1144 | drive z: file="/dev/fd1" |
| 1145 | @end example |
| 1146 | |
| 1147 | With this description, @code{mdir z:} accesses your first physical |
| 1148 | drive if it contains a disk. If the first drive doesn't contain a disk, |
| 1149 | mtools checks the second drive. |
| 1150 | |
| 1151 | When using multiple configuration files, drive descriptions in the files |
| 1152 | parsed last override descriptions for the same drive in earlier |
| 1153 | files. In order to avoid this, use the @code{drive+} or @code{+drive} |
| 1154 | keywords instead of @code{drive}. The first adds a description to the |
| 1155 | end of the list (i.e. it will be tried last), and the first adds it to |
| 1156 | the start of the list. |
| 1157 | |
| 1158 | @node parsing order, old style configuration, per drive variables, Configuration |
| 1159 | @section Location of configuration files and parsing order |
| 1160 | @cindex Parsing order |
| 1161 | @cindex Configuration file parsing order |
| 1162 | @cindex Configuration file name (parsing order) |
| 1163 | @cindex Name of configuration files (parsing order) |
| 1164 | @cindex Location of configuration files (parsing order) |
| 1165 | |
| 1166 | The configuration files are parsed in the following order: |
| 1167 | @enumerate |
| 1168 | @item |
| 1169 | compiled-in defaults |
| 1170 | @item |
| 1171 | @file{@value{SYSCONFDIR}mtools.conf} |
| 1172 | @item |
| 1173 | @file{~/.mtoolsrc}. |
| 1174 | @item |
| 1175 | @file{$MTOOLSRC} (file pointed by the @code{MTOOLSRC} environmental |
| 1176 | variable) |
| 1177 | @end enumerate |
| 1178 | |
| 1179 | Options described in the later files override those described in the |
| 1180 | earlier files. Drives defined in earlier files persist if they are not |
| 1181 | overridden in the later files. For instance, drives A and B may be |
| 1182 | defined in @file{@value{SYSCONFDIR}mtools.conf} and drives C and D may be |
| 1183 | defined in @file{~/.mtoolsrc} However, if @file{~/.mtoolsrc} also |
| 1184 | defines drive A, this new description would override the description of |
| 1185 | drive A in @file{@value{SYSCONFDIR}mtools.conf} instead of adding to it. If |
| 1186 | you want to add a new description to a drive already described in an |
| 1187 | earlier file, you need to use either the @code{+drive} or @code{drive+} |
| 1188 | keyword. |
| 1189 | |
| 1190 | @node old style configuration, , parsing order, Configuration |
| 1191 | @section Backwards compatibility with old configuration file syntax |
| 1192 | @cindex Backwards compatibility |
| 1193 | @cindex Old configuration file syntax |
| 1194 | @cindex Configuration file, old syntax |
| 1195 | |
| 1196 | The syntax described herein is new for version @code{mtools-3.0}. The |
| 1197 | old line-oriented syntax is still supported. Each line beginning with a |
| 1198 | single letter is considered to be a drive description using the old |
| 1199 | syntax. Old style and new style drive sections may be mixed within the |
| 1200 | same configuration file, in order to make upgrading easier. Support for |
| 1201 | the old syntax will be phased out eventually, and in order to discourage |
| 1202 | its use, I purposefully omit its description here. |
| 1203 | |
| 1204 | @comment MANskip 5 |
| 1205 | |
| 1206 | @node Commands, Compiling mtools, Configuration, Top |
| 1207 | @chapter Command list |
| 1208 | @cindex Command list |
| 1209 | @cindex List of available commands |
| 1210 | |
| 1211 | This section describes the available mtools commands, and the command |
| 1212 | line parameters that each of them accepts. Options which are common to |
| 1213 | all mtools commands are not described here, @ref{arguments} for a |
| 1214 | description of those. |
| 1215 | |
| 1216 | @menu |
| 1217 | * floppyd:: floppy daemon to run on your X server box |
| 1218 | * floppyd_installtest:: small utility to check for the presence of floppyd |
| 1219 | * mattrib:: change MS-DOS file attribute flags |
| 1220 | * mbadblocks:: tests a floppy disk, and marks the bad blocks in the FAT |
| 1221 | * mcat:: same as cat. Only useful with floppyd. |
| 1222 | * mcd:: change MS-DOS directory |
Alistair Delva | beaee83 | 2021-02-24 11:27:23 -0800 | [diff] [blame] | 1223 | * mcopy:: copy MS-DOS files to/from Unix |
| 1224 | * mdel:: delete an MS-DOS file |
| 1225 | * mdeltree:: recursively delete an MS-DOS directory |
| 1226 | * mdir:: display an MS-DOS directory |
| 1227 | * mdu:: list space occupied by directory and its contents |
| 1228 | * mformat:: add an MS-DOS file system to a low-level formatted floppy disk |
| 1229 | * minfo:: get information about an MS-DOS file system. |
| 1230 | * mlabel:: make an MS-DOS volume label |
| 1231 | * mkmanifest:: makes a list of short name equivalents |
| 1232 | * mmd:: make an MS-DOS subdirectory |
| 1233 | * mmount:: mount an MS-DOS disk |
| 1234 | * mpartition:: create an MS-DOS as a partition |
| 1235 | * mrd:: remove an MS-DOS subdirectory |
| 1236 | * mmove:: move or rename an MS-DOS file or subdirectory |
| 1237 | * mren:: rename an existing MS-DOS file |
| 1238 | * mshortname:: shows the short name of a file |
| 1239 | * mshowfat:: shows the FAT map of a file |
| 1240 | * mtoolstest:: tests and displays the configuration |
| 1241 | * mtype:: display contents of an MS-DOS file |
| 1242 | * mzip:: zip disk specific commands |
| 1243 | @end menu |
| 1244 | |
| 1245 | @node floppyd, floppyd_installtest, Commands, Commands |
| 1246 | @section Floppyd |
| 1247 | @pindex floppyd |
| 1248 | @cindex X terminal |
| 1249 | @cindex remote floppy access |
| 1250 | |
| 1251 | @code{Floppyd} is used as a server to grant access to the floppy drive |
| 1252 | to clients running on a remote machine, just as an X server grants |
| 1253 | access to the display to remote clients. It has the following syntax: |
| 1254 | |
| 1255 | @code{floppyd} [@code{-d}] [@code{-l}] [@code{-s} @var{port}] [@code{-r} |
| 1256 | @var{user}] [@code{-b} @var{ipaddr}] [@code{-x} @var{display}] @var{devicenames} |
| 1257 | |
| 1258 | |
| 1259 | @code{floppyd} is always associated with an X server. It runs on the |
| 1260 | same machine as its X server, and listens on port 5703 and above. |
| 1261 | |
| 1262 | @subsection Authentication |
| 1263 | |
| 1264 | @code{floppyd} authenticates remote clients using the @code{Xauthority} |
| 1265 | protocol. Xhost authentication is not supported. Each floppyd is |
| 1266 | associated with an X server. When a remote client attempts to connect |
| 1267 | to floppyd, it sends floppyd the X authority record corresponding to |
| 1268 | floppyd's X server. Floppyd in turn then tries to open up a connection |
| 1269 | to the X server in order to verify the authenticity of the xauth record. |
| 1270 | If the connection to the X server succeeds, the client is granted |
| 1271 | access. |
| 1272 | @code{DISPLAY}. |
| 1273 | |
| 1274 | @strong{Caution}: In order to make authentication work correctly, the |
| 1275 | local host should @strong{not} be listed in the @code{xhost} list of |
| 1276 | allowed hosts. |
| 1277 | Indeed, hosts listed in @code{xhost} do not need a correct |
| 1278 | @code{Xauthority} cookie to connect to the X server. As @code{floppyd} |
| 1279 | runs on the same host as the X server, all its probe connection would |
| 1280 | succeed even for clients who supplied a bad cookie. This means that |
| 1281 | your floppy drive would be open to the world, i.e. a huge security hole. |
| 1282 | If your X server does not allow you to remove @code{localhost:0} and |
| 1283 | @code{:0} from the @code{xhost} list, you can prevent floppyd from |
| 1284 | probing those display names with the @code{-l} option. |
| 1285 | |
| 1286 | @subsection Command line options |
| 1287 | |
| 1288 | @table @code |
| 1289 | @item d |
| 1290 | Daemon mode. Floppyd runs its own server loop. Do not supply this if |
| 1291 | you start floppyd from @code{inetd.conf} |
| 1292 | @item s @var{port} |
| 1293 | Port number for daemon mode. Default is 5703 + @var{displaynumber}. |
| 1294 | This flag implies daemon mode. For example, for display |
| 1295 | @code{hitchhiker:5}, the port would be 5708. |
| 1296 | @item b @var{ipaddr} |
| 1297 | Bind address (for multi homed hosts). This flag implies daemon mode |
| 1298 | @item r @var{user} |
| 1299 | Run the server under as the given user |
| 1300 | @item x @var{display} |
| 1301 | X display to use for authentication. By default, this is taken from the |
| 1302 | @code{DISPLAY} variable. If neither the @code{x} attribute is present |
| 1303 | nor @code{DISPLAY} is set, floppyd uses @code{:0.0}. |
| 1304 | @end table |
| 1305 | |
| 1306 | @var{devicenames} is a list of device nodes to be opened. Default |
| 1307 | is @code{/dev/fd0}. Multiple devices are only supported on mtools |
| 1308 | versions newer than 3.9.11. |
| 1309 | |
| 1310 | |
| 1311 | @subsection Connecting to floppyd |
| 1312 | |
| 1313 | In order to use floppyd, add the flag @code{remote} to the device |
| 1314 | description in your @file{~/.mtoolsrc} file. If the flag @code{remote} |
| 1315 | is given, the @code{file} parameter of the device description is taken |
| 1316 | to be a remote address. It's format is the following: |
| 1317 | @var{hostname}@code{:}@var{displaynumber}[@code{/}[@var{baseport}][@code{/}@var{drive}]]. When |
| 1318 | using this entry, mtools connects to port |
| 1319 | @var{baseport}+@var{displaynumber} at @var{hostname}. By default |
| 1320 | @var{baseport} is 5703. The drive parameter is to distinguish among |
| 1321 | multiple drives associated with a single display (only mtools versions |
| 1322 | more recent than 3.9.11) |
| 1323 | |
| 1324 | @subsection Examples: |
| 1325 | |
| 1326 | The following starts a floppy daemon giving access to @file{/dev/fd0}, |
| 1327 | listening on the default port 5703, tied to the default X servers: |
| 1328 | |
| 1329 | @example |
| 1330 | floppyd -d /dev/fd0 |
| 1331 | @end example |
| 1332 | |
| 1333 | Each of the following starts a floppy daemon giving access to |
| 1334 | @file{/dev/fd1}, tied to the :1 local X servers, and listening on port |
| 1335 | 5704. We assume that the local host is named @code{hitchhiker}. |
| 1336 | |
| 1337 | @example |
| 1338 | floppyd -d /dev/fd0 |
| 1339 | floppyd -d -x :1 -p 5704 /dev/fd0 |
| 1340 | @end example |
| 1341 | |
| 1342 | If you want to start floppyd by @code{inetd} instead of running it as a |
| 1343 | daemon, insert the following lines into @file{/etc/services}: |
| 1344 | @example |
| 1345 | # floppy daemon |
| 1346 | floppyd-0 5703/tcp # floppy daemon for X server :0 |
| 1347 | floppyd-1 5704/tcp # floppy daemon for X server :1 |
| 1348 | @end example |
| 1349 | |
| 1350 | And insert the following into @file{/etc/inetd.conf} (assuming that you |
| 1351 | have defined a user named floppy in your @file{/etc/passwd}): |
| 1352 | |
| 1353 | @example |
| 1354 | # floppy daemon |
| 1355 | floppyd-0 stream tcp wait floppy /usr/sbin/floppyd floppyd /dev/fd0 |
| 1356 | floppyd-1 stream tcp wait floppy /usr/sbin/floppyd floppyd -x :1 /dev/fd0 |
| 1357 | @end example |
| 1358 | |
| 1359 | Note that you need to supply the X display names for the second |
| 1360 | floppyd. This is because the port is opened by inetd.conf, and hence |
| 1361 | floppyd cannot know its number to interfere the display number. |
| 1362 | |
| 1363 | |
| 1364 | On the client side, insert the following into your @file{~/.mtoolsrc} |
| 1365 | to define a drive letter accessing floppy drive in your X terminal: |
| 1366 | @example |
| 1367 | drive x: file="$DISPLAY" remote |
| 1368 | @end example |
| 1369 | |
| 1370 | If your X terminal has more than one drive, you may access the |
| 1371 | additional drives as follows: |
| 1372 | @example |
| 1373 | drive y: file="$DISPLAY//1" remote |
| 1374 | drive z: file="$DISPLAY//2" remote |
| 1375 | @end example |
| 1376 | |
| 1377 | @node floppyd_installtest, mattrib, floppyd, Commands |
| 1378 | @section Floppyd_installtest |
| 1379 | @pindex floppyd_installtest |
| 1380 | @cindex X terminal |
| 1381 | @cindex remote floppy access |
| 1382 | |
| 1383 | @code{Floppyd_installtest} is used to check for the presence of a running |
| 1384 | floppyd daemon. This is useful, if you have a small front-end script to |
| 1385 | mtools, which decides whether to use floppyd or not. |
| 1386 | |
| 1387 | @code{floppyd_installtest} [@code{-f}] Connect-String |
| 1388 | |
| 1389 | If the @code{-f} option is specified, @code{floppyd_installtest} does a |
| 1390 | full X-Cookie authentication and complains if this does not work. |
| 1391 | |
| 1392 | The connect-String has the format described in the floppyd-section: |
| 1393 | @var{hostname}@code{:}@var{displaynumber}[@code{/}@var{baseport}] |
| 1394 | |
| 1395 | @node mattrib, mbadblocks, floppyd_installtest, Commands |
| 1396 | @section Mattrib |
| 1397 | @pindex mattrib |
| 1398 | @cindex Changing file attributes |
| 1399 | @cindex Hidden files |
| 1400 | @cindex Read-only files (changing the attribute) |
| 1401 | @cindex System files |
| 1402 | @cindex Archive bit |
| 1403 | |
| 1404 | @code{Mattrib} is used to change MS-DOS file attribute flags. It has the |
| 1405 | following syntax: |
| 1406 | |
| 1407 | @code{mattrib} [@code{-a|+a}] [@code{-h|+h}] [@code{-r|+r}] |
| 1408 | [@code{-s|+s}] [@code{-/}] [@code{-p}] [@code{-X}] @var{msdosfile} [ @var{msdosfiles} @dots{} ] |
| 1409 | |
| 1410 | @code{Mattrib} adds attribute flags to an MS-DOS file (with the |
| 1411 | `@code{+}' operator) or remove attribute flags (with the `@code{-}' |
| 1412 | operator). |
| 1413 | |
| 1414 | @code{Mattrib} supports the following attribute bits: |
| 1415 | |
| 1416 | @table @code |
| 1417 | @item a |
| 1418 | Archive bit. Used by some backup programs to indicate a new file. |
| 1419 | @item r |
| 1420 | Read-only bit. Used to indicate a read-only file. Files with this bit |
| 1421 | set cannot be erased by @code{DEL} nor modified. |
| 1422 | @item s |
| 1423 | System bit. Used by MS-DOS to indicate a operating system file. |
| 1424 | @item h |
| 1425 | Hidden bit. Used to make files hidden from @code{DIR}. |
| 1426 | @end table |
| 1427 | |
| 1428 | @code{Mattrib} supports the following command line flags: |
| 1429 | @table @code |
| 1430 | @item / |
| 1431 | Recursive. Recursively list the attributes of the files in the subdirectories. |
| 1432 | @item X |
| 1433 | Concise. Prints the attributes without any whitespace padding. If |
| 1434 | neither the "/" option is given, nor the @var{msdosfile} contains a |
| 1435 | wildcard, and there is only one MS-DOS file parameter on the command |
| 1436 | line, only the attribute is printed, and not the filename. This option |
| 1437 | is convenient for scripts |
| 1438 | @item p |
| 1439 | Replay mode. Outputs a series of @code{mformat} commands that will |
| 1440 | reproduce the current situation, starting from a situation as left by |
| 1441 | untarring the MS-DOS file system. Commands are only output for |
| 1442 | attribute settings that differ from the default (archive bit set for |
| 1443 | files, unset for directories). This option is intended to be used in |
| 1444 | addition to tar. The @code{readonly} attribute is not taken into |
| 1445 | account, as tar can set that one itself. |
| 1446 | @end table |
| 1447 | |
| 1448 | @node mbadblocks, mcat, mattrib, Commands |
| 1449 | @section Mbadblocks |
| 1450 | @pindex mbadblocks |
| 1451 | @cindex Marking blocks as bad |
| 1452 | @cindex Bad blocks |
| 1453 | @cindex Read errors |
| 1454 | |
| 1455 | The @code{mbadblocks} command is used to mark some clusters on an |
| 1456 | MS-DOS filesystem bad. It has the following syntax: |
| 1457 | |
| 1458 | @code{mbadblocks} [@code{-s} @var{sectorlist}|@code{-c} @var{clusterlist}|-w] @var{drive}@code{:} |
| 1459 | |
| 1460 | If no command line flags are supplied, @code{Mbadblocks} scans an |
| 1461 | MS-DOS filesystem for bad blocks by simply trying to read them and |
| 1462 | flag them if read fails. All blocks that are unused are scanned, and |
| 1463 | if detected bad are marked as such in the FAT. |
| 1464 | |
| 1465 | This command is intended to be used right after @code{mformat}. It is |
| 1466 | not intended to salvage data from bad disks. |
| 1467 | |
| 1468 | |
| 1469 | @subsection Command line options |
| 1470 | |
| 1471 | @table @code |
| 1472 | @item c @var{file} |
| 1473 | Use a list of bad clusters, rather than scanning for bad clusters |
| 1474 | itself. |
| 1475 | @item s @var{file} |
| 1476 | Use a list of bad sectors (counted from beginning of filesystem), |
| 1477 | rather than trying for bad clusters itself. |
| 1478 | @item w |
| 1479 | Write a random pattern to each cluster, then read it back and flag |
| 1480 | cluster as bad if mismatch. Only free clusters are tested in such a |
| 1481 | way, so any file data is preserved. |
| 1482 | @end table |
| 1483 | |
| 1484 | @subsection Bugs |
| 1485 | @code{Mbadblocks} should (but doesn't yet :-( ) also try to salvage bad |
| 1486 | blocks which are in use by reading them repeatedly, and then mark them |
| 1487 | bad. |
| 1488 | |
| 1489 | @node mcat, mcd, mbadblocks, Commands |
| 1490 | @section Mcat |
| 1491 | |
| 1492 | The @code{mcat} command is used to copy an entire disk image from or |
| 1493 | to the floppy device. It uses the following syntax: |
| 1494 | |
| 1495 | @code{mcat} [@code{-w}] @var{drive}@code{:} |
| 1496 | @pindex mcat |
| 1497 | @cindex Copying an entire disk image |
| 1498 | @cindex Disk image |
| 1499 | @cindex Floppyd cat |
| 1500 | |
| 1501 | @code{Mcat} performs the same task as the Unix @code{cat} command. It |
| 1502 | is included into the mtools package, since @code{cat} cannot access |
| 1503 | remote floppy devices offered by the mtools floppy daemon. |
| 1504 | Now it is possible to create boot floppies remotely. |
| 1505 | |
| 1506 | The default operation is reading. The output is written to stdout. |
| 1507 | |
| 1508 | If the @code{-w} option is specified, mcat reads a disk-image from |
| 1509 | stdin and writes it to the given device. |
| 1510 | @strong{Use this carefully!} Because of the low-level nature of this |
| 1511 | command, it will happily destroy any data written before on the |
| 1512 | disk without warning! |
| 1513 | |
Yi Kong | 39bbd96 | 2022-01-09 19:41:38 +0800 | [diff] [blame^] | 1514 | @node mcd, mcopy, mcat, Commands |
Alistair Delva | beaee83 | 2021-02-24 11:27:23 -0800 | [diff] [blame] | 1515 | @section Mcd |
| 1516 | @pindex mcd |
| 1517 | @cindex Directory (changing) |
| 1518 | @cindex Working directory |
| 1519 | @cindex Current working directory (changing the) |
| 1520 | @cindex Default directory (changing the) |
| 1521 | @cindex Mcwd file |
| 1522 | |
| 1523 | The @code{mcd} command is used to change the mtools working directory |
| 1524 | on the MS-DOS disk. It uses the following syntax: |
| 1525 | |
| 1526 | @example |
| 1527 | @code{mcd} [@var{msdosdirectory}] |
| 1528 | @end example |
| 1529 | |
| 1530 | Without arguments, @code{mcd} reports the current device and working |
| 1531 | directory. Otherwise, @code{mcd} changes the current device and current |
| 1532 | working directory relative to an MS-DOS file system. |
| 1533 | |
| 1534 | The environmental variable @code{MCWD} may be used to locate the file |
| 1535 | where the device and current working directory information is stored. |
| 1536 | The default is @file{$HOME/.mcwd}. Information in this file is ignored |
| 1537 | if the file is more than 6 hours old. |
| 1538 | |
| 1539 | @code{Mcd} returns 0 on success or 1 on failure. |
| 1540 | |
| 1541 | Unlike MS-DOS versions of @code{CD}, @code{mcd} can be used to change to |
| 1542 | another device. It may be wise to remove old @file{.mcwd} files at logout. |
| 1543 | |
Yi Kong | 39bbd96 | 2022-01-09 19:41:38 +0800 | [diff] [blame^] | 1544 | @node mcopy, mdel, mcd, Commands |
Alistair Delva | beaee83 | 2021-02-24 11:27:23 -0800 | [diff] [blame] | 1545 | @section Mcopy |
| 1546 | @pindex mcopy |
| 1547 | @cindex Reading MS-DOS files |
| 1548 | @cindex Writing MS-DOS files |
| 1549 | @cindex Copying MS-DOS files |
| 1550 | @cindex Concatenating MS-DOS files |
| 1551 | @cindex Text files |
| 1552 | @cindex CR/LF conversions |
| 1553 | |
| 1554 | The @code{mcopy} command is used to copy MS-DOS files to and from |
| 1555 | Unix. It uses the following syntax: |
| 1556 | |
| 1557 | @example |
| 1558 | @code{mcopy} [@code{-bspanvmQT}] [@code{-D} @var{clash_option}] @var{sourcefile} @var{targetfile} |
| 1559 | @code{mcopy} [@code{-bspanvmQT}] [@code{-D} @var{clash_option}] @var{sourcefile} [ @var{sourcefiles}@dots{} ] @var{targetdirectory} |
| 1560 | @code{mcopy} [@code{-tnvm}] @var{MSDOSsourcefile} |
| 1561 | @end example |
| 1562 | |
| 1563 | |
| 1564 | |
| 1565 | @code{Mcopy} copies the specified file to the named file, or copies |
| 1566 | multiple files to the named directory. The source and target can be |
| 1567 | either MS-DOS or Unix files. |
| 1568 | |
| 1569 | The use of a drive letter designation on the MS-DOS files, 'a:' for |
| 1570 | example, determines the direction of the transfer. A missing drive |
| 1571 | designation implies a Unix file whose path starts in the current |
| 1572 | directory. If a source drive letter is specified with no attached file |
| 1573 | name (e.g. @code{mcopy a: .}), all files are copied from that drive. |
| 1574 | |
| 1575 | If only a single, MS-DOS source parameter is provided (e.g. "mcopy |
| 1576 | a:foo.exe"), an implied destination of the current directory |
| 1577 | (`@code{.}') is assumed. |
| 1578 | |
| 1579 | A filename of `@code{-}' means standard input or standard output, depending |
| 1580 | on its position on the command line. |
| 1581 | |
| 1582 | @code{Mcopy} accepts the following command line options: |
| 1583 | |
| 1584 | @table @code |
| 1585 | @item t |
| 1586 | Text file transfer. Mcopy translates incoming carriage return/line |
| 1587 | feeds to line feeds when copying from MS-DOS to Unix, and vice-versa when |
| 1588 | copying from Unix to MS-DOS. |
| 1589 | @item b |
| 1590 | Batch mode. Optimized for huge recursive copies, but less secure if a |
| 1591 | crash happens during the copy. |
| 1592 | @item s |
| 1593 | Recursive copy. Also copies directories and their contents |
| 1594 | @item p |
| 1595 | Preserves the attributes of the copied files |
| 1596 | @item Q |
| 1597 | When mcopying multiple files, quits as soon as one copy fails (for |
| 1598 | example due to lacking storage space on the target disk) |
| 1599 | @item a |
| 1600 | Text (ASCII) file transfer. @code{ASCII} translates incoming carriage |
| 1601 | return/line feeds to line feeds. |
| 1602 | @item T |
| 1603 | Text (ASCII) file transfer with character set conversion. Differs from |
| 1604 | @code{-a} in the @code{ASCII} also translates incoming PC-8 characters |
| 1605 | to ISO-8859-1 equivalents as far as possible. When reading DOS files, |
| 1606 | untranslatable characters are replaced by '@code{#}'; when writing DOS files, |
| 1607 | untranslatable characters are replaced by '@code{.}'. |
| 1608 | @item n |
| 1609 | No confirmation when overwriting Unix files. @code{ASCII} doesn't |
| 1610 | warn the user when overwriting an existing Unix file. If the target |
| 1611 | file already exists, and the @code{-n} option is not in effect, |
| 1612 | @code{mcopy} asks whether to overwrite the file or to rename the new |
| 1613 | file (see @ref{name clashes}) for details). In order to switch off |
| 1614 | confirmation for DOS files, use @code{-o}. |
| 1615 | @item m |
| 1616 | Preserve the file modification time. |
| 1617 | @item v |
| 1618 | Verbose. Displays the name of each file as it is copied. |
| 1619 | @end table |
| 1620 | |
| 1621 | @subsection Bugs |
| 1622 | Unlike MS-DOS, the '+' operator (append) from MS-DOS is not |
| 1623 | supported. However, you may use @code{mtype} to produce the same effect: |
| 1624 | @example |
| 1625 | mtype a:file1 a:file2 a:file3 >unixfile |
| 1626 | mtype a:file1 a:file2 a:file3 | mcopy - a:msdosfile |
| 1627 | @end example |
| 1628 | |
| 1629 | @node mdel, mdeltree, mcopy, Commands |
| 1630 | @section Mdel |
| 1631 | @pindex mdel |
| 1632 | @cindex removing MS-DOS files |
| 1633 | @cindex erasing MS-DOS files |
| 1634 | @cindex deleting MS-DOS files |
| 1635 | |
| 1636 | The @code{mdel} command is used to delete an MS-DOS file. Its syntax |
| 1637 | is: |
| 1638 | |
| 1639 | @display |
| 1640 | @code{mdel} [@code{-v}] @var{msdosfile} [ @var{msdosfiles} @dots{} ] |
| 1641 | @end display |
| 1642 | |
| 1643 | @code{Mdel} deletes files on an MS-DOS file system. |
| 1644 | |
| 1645 | @code{Mdel} asks for verification prior to removing a read-only file. |
| 1646 | |
| 1647 | @node mdeltree, mdir, mdel, Commands |
| 1648 | @section Mdeltree |
| 1649 | @pindex mdeltree |
| 1650 | @cindex removing an MS-DOS directory recursively |
| 1651 | @cindex erasing an MS-DOS directory recursively |
| 1652 | @cindex deleting an MS-DOS directory recursively |
| 1653 | @cindex recursively removing an MS-DOS directory |
| 1654 | |
| 1655 | The @code{mdeltree} command is used to delete an MS-DOS file. Its syntax |
| 1656 | is: |
| 1657 | |
| 1658 | @display |
| 1659 | @code{mdeltree} [@code{-v}] @var{msdosdirectory} [@var{msdosdirectories}@dots{}] |
| 1660 | @end display |
| 1661 | |
| 1662 | @code{Mdeltree} removes a directory and all the files and subdirectories |
| 1663 | it contains from an MS-DOS file system. An error occurs if the directory |
| 1664 | to be removed does not exist. |
| 1665 | |
| 1666 | @node mdir, mdu, mdeltree, Commands |
| 1667 | @section Mdir |
| 1668 | @pindex mdir |
| 1669 | @cindex Read-only files (listing them) |
| 1670 | @cindex Listing a directory |
| 1671 | @cindex Directory listing |
| 1672 | |
| 1673 | The @code{mdir} command is used to display an MS-DOS directory. Its |
| 1674 | syntax is: |
| 1675 | |
| 1676 | @code{mdir} [@code{-/}] [@code{-f}] [@code{-w}] [@code{-a}] [@code{-b}] @var{msdosfile} [ @var{msdosfiles}@dots{}] |
| 1677 | |
| 1678 | @code{Mdir} |
| 1679 | displays the contents of MS-DOS directories, or the entries for some |
| 1680 | MS-DOS files. |
| 1681 | |
| 1682 | @code{Mdir} supports the following command line options: |
| 1683 | |
| 1684 | @table @code |
| 1685 | @item / |
| 1686 | Recursive output, just like MS-DOS' @code{-s} option |
| 1687 | @item w |
| 1688 | Wide output. With this option, @code{mdir} prints the filenames across |
| 1689 | the page without displaying the file size or creation date. |
| 1690 | @item a |
| 1691 | Also list hidden files. |
| 1692 | @item f |
| 1693 | Fast. Do not try to find out free space. On larger disks, finding out |
| 1694 | the amount of free space takes up some non trivial amount of time, as |
| 1695 | the whole FAT must be read in and scanned. The @code{-f} flag bypasses |
| 1696 | this step. This flag is not needed on FAT32 file systems, which store |
| 1697 | the size explicitly. |
| 1698 | @item b |
| 1699 | Concise listing. Lists each directory name or filename, one per line |
| 1700 | (including the filename extension). This switch displays no heading |
| 1701 | information and no summary. Only a newline separated list of pathnames |
| 1702 | is displayed. |
| 1703 | @end table |
| 1704 | |
| 1705 | An error occurs if a component of the path is not a directory. |
| 1706 | |
| 1707 | @node mdu, mformat, mdir, Commands |
| 1708 | @section Mdu |
| 1709 | @pindex mdu |
| 1710 | @cindex Space occupied by directories and files |
| 1711 | @cindex du |
| 1712 | @cindex Listing space occupied by directories and files |
| 1713 | @cindex Occupation of space by directories and files |
| 1714 | |
| 1715 | @code{Mdu} is used to list the space occupied by a directory, its |
| 1716 | subdirectories and its files. It is similar to the @code{du} command on |
| 1717 | Unix. The unit used are clusters. Use the minfo command to find out |
| 1718 | the cluster size. |
| 1719 | |
| 1720 | @code{mdu} [@code{-a}] [ @var{msdosfiles} @dots{} ] |
| 1721 | |
| 1722 | |
| 1723 | @table @code |
| 1724 | @item a |
| 1725 | All files. List also the space occupied for individual files. |
| 1726 | @item s |
| 1727 | Only list the total space, don't give details for each subdirectory. |
| 1728 | @end table |
| 1729 | |
| 1730 | |
| 1731 | |
| 1732 | @node mformat, mkmanifest, mdu, Commands |
| 1733 | @section Mformat |
| 1734 | @pindex mformat |
| 1735 | @cindex Initializing disks |
| 1736 | @cindex Formatting disks |
| 1737 | @cindex File system creation |
| 1738 | |
| 1739 | The @code{mformat} command is used to add an MS-DOS file system to a |
| 1740 | low-level formatted diskette. Its syntax is: |
| 1741 | |
| 1742 | @display |
| 1743 | @code{mformat} [@code{-t} @var{cylinders}|@code{-T} @var{tot_sectors}] [@code{-h} @var{heads}] [@code{-s} @var{sectors}] |
| 1744 | [@code{-f} @var{size}] [@code{-1}] [@code{-4}] [@code{-8}] |
| 1745 | [@code{-v} @var{volume_label}] |
| 1746 | [@code{-F}] [@code{-S} @var{sizecode}] |
| 1747 | [@code{-M} @var{software_sector_size}] |
| 1748 | [@code{-N} @var{serial_number}] [@code{-a}] |
| 1749 | [@code{-C}] [@code{-H} @var{hidden_sectors}] [@code{-I} @var{fsVersion}] |
| 1750 | [@code{-r} @var{root_sectors}] [@code{-L} @var{fat_len}] |
| 1751 | [@code{-B} @var{boot_sector}] [@code{-k}] |
| 1752 | [@code{-m} @var{media_descriptor}] |
| 1753 | [@code{-K} @var{backup_boot}] |
| 1754 | [@code{-R} @var{nb_reserved_sectors}] |
| 1755 | [@code{-c} @var{clusters_per_sector}] |
| 1756 | [@code{-d} @var{fat_copies}] |
| 1757 | [@code{-X}] [@code{-2} @var{sectors_on_track_0}] [@code{-3}] |
| 1758 | [@code{-0} @var{rate_on_track_0}] [@code{-A} @var{rate_on_other_tracks}] |
| 1759 | @var{drive:} |
| 1760 | @end display |
| 1761 | |
| 1762 | @code{Mformat} adds a minimal MS-DOS file system (boot sector, FAT, and |
| 1763 | root directory) to a diskette that has already been formatted by a Unix |
| 1764 | low-level format. |
| 1765 | |
| 1766 | |
| 1767 | The following options are supported: (The S, 2, 1 and M options may not |
| 1768 | exist if this copy of mtools has been compiled without the USE_2M |
| 1769 | option) |
| 1770 | |
| 1771 | The following options are the same as for MS-DOS's format command: |
| 1772 | |
| 1773 | @comment xMANoptions |
| 1774 | |
| 1775 | @table @code |
| 1776 | @item v |
| 1777 | Specifies the volume label. A volume label identifies the disk and can |
| 1778 | be a maximum of 11 characters. If you omit the -v switch, mformat will |
| 1779 | assign no label to the disk. |
| 1780 | @item f |
| 1781 | Specifies the size of the DOS file system to format. Only a certain |
| 1782 | number of predefined sizes are supported by this flag; for others use |
| 1783 | the -h/-t/-s flags. The following sizes are supported: |
| 1784 | @table @asis |
| 1785 | @item 160 |
| 1786 | 160K, single-sided, 8 sectors per track, 40 cylinders (for 5 1/4 DD) |
| 1787 | @item 180 |
| 1788 | 160K, single-sided, 9 sectors per track, 40 cylinders (for 5 1/4 DD) |
| 1789 | @item 320 |
| 1790 | 320K, double-sided, 8 sectors per track, 40 cylinders (for 5 1/4 DD) |
| 1791 | @item 360 |
| 1792 | 360K, double-sided, 9 sectors per track, 40 cylinders (for 5 1/4 DD) |
| 1793 | @item 720 |
| 1794 | 720K, double-sided, 9 sectors per track, 80 cylinders (for 3 1/2 DD) |
| 1795 | @item 1200 |
| 1796 | 1200K, double-sided, 15 sectors per track, 80 cylinders (for 5 1/4 HD) |
| 1797 | @item 1440 |
| 1798 | 1440K, double-sided, 18 sectors per track, 80 cylinders (for 3 1/2 HD) |
| 1799 | @item 2880 |
| 1800 | 2880K, double-sided, 36 sectors per track, 80 cylinders (for 3 1/2 ED) |
| 1801 | @end table |
| 1802 | |
| 1803 | @item t |
| 1804 | Specifies the number of tracks on the disk. |
| 1805 | @item T |
| 1806 | Specifies the number of total sectors on the disk. Only one of these 2 |
| 1807 | options may be specified (tracks or total sectors) |
| 1808 | @item h |
| 1809 | The number of heads (sides). |
| 1810 | @item s |
| 1811 | Specifies the number of sectors per track. If the 2m option is given, |
| 1812 | number of 512-byte sector equivalents on generic tracks (i.e. not head 0 |
| 1813 | track 0). If the 2m option is not given, number of physical sectors per |
| 1814 | track (which may be bigger than 512 bytes). |
| 1815 | |
| 1816 | @item 1 |
| 1817 | Formats a single side (equivalent to -h 1) |
| 1818 | |
| 1819 | @item 4 |
| 1820 | Formats a 360K double-sided disk (equivalent to -f 360). When used |
| 1821 | together with -the 1 switch, this switch formats a 180K disk |
| 1822 | |
| 1823 | @item 8 |
| 1824 | Formats a disk with 8 sectors per track. |
| 1825 | |
| 1826 | @end table |
| 1827 | |
| 1828 | MS-DOS format's @code{q}, @code{u} and @code{b} options are not |
| 1829 | supported, and @code{s} has a different meaning. |
| 1830 | |
| 1831 | The following options are specific to mtools: |
| 1832 | |
| 1833 | @table @code |
| 1834 | |
| 1835 | @item F |
| 1836 | Format the partition as FAT32. |
| 1837 | |
| 1838 | @item S |
| 1839 | The size code. The size of the sector is 2 ^ (sizecode + 7). |
| 1840 | @item X |
| 1841 | formats the disk as an XDF disk. @xref{XDF}, for more details. The disk |
| 1842 | has first to be low-level formatted using the xdfcopy utility included |
| 1843 | in the fdutils package. XDF disks are used for instance for OS/2 install |
| 1844 | disks. |
| 1845 | @item 2 |
| 1846 | 2m format. The parameter to this option describes the number of |
| 1847 | sectors on track 0, head 0. This option is recommended for sectors |
| 1848 | bigger than normal. |
| 1849 | @item 3 |
| 1850 | don't use a 2m format, even if the current geometry of the disk is a 2m |
| 1851 | geometry. |
| 1852 | @item 0 |
| 1853 | Data transfer rate on track 0 |
| 1854 | @item A |
| 1855 | Data transfer rate on tracks other than 0 |
| 1856 | @item M |
| 1857 | software sector size. This parameter describes the sector size in bytes used |
| 1858 | by the MS-DOS file system. By default it is the physical sector size. |
| 1859 | @item N |
| 1860 | Uses the requested serial number, instead of generating one |
| 1861 | automatically |
| 1862 | @item a |
| 1863 | If this option is given, an Atari style serial number is generated. |
| 1864 | Ataris store their serial number in the OEM label. |
| 1865 | @item C |
| 1866 | creates the disk image file to install the MS-DOS file system on |
| 1867 | it. Obviously, this is useless on physical devices such as floppies |
| 1868 | and hard disk partitions, but is interesting for image files. |
| 1869 | @item H |
| 1870 | number of hidden sectors. This parameter is useful for formatting hard |
| 1871 | disk partition, which are not aligned on track boundaries (i.e. first |
| 1872 | head of first track doesn't belong to the partition, but contains a |
| 1873 | partition table). In that case the number of hidden sectors is in |
| 1874 | general the number of sectors per cylinder. This is untested. |
| 1875 | @item I |
| 1876 | Sets the fsVersion id when formatting a FAT32 drive. In order to find |
| 1877 | this out, run minfo on an existing FAT32 drive, and mail me about it, so |
| 1878 | I can include the correct value in future versions of mtools. |
| 1879 | @item c |
| 1880 | Sets the size of a cluster (in sectors). If this cluster size would |
| 1881 | generate a FAT that too big for its number of bits, mtools automatically |
| 1882 | increases the cluster size, until the FAT is small enough. If no |
| 1883 | cluster size is specified explicitly, mtools uses a default value as |
| 1884 | described in section ``Number of sectors per cluster'' below. |
| 1885 | @item d |
| 1886 | Sets the number of FAT copies. Default is 2. This setting can also be |
| 1887 | specified using the @code{MTOOLS_NFATS} environment variable. |
| 1888 | @item r |
| 1889 | Sets the size of the root directory (in sectors). Only applicable to 12 |
| 1890 | and 16 bit FATs. This setting can also be specified using the |
| 1891 | @code{MTOOLS_DIR_LEN} environment variable. |
| 1892 | @item L |
| 1893 | Sets the length of the FAT. |
| 1894 | @item B |
| 1895 | Use the boot sector stored in the given file or device, instead of using |
| 1896 | its own. Only the geometry fields are updated to match the target disks |
| 1897 | parameters. |
| 1898 | @item k |
| 1899 | Keep the existing boot sector as much as possible. Only the geometry |
| 1900 | fields and other similar file system data are updated to match the target |
| 1901 | disks parameters. |
| 1902 | @item K |
| 1903 | Sets the sector number where the backup of the boot sector should be |
| 1904 | stored (only relevant on FAT32). |
| 1905 | @item R |
| 1906 | Sets the number of reserved sectors for this filesystem. This must be |
| 1907 | at least 1 for non-FAT32 disks, and at least 3 for FAT disks (in order |
| 1908 | to accommodate the boot sector, the info sector and the backup boot |
| 1909 | sector). |
| 1910 | |
| 1911 | @item m |
| 1912 | Use a non-standard media descriptor byte for this disk. The media |
| 1913 | descriptor is stored at position 21 of the boot sector, and as first |
| 1914 | byte in each FAT copy. Using this option may confuse DOS or older mtools |
| 1915 | version, and may make the disk unreadable. Only use if you know what you |
| 1916 | are doing. |
| 1917 | |
| 1918 | @end table |
| 1919 | |
| 1920 | To format a diskette at a density other than the default, you must supply |
| 1921 | (at least) those command line parameters that are different from the |
| 1922 | default. |
| 1923 | |
| 1924 | @code{Mformat} returns 0 on success or 1 on failure. |
| 1925 | |
| 1926 | It doesn't record bad block information to the Fat, use |
| 1927 | @code{mbadblocks} for that. |
| 1928 | |
| 1929 | @subsection Number of sectors per cluster |
| 1930 | |
| 1931 | If the user indicates no cluster size, mformat figures out a default |
| 1932 | value for it. |
| 1933 | |
| 1934 | For FAT32 it uses the following table to determine the number of |
| 1935 | sectors per cluster, depending on the total number of sectors on the |
| 1936 | filesystem. |
| 1937 | |
| 1938 | more than 32*1024*1024*2: 64 sectors@* |
| 1939 | between 16*1024*1024*2 and 32*1024*1024*2: 32 sectors@* |
| 1940 | between 8*1024*1024*2 and 16*1024*1024*2: 16 sectors@* |
| 1941 | between 260*1024*2 and 81024*1024*2: 1 sectors@* |
| 1942 | |
| 1943 | This is derived from information on page 20 of Microsoft's |
| 1944 | @code{fatgen103} document, which currently can be found at the |
| 1945 | following address: |
| 1946 | |
| 1947 | @code{https://staff.washington.edu/dittrich/misc/fatgen103.pdf} |
| 1948 | |
| 1949 | For FAT12 and FAT16, mformat uses an iterative approach, where it |
| 1950 | starts with a set value, which it doubles until it is able to fill up |
| 1951 | the disk using that cluster size and a number of cluster less than the |
| 1952 | maximum allowed. |
| 1953 | |
| 1954 | The starting value is 1 for disks with one head or less than 2000 |
| 1955 | sectors, and 2 for disks with more than one head, and more than 2000 |
| 1956 | sectors. |
| 1957 | |
| 1958 | The number of sectors per cluster cannot go beyond 128. |
| 1959 | |
| 1960 | @node mkmanifest, minfo, mformat, Commands |
| 1961 | @section Mkmanifest |
| 1962 | @pindex mkmanifest |
| 1963 | @cindex packing list |
| 1964 | |
| 1965 | The @code{mkmanifest} command is used to create a shell script (packing |
| 1966 | list) to restore Unix filenames. Its syntax is: |
| 1967 | |
| 1968 | @code{mkmanifest} [ @var{files} ] |
| 1969 | |
| 1970 | @code{Mkmanifest} creates a shell script that aids in the restoration of |
| 1971 | Unix filenames that got clobbered by the MS-DOS filename restrictions. |
| 1972 | MS-DOS filenames are restricted to 8 character names, 3 character |
| 1973 | extensions, upper case only, no device names, and no illegal characters. |
| 1974 | |
| 1975 | |
| 1976 | The mkmanifest program is compatible with the methods used in |
| 1977 | @code{pcomm, arc,} and @code{mtools} to change perfectly good Unix |
| 1978 | filenames to fit the MS-DOS restrictions. This command is only useful if |
| 1979 | the target system which will read the diskette cannot handle VFAT long |
| 1980 | names. |
| 1981 | |
| 1982 | @subsection Example |
| 1983 | You want to copy the following Unix files to a MS-DOS diskette (using the |
| 1984 | @code{mcopy} command). |
| 1985 | |
| 1986 | @example |
| 1987 | very_long_name |
| 1988 | 2.many.dots |
| 1989 | illegal: |
| 1990 | good.c |
| 1991 | prn.dev |
| 1992 | Capital |
| 1993 | @end example |
| 1994 | |
| 1995 | @code{ASCII} |
| 1996 | converts the names to: |
| 1997 | |
| 1998 | @example |
| 1999 | very_lon |
| 2000 | 2xmany.dot |
| 2001 | illegalx |
| 2002 | good.c |
| 2003 | xprn.dev |
| 2004 | capital |
| 2005 | @end example |
| 2006 | |
| 2007 | The command: |
| 2008 | @example |
| 2009 | mkmanifest very_long_name 2.many.dots illegal: good.c prn.dev Capital >manifest |
| 2010 | @end example |
| 2011 | would produce the following: |
| 2012 | @example |
| 2013 | mv very_lon very_long_name |
| 2014 | mv 2xmany.dot 2.many.dots |
| 2015 | mv illegalx illegal: |
| 2016 | mv xprn.dev prn.dev |
| 2017 | mv capital Capital |
| 2018 | @end example |
| 2019 | |
| 2020 | Notice that "good.c" did not require any conversion, so it did not |
| 2021 | appear in the output. |
| 2022 | |
| 2023 | Suppose I've copied these files from the diskette to another Unix |
| 2024 | system, and I now want the files back to their original names. If the |
| 2025 | file "manifest" (the output captured above) was sent along with those |
| 2026 | files, it could be used to convert the filenames. |
| 2027 | |
| 2028 | @subsection Bugs |
| 2029 | |
| 2030 | The short names generated by @code{mkmanifest} follow the old convention |
| 2031 | (from mtools-2.0.7) and not the one from Windows 95 and mtools-3.0. |
| 2032 | |
| 2033 | |
| 2034 | @node minfo, mlabel, mkmanifest, Commands |
| 2035 | @section Minfo |
| 2036 | @pindex minfo |
| 2037 | @cindex mformat parameters |
| 2038 | @cindex getting parameters of a MS-DOS file system |
| 2039 | |
| 2040 | The @code{minfo} command prints the parameters of a MS-DOS file system, such |
| 2041 | as number of sectors, heads and cylinders. It also prints an mformat |
| 2042 | command line which can be used to create a similar MS-DOS file system on |
| 2043 | another media. However, this doesn't work with 2m or XDF media, and |
| 2044 | with MS-DOS 1.0 file systems |
| 2045 | @display |
| 2046 | @code{minfo} @var{drive}: |
| 2047 | @end display |
| 2048 | |
| 2049 | Minfo supports the following option: |
| 2050 | @table @code |
| 2051 | @item v |
| 2052 | Prints a hexdump of the boot sector, in addition to the other information |
| 2053 | @end table |
| 2054 | |
| 2055 | |
| 2056 | @node mlabel, mmd, minfo, Commands |
| 2057 | @section Mlabel |
| 2058 | @pindex mlabel |
| 2059 | @cindex Labeling a disk |
| 2060 | @cindex Disk label |
| 2061 | |
| 2062 | The @code{mlabel} command adds a volume label to a disk. Its syntax is: |
| 2063 | @display |
| 2064 | @code{mlabel} [@code{-vcsn}] [@code{-N} @var{serial}] @var{drive}:[@var{new_label}] |
| 2065 | @end display |
| 2066 | |
| 2067 | @code{Mlabel} displays the current volume label, if present. If |
| 2068 | @var{new_label} is not given, and if neither the @code{c} nor the |
| 2069 | @code{s} options are set, it prompts the user for a new volume label. |
| 2070 | To delete an existing volume label, press return at the prompt. |
| 2071 | |
| 2072 | The label is limited to 11 single-byte characters, |
| 2073 | e.g. @code{Name1234567}. |
| 2074 | |
| 2075 | Reasonable care is taken to create a valid MS-DOS volume label. If an |
| 2076 | invalid label is specified, @code{mlabel} changes the label (and |
| 2077 | displays the new label if the verbose mode is set). @code{Mlabel} |
| 2078 | returns 0 on success or 1 on failure. |
| 2079 | |
| 2080 | Mlabel supports the following options: |
| 2081 | @table @code |
| 2082 | @item c |
| 2083 | Clears an existing label, without prompting the user |
| 2084 | @item s |
| 2085 | Shows the existing label, without prompting the user. |
| 2086 | @item n |
| 2087 | Assigns a new (random) serial number to the disk |
| 2088 | @item N @var{serial} |
| 2089 | Sets the supplied serial number. The serial number should be supplied as |
| 2090 | an 8 digit hexadecimal number, without spaces |
| 2091 | @end table |
| 2092 | |
| 2093 | |
| 2094 | @node mmd, mmount, mlabel, Commands |
| 2095 | @section Mmd |
| 2096 | @pindex mmd |
| 2097 | @cindex Making a directory |
| 2098 | @cindex Creating a directory |
| 2099 | @cindex Directory creation |
| 2100 | @cindex Subdirectory creation |
| 2101 | |
| 2102 | The @code{mmd} command is used to make an MS-DOS subdirectory. Its |
| 2103 | syntax is: |
| 2104 | |
| 2105 | @code{mmd} [@code{-D} @var{clash_option}] @var{msdosdirectory} [ |
| 2106 | @var{msdosdirectories}@dots{} ] |
| 2107 | |
| 2108 | @code{Mmd} makes a new directory on an MS-DOS file system. An error occurs |
| 2109 | if the directory already exists. |
| 2110 | |
| 2111 | |
| 2112 | @node mmount, mmove, mmd, Commands |
| 2113 | @section Mmount |
| 2114 | @pindex mmount |
| 2115 | @cindex Linux enhancements (mmount) |
| 2116 | @cindex Mounting a disk |
| 2117 | @cindex High capacity formats, mounting |
| 2118 | |
| 2119 | The @code{mmount} command is used to mount an MS-DOS disk. It is only |
| 2120 | available on Linux, as it is only useful if the OS kernel allows |
| 2121 | configuration of the disk geometry. Its syntax is: |
| 2122 | |
| 2123 | @code{mmount} @var{msdosdrive} [@var{mountargs}] |
| 2124 | |
| 2125 | @code{Mmount} |
| 2126 | reads the boot sector of an MS-DOS disk, configures the drive geometry, |
| 2127 | and finally mounts it passing |
| 2128 | @code{mountargs} to @code{mount. } |
| 2129 | If no mount arguments are specified, the name of the device is |
| 2130 | used. If the disk is write protected, it is automatically mounted read |
| 2131 | only. |
| 2132 | |
| 2133 | |
| 2134 | @node mmove, mpartition, mmount, Commands |
| 2135 | @section Mmove |
| 2136 | @pindex mmove |
| 2137 | @cindex Moving files (mmove) |
| 2138 | @cindex Renaming files (mmove) |
| 2139 | |
| 2140 | The @code{mmove} command is used to move or rename an existing MS-DOS |
| 2141 | file or subdirectory. |
| 2142 | @display |
| 2143 | @code{mmove} [@code{-v}] [@code{-D} @var{clash_option}] @var{sourcefile} @var{targetfile} |
| 2144 | @code{mmove} [@code{-v}] [@code{-D} @var{clash_option}] @var{sourcefile} [ @var{sourcefiles}@dots{} ] @var{targetdirectory} |
| 2145 | @end display |
| 2146 | @code{Mmove} moves or renames an existing MS-DOS file or |
| 2147 | subdirectory. Unlike the MS-DOS version of @code{MOVE}, @code{mmove} is |
| 2148 | able to move subdirectories. Files or directories can only be moved |
| 2149 | within one file system. Data cannot be moved from MS-DOS to Unix or |
| 2150 | vice-versa. If you omit the drive letter from the target file or |
| 2151 | directory, the same letter as for the source is assumed. If you omit |
| 2152 | the drive letter from all parameters, drive a: is assumed by default. |
| 2153 | |
| 2154 | @node mpartition, mrd, mmove, Commands |
| 2155 | @section Mpartition |
| 2156 | @pindex mpartition |
| 2157 | @cindex partitions (creating) |
| 2158 | @cindex Zip disks (partitioning them) |
| 2159 | @cindex Jaz disks (partitioning them) |
| 2160 | |
| 2161 | The @code{mpartition} command is used to create MS-DOS file systems as |
| 2162 | partitions. This is intended to be used on non-Linux systems, |
| 2163 | i.e. systems where fdisk and easy access to SCSI devices are not |
| 2164 | available. This command only works on drives whose partition variable |
| 2165 | is set. |
| 2166 | |
| 2167 | @display |
| 2168 | @code{mpartition} @code{-p} @var{drive} |
| 2169 | @code{mpartition} @code{-r} @var{drive} |
| 2170 | @code{mpartition} @code{-I} [@code{-B} @var{bootSector}] @var{drive} |
| 2171 | @code{mpartition} @code{-a} @var{drive} |
| 2172 | @code{mpartition} @code{-d} @var{drive} |
| 2173 | @code{mpartition} @code{-c} [@code{-s} @var{sectors}] [@code{-h} @var{heads}] |
| 2174 | [@code{-t} @var{cylinders}] [@code{-v} [@code{-T} @var{type}] [@code{-b} |
| 2175 | @var{begin}] [@code{-l} length] [@code{-f}] |
| 2176 | |
| 2177 | @end display |
| 2178 | |
| 2179 | Mpartition supports the following operations: |
| 2180 | |
| 2181 | @table @code |
| 2182 | @item p |
| 2183 | Prints a command line to recreate the partition for the drive. Nothing |
| 2184 | is printed if the partition for the drive is not defined, or an |
| 2185 | inconsistency has been detected. If verbose (@code{-v}) is also set, |
| 2186 | prints the current partition table. |
| 2187 | @item r |
| 2188 | Removes the partition described by @var{drive}. |
| 2189 | @item I |
| 2190 | Initializes the partition table, and removes all partitions. |
| 2191 | @item c |
| 2192 | Creates the partition described by @var{drive}. |
| 2193 | @item a |
| 2194 | "Activates" the partition, i.e. makes it bootable. Only one partition |
| 2195 | can be bootable at a time. |
| 2196 | @item d |
| 2197 | "Deactivates" the partition, i.e. makes it unbootable. |
| 2198 | @end table |
| 2199 | |
| 2200 | If no operation is given, the current settings are printed. |
| 2201 | |
| 2202 | For partition creations, the following options are available: |
| 2203 | @table @code |
| 2204 | @item s @var{sectors} |
| 2205 | The number of sectors per track of the partition (which is also the |
| 2206 | number of sectors per track for the whole drive). |
| 2207 | @item h @var{heads} |
| 2208 | The number of heads of the partition (which is also the number of heads |
| 2209 | for the whole drive). By default, the geometry information (number of |
| 2210 | sectors and heads) is figured out from neighboring partition table |
| 2211 | entries, or guessed from the size. |
| 2212 | @item t @var{cylinders} |
| 2213 | The number of cylinders of the partition (not the number of cylinders of |
| 2214 | the whole drive. |
| 2215 | @item b @var{begin} |
| 2216 | The starting offset of the partition, expressed in sectors. If begin |
| 2217 | is not given, @code{mpartition} lets the partition begin at the start |
| 2218 | of the disk (partition number 1), or immediately after the end of the |
| 2219 | previous partition. |
| 2220 | @item l @var{length} |
| 2221 | The size (length) of the partition, expressed in sectors. If end is |
| 2222 | not given, @code{mpartition} figures out the size from the number of |
| 2223 | sectors, heads and cylinders. If these are not given either, it gives |
| 2224 | the partition the biggest possible size, considering disk size and |
| 2225 | start of the next partition. |
| 2226 | @end table |
| 2227 | |
| 2228 | The following option is available for all operation which modify the |
| 2229 | partition table: |
| 2230 | @table @code |
| 2231 | @item f |
| 2232 | Usually, before writing back any changes to the partition, mpartition |
| 2233 | performs certain consistency checks, such as checking for overlaps and |
| 2234 | proper alignment of the partitions. If any of these checks fails, the |
| 2235 | partition table is not changed. The @code{-f} allows you to override |
| 2236 | these safeguards. |
| 2237 | @end table |
| 2238 | |
| 2239 | The following options are available for all operations: |
| 2240 | @table @code |
| 2241 | @item v |
| 2242 | Together with @code{-p} prints the partition table as it is now (no |
| 2243 | change operation), or as it is after it is modified. |
| 2244 | @item vv |
| 2245 | If the verbosity flag is given twice, @code{mpartition} will print out |
| 2246 | a hexdump of the partition table when reading it from and writing it |
| 2247 | to the device. |
| 2248 | @end table |
| 2249 | |
| 2250 | The following option is available for partition table initialization: |
| 2251 | @table @code |
| 2252 | @item B @var{bootSector} |
| 2253 | Reads the template master boot record from file @var{bootSector}. |
| 2254 | @end table |
| 2255 | |
| 2256 | @subsection Choice of partition type |
| 2257 | |
| 2258 | Mpartition proceeds as follows to pick a type for the partition: |
| 2259 | |
| 2260 | @itemize - |
| 2261 | @item |
| 2262 | FAT32 partitions are assigned type 0x0C (``@code{Win95 FAT32, LBA}'') |
| 2263 | |
| 2264 | @item |
| 2265 | For all others, if the partition fits entirely within the first 65536 |
| 2266 | sectors of the disk, assign 0x01 (``@code{DOS FAT12, CHS}'') for FAT12 |
| 2267 | partition and 0x04 (``@code{DOS FAT16, CHS}'') for FAT16 partitions |
| 2268 | |
| 2269 | @item |
| 2270 | If not covered by the above, assign 0x06 (``@code{DOS BIG FAT16 CHS}'') if partition fits entirely within the first 1024 cylinders (CHS mode) |
| 2271 | |
| 2272 | @item |
| 2273 | All remaining cases get 0x0E (``@code{Win95 BIG FAT16, LBA}'') |
| 2274 | |
| 2275 | @end itemize |
| 2276 | |
| 2277 | If number of fat bits is not known (not specified in drive's |
| 2278 | definition), then FAT12 is assumed for all drives with less than 4096 |
| 2279 | sectors, and FAT16 for those with more than 4096 sectors. |
| 2280 | |
| 2281 | This corresponds more or less to the definitions outlined at @code{https://en.wikipedia.org/wiki/Partition_type#List_of_partition_IDs} |
| 2282 | and |
| 2283 | @code{https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-2000-server/cc977219(v=technet.10)}, |
| 2284 | with two notable differences: |
| 2285 | |
| 2286 | @itemize - |
| 2287 | @item |
| 2288 | If fat bits are unknown, the reference documents consider drives with |
| 2289 | less than 32680 sectors to be FAT12. Mtools uses 4096 sectors as the |
| 2290 | cutoff point, as older versions of DOS only support FAT12 on disks |
| 2291 | with less than 4096 sectors (and these older versions are the ones |
| 2292 | which would be most likely to use FAT12 in the first place). |
| 2293 | |
| 2294 | @item |
| 2295 | The reference documents use a 8GB (wikipedia) or a 4GB (Microsoft) |
| 2296 | cutoff between 0x06 (@code{DOS BIG FAT16 CHS}) and 0x0E. Mtools uses |
| 2297 | 1024 cylinders. This is because any partition beyond 1024 cylinders |
| 2298 | must be LBA and cannot be CHS. 8GB works out to be the biggest |
| 2299 | capacity which can be represented as CHS (63 sectors, 255 heads and |
| 2300 | 1024 cylinders). 4GB is the capacity limit for windows 2000, so it |
| 2301 | makes sense that a documentation for windows 2000 would specify this |
| 2302 | as the upper limit for any partition type. |
| 2303 | |
| 2304 | @end itemize |
| 2305 | |
| 2306 | @node mrd, mren, mpartition, Commands |
| 2307 | @section Mrd |
| 2308 | @pindex mrd |
| 2309 | @cindex Removing a directory |
| 2310 | @cindex Erasing a directory |
| 2311 | @cindex Deleting a directory |
| 2312 | @cindex Directory removing |
| 2313 | @cindex Subdirectory removing |
| 2314 | |
| 2315 | The @code{mrd} command is used to remove an MS-DOS subdirectory. Its |
| 2316 | syntax is: |
| 2317 | |
| 2318 | @display |
| 2319 | @code{mrd} [@code{-v}] @var{msdosdirectory} [ @var{msdosdirectories}@dots{} ] |
| 2320 | @end display |
| 2321 | |
| 2322 | @code{Mrd} removes a directory from an MS-DOS file system. An error occurs |
| 2323 | if the directory does not exist or is not empty. |
| 2324 | |
| 2325 | @node mren, mshortname, mrd, Commands |
| 2326 | @section Mren |
| 2327 | @pindex mren |
| 2328 | @cindex Renaming files (mren) |
| 2329 | @cindex Moving files (mren) |
| 2330 | |
| 2331 | The @code{mren} command is used to rename or move an existing MS-DOS |
| 2332 | file or subdirectory. Its syntax is: |
| 2333 | |
| 2334 | @display |
| 2335 | @code{mren} [@code{-voOsSrRA}] @var{sourcefile} @var{targetfile} |
| 2336 | @end display |
| 2337 | |
| 2338 | @code{Mren} |
| 2339 | renames an existing file on an MS-DOS file system. |
| 2340 | |
| 2341 | In verbose mode, @code{Mren} displays the new filename if the name |
| 2342 | supplied is invalid. |
| 2343 | |
| 2344 | If the first syntax is used (only one source file), and if the target |
| 2345 | name doesn't contain any slashes or colons, the file (or subdirectory) |
| 2346 | is renamed in the same directory, instead of being moved to the current |
| 2347 | @code{mcd} directory as would be the case with @code{mmove}. Unlike the |
| 2348 | MS-DOS version of @code{REN}, @code{mren} can be used to rename |
| 2349 | directories. |
| 2350 | |
| 2351 | @node mshortname, mshowfat, mren, Commands |
| 2352 | @section Mshortname |
| 2353 | @pindex mshortname |
| 2354 | |
| 2355 | The @code{mshortname} command is used to display the short name of a |
| 2356 | file. Syntax: |
| 2357 | |
| 2358 | @display |
| 2359 | @code{mshortname} @var{files} |
| 2360 | @end display |
| 2361 | |
| 2362 | The shortname is displayed as it is stored in raw format on disk, |
| 2363 | without any character set conversion. |
| 2364 | |
| 2365 | @node mshowfat, mtoolstest, mshortname, Commands |
| 2366 | @section Mshowfat |
| 2367 | @pindex mshowfat |
| 2368 | @cindex Clusters of a file |
| 2369 | @cindex Fat |
| 2370 | |
| 2371 | The @code{mshowfat} command is used to display the FAT entries for a |
| 2372 | file. Syntax: |
| 2373 | |
| 2374 | @display |
| 2375 | @code{mshowfat} [@code{-o} @var{offset}] @var{files} |
| 2376 | @end display |
| 2377 | |
| 2378 | If no offset is given, a list of all clusters occupied by the file is |
| 2379 | printed. If an offset is given, only the number of the cluster |
| 2380 | containing that offset is printed. |
| 2381 | |
| 2382 | @node mtoolstest, mtype, mshowfat, Commands |
| 2383 | @section Mtoolstest |
| 2384 | @pindex mtoolstest |
| 2385 | @cindex Testing configuration file for correctness |
| 2386 | @cindex Checking configuration file |
| 2387 | @cindex Verifying configuration file |
| 2388 | |
| 2389 | The @code{mtoolstest} command is used to tests the mtools configuration |
| 2390 | files. To invoke it, just type @code{mtoolstest} without any arguments. |
| 2391 | @code{Mtoolstest} reads the mtools configuration files, and prints the |
| 2392 | cumulative configuration to @code{stdout}. The output can be used as a |
| 2393 | configuration file itself (although you might want to remove redundant |
| 2394 | clauses). You may use this program to convert old-style configuration |
| 2395 | files into new style configuration files. |
| 2396 | |
| 2397 | @node mtype, mzip, mtoolstest, Commands |
| 2398 | @section Mtype |
| 2399 | |
| 2400 | The @code{mtype} command is used to display contents of an MS-DOS |
| 2401 | file. Its syntax is: |
| 2402 | |
| 2403 | @display |
| 2404 | @code{mtype} [@code{-ts}] @var{msdosfile} [ @var{msdosfiles}@dots{} ] |
| 2405 | @end display |
| 2406 | |
| 2407 | @code{Mtype} displays the specified MS-DOS file on the screen. |
| 2408 | |
| 2409 | In addition to the standard options, @code{Mtype} allows the following |
| 2410 | command line options: |
| 2411 | |
| 2412 | @table @code |
| 2413 | @item t |
| 2414 | Text file viewing. @code{Mtype} translates incoming carriage |
| 2415 | return/line feeds to line feeds. |
| 2416 | @item s |
| 2417 | @code{Mtype} strips the high bit from the data. |
| 2418 | @end table |
| 2419 | |
| 2420 | The @code{mcd} command may be used to establish the device and the |
| 2421 | current working directory (relative to MS-DOS), otherwise the default is |
| 2422 | @code{A:/}. |
| 2423 | |
| 2424 | @code{Mtype} returns 0 on success, 1 on utter failure, or 2 on partial |
| 2425 | failure. |
| 2426 | |
| 2427 | Unlike the MS-DOS version of @code{TYPE}, @code{mtype} allows multiple |
| 2428 | arguments. |
| 2429 | |
| 2430 | |
| 2431 | @node mzip, , mtype, Commands |
| 2432 | @section Mzip |
| 2433 | @cindex Zip disk (utilities) |
| 2434 | @cindex Jaz disk (utilities) |
| 2435 | @cindex Ejecting a Zip/Jaz disk |
| 2436 | @cindex Write protecting a Zip/Jaz disk |
| 2437 | @pindex mzip |
| 2438 | @cindex ZipTools disk |
| 2439 | @cindex Tools disk (Zip and Jaz drives) |
| 2440 | @cindex APlaceForYourStuff |
| 2441 | @cindex password protected Zip disks |
| 2442 | |
| 2443 | The @code{mzip} command is used to issue ZIP disk specific commands on |
| 2444 | Linux, Solaris or HP-UX. Its syntax is: |
| 2445 | |
| 2446 | @display |
| 2447 | @code{mzip} [@code{-epqrwx}] |
| 2448 | @end display |
| 2449 | |
| 2450 | @code{Mzip} allows the following |
| 2451 | command line options: |
| 2452 | |
| 2453 | @table @code |
| 2454 | @item e |
| 2455 | Ejects the disk. |
| 2456 | @item f |
| 2457 | Force eject even if the disk is mounted (must be given in addition to |
| 2458 | @code{-e}). |
| 2459 | @item r |
| 2460 | Write protect the disk. |
| 2461 | @item w |
| 2462 | Remove write protection. |
| 2463 | @item p |
| 2464 | Password write protect. |
| 2465 | @item x |
| 2466 | Password protect |
| 2467 | @item u |
| 2468 | Temporarily unprotect the disk until it is ejected. The disk becomes |
| 2469 | writable, and reverts back to its old state when ejected. |
| 2470 | @item q |
| 2471 | Queries the status |
| 2472 | @end table |
| 2473 | |
| 2474 | To remove the password, set it to one of the password-less modes |
| 2475 | @code{-r} or @code{-w}: mzip will then ask you for the password, and |
| 2476 | unlock the disk. If you have forgotten the password, you can get rid of |
| 2477 | it by low-level formatting the disk (using your SCSI adapter's BIOS |
| 2478 | setup). |
| 2479 | |
| 2480 | The ZipTools disk shipped with the drive is also password protected. On |
| 2481 | MS-DOS or on a Mac, this password is automatically removed once the |
| 2482 | ZipTools have been installed. From various articles posted to Usenet, I |
| 2483 | learned that the password for the tools disk is |
| 2484 | @code{APlaceForYourStuff}@footnote{To see the articles, search for |
| 2485 | @code{APlaceForYourStuff} using Google Groups}. Mzip knows about this |
| 2486 | password, and tries it first, before prompting you for a password. Thus |
| 2487 | @code{mzip -w z:} unlocks the tools disk@footnote{I didn't know about |
| 2488 | this yet when I bought my own Zip drive. Thus I ended up reformatting |
| 2489 | my tools disk, and hence I haven't had the opportunity to test the |
| 2490 | password yet. If anybody still has their tools disk with the original |
| 2491 | password, could you try it out? Thanks in advance}. The tools disk is |
| 2492 | formatted in a special way so as to be usable both in a PC and in a Mac. |
| 2493 | On a PC, the Mac file system appears as a hidden file named |
| 2494 | @file{partishn.mac}. You may erase it to reclaim the 50 Megs of space |
| 2495 | taken up by the Mac file system. |
| 2496 | |
| 2497 | |
| 2498 | @subsection Bugs |
| 2499 | |
| 2500 | This command is a big kludge. A proper implementation would take a |
| 2501 | rework of significant parts of mtools, but unfortunately I don't have |
| 2502 | the time for this right now. The main downside of this implementation is |
| 2503 | that it is inefficient on some architectures (several successive calls |
| 2504 | to mtools, which defeats mtools' caching). |
| 2505 | |
| 2506 | @node Compiling mtools, Porting mtools, Commands, Top |
| 2507 | @chapter Architecture specific compilation flags |
| 2508 | @cindex XDF disks (compile time configuration) |
| 2509 | @cindex Solaris (compile time configuration of vold) |
| 2510 | @cindex Vold (compile time configuration) |
| 2511 | @cindex Compile time configuration |
| 2512 | |
| 2513 | To compile mtools, first invoke @code{./configure} before |
| 2514 | @code{make}. In addition to the standard @code{autoconfigure} flags, |
| 2515 | there are two architecture specific flags available. |
| 2516 | |
| 2517 | @table @code |
| 2518 | @item ./configure --enable-xdf |
| 2519 | @itemx ./configure --disable-xdf |
| 2520 | Enables support for XDF disks. This is on by default. @xref{XDF}, |
| 2521 | for details. |
| 2522 | @item ./configure --enable-vold |
| 2523 | @itemx ./configure --disable-vold |
| 2524 | Enables support for vold on Solaris. When used in conjunction with vold, |
| 2525 | mtools should use different device nodes than for direct access. |
| 2526 | |
| 2527 | @item ./configure --enable-new-vold |
| 2528 | @itemx ./configure --disable-new-vold |
| 2529 | Enables new support for vold on Solaris. This is supposed to work more |
| 2530 | smoothly than the old support. |
| 2531 | |
| 2532 | @item ./configure --enable-floppyd |
| 2533 | @itemx ./configure --disable-floppyd |
| 2534 | Enables support for floppyd. By default, floppyd support is enabled as |
| 2535 | long as the necessary X includes and libraries are available. |
| 2536 | @end table |
| 2537 | |
| 2538 | @node Porting mtools, Command Index, Compiling mtools, Top |
| 2539 | @chapter Porting mtools to architectures which are not supported yet |
| 2540 | @cindex Porting |
| 2541 | @cindex Compiled-in defaults |
| 2542 | |
| 2543 | This chapter is only interesting for those who want to port mtools to |
| 2544 | an architecture which is not yet supported. For most common systems, |
| 2545 | default drives are already defined. If you want to add default drives |
| 2546 | for a still unsupported system, run configuration.guess, to see which |
| 2547 | identification autoconf uses for that system. This identification is |
| 2548 | of the form cpu-vendor-os (for example sparc-sun-sunos). The cpu and |
| 2549 | the OS parts are passed to the compiler as preprocessor flags. |
| 2550 | The OS part is passed to the compiler in three forms. |
| 2551 | @enumerate |
| 2552 | @item |
| 2553 | The complete OS name, with dots replaced by underscores. SCO3.2v2 would |
| 2554 | yield sco3_2v2 |
| 2555 | @item |
| 2556 | The base OS name. SCO3.2v2 would yield Sco |
| 2557 | @item |
| 2558 | The base OS name plus its major version. SCO3.2v2 would yield Sco3 |
| 2559 | @end enumerate |
| 2560 | |
| 2561 | All three versions are passed, if they are different. |
| 2562 | |
| 2563 | To define the devices, use the entries for the systems that are already |
| 2564 | present as templates. In general, they have the following form: |
| 2565 | |
| 2566 | @example |
| 2567 | #if (defined (my_cpu) && defined(my_os)) |
| 2568 | #define predefined_devices |
| 2569 | struct device devices[] = @{ |
| 2570 | @{ "/dev/first_drive", 'drive_letter', drive_description@}, |
| 2571 | @dots{} |
| 2572 | @{ "/dev/last_drive", 'drive_letter', drive_description@} |
| 2573 | @} |
| 2574 | #define INIT_NOOP |
| 2575 | #endif |
| 2576 | @end example |
| 2577 | |
| 2578 | "/dev/first_drive" is the name of the device or image file |
| 2579 | representing the drive. Drive_letter is a letter ranging from a to z |
| 2580 | giving access to the drive. Drive_description describes the type of the |
| 2581 | drive: |
| 2582 | @table @code |
| 2583 | @item ED312 |
| 2584 | extra density (2.88M) 3 1/2 disk |
| 2585 | @item HD312 |
| 2586 | high density 3 1/2 disk |
| 2587 | @item DD312 |
| 2588 | double density 3 1/2 disk |
| 2589 | @item HD514 |
| 2590 | high density 5 1/4 disk |
| 2591 | @item DD514 |
| 2592 | double density 5 1/4 disk |
| 2593 | @item DDsmall |
| 2594 | 8 sector double density 5 1/4 disk |
| 2595 | @item SS514 |
| 2596 | single sided double density 5 1/4 disk |
| 2597 | @item SSsmall |
| 2598 | single sided 8 sector double density 5 1/4 disk |
| 2599 | @item GENFD |
| 2600 | generic floppy drive (12 bit FAT) |
| 2601 | @item GENHD |
| 2602 | generic hard disk (16 bit FAT) |
| 2603 | @item GEN |
| 2604 | generic device (all parameters match) |
| 2605 | @item ZIPJAZ(flags) |
| 2606 | generic ZIP drive using normal access. This uses partition 4. |
| 2607 | @code{Flags} are any special flags to be passed to open. |
| 2608 | @item RZIPJAZ(flags) |
| 2609 | generic ZIP drive using raw SCSI access. This uses partition 4. |
| 2610 | @code{Flags} are any special flags to be passed to open. |
| 2611 | @item REMOTE |
| 2612 | the remote drive used for floppyd. Unlike the other items, this macro |
| 2613 | also includes the file name ($DISPLAY) and the drive letter (X) |
| 2614 | @end table |
| 2615 | |
| 2616 | Entries may be described in more detail: |
| 2617 | @example |
| 2618 | fat_bits,open_flags,cylinders,heads,sectors,DEF_ARG |
| 2619 | @end example |
| 2620 | or, if you need to describe an offset (file system doesn't start at |
| 2621 | beginning of file system) |
| 2622 | @example |
| 2623 | fat_bits, open_flags, cylinders, heads, sectors, offset, DEF_ARG0 |
| 2624 | @end example |
| 2625 | |
| 2626 | @table @code |
| 2627 | @item fat_bits |
| 2628 | is either 12, 16 or 0. 0 means that the device accepts both types of |
| 2629 | FAT. |
| 2630 | @item open_flags |
| 2631 | may include flags such as O_NDELAY, or O_RDONLY, which might be |
| 2632 | necessary to open the device. 0 means no special flags are needed. |
| 2633 | @item cylinders,heads,sectors |
| 2634 | describe the geometry of the disk. If cylinders is 0, the heads and sectors |
| 2635 | parameters are ignored, and the drive accepts any geometry. |
| 2636 | @item offset |
| 2637 | is used if the DOS file system doesn't begin at the start of the device |
| 2638 | or image file. This is mostly useful for Atari Ram disks (which contain |
| 2639 | their device driver at the beginning of the file) or for DOS emulator |
| 2640 | images (which may represent a partitioned device. |
| 2641 | @end table |
| 2642 | |
| 2643 | Definition of defaults in the devices file should only be done if these |
| 2644 | same devices are found on a large number of hosts of this type. In that |
| 2645 | case, could you also let me know about your new definitions, so that I |
| 2646 | can include them into the next release. For purely local file, I |
| 2647 | recommend that you use the @code{@value{SYSCONFDIR}mtools.conf} and |
| 2648 | @code{~/.mtoolsrc} configuration files. |
| 2649 | |
| 2650 | However, the devices files also allows you to supply geometry setting |
| 2651 | routines. These are necessary if you want to access high capacity |
| 2652 | disks. |
| 2653 | |
| 2654 | Two routines should be supplied: |
| 2655 | |
| 2656 | @enumerate |
| 2657 | @item |
| 2658 | Reading the current parameters |
| 2659 | @example |
| 2660 | static inline int get_parameters(int fd, struct generic_floppy_struct *floppy) |
| 2661 | @end example |
| 2662 | |
| 2663 | This probes the current configured geometry, and return it in |
| 2664 | the structure generic_floppy_struct (which must also be declared). |
| 2665 | Fd is an open file descriptor for the device, and buf is an already |
| 2666 | filled in stat structure, which may be useful. |
| 2667 | This routine should return 1 if the probing fails, and 0 otherwise. |
| 2668 | |
| 2669 | @item |
| 2670 | Setting new parameters |
| 2671 | @example |
| 2672 | static inline int set_parameters(int fd, struct generic_floppy_struct *floppy) |
| 2673 | struct stat *buf) |
| 2674 | @end example |
| 2675 | This configures the geometry contained in floppy on the file descriptor |
| 2676 | fd. Buf is the result of a stat call (already filled in). This should |
| 2677 | return 1 if the new geometry cannot be configured, and 0 otherwise. |
| 2678 | @end enumerate |
| 2679 | |
| 2680 | A certain number of preprocessor macros should also be supplied: |
| 2681 | |
| 2682 | @table @code |
| 2683 | @item TRACKS(floppy) |
| 2684 | refers to the track field in the floppy structure |
| 2685 | @item HEADS(floppy) |
| 2686 | refers to the heads field in the floppy structure |
| 2687 | @item SECTORS(floppy) |
| 2688 | refers to the sectors per track field in the floppy structure |
| 2689 | @item SECTORS_PER_DISK(floppy) |
| 2690 | refers to the sectors per disk field in the floppy structure (if |
| 2691 | applicable, otherwise leave undefined) |
| 2692 | |
| 2693 | @item BLOCK_MAJOR |
| 2694 | major number of the floppy device, when viewed as a block device |
| 2695 | |
| 2696 | @item CHAR_MAJOR |
| 2697 | major number of the floppy device, when viewed as a character device |
| 2698 | (a.k.a. "raw" device, used for fsck) (leave this undefined, if your OS |
| 2699 | doesn't have raw devices) |
| 2700 | @end table |
| 2701 | |
| 2702 | For the truly high capacity formats (XDF, 2m, etc), there is no clean |
| 2703 | and documented interface yet. |
| 2704 | |
| 2705 | @comment MANskip 1 |
| 2706 | |
| 2707 | @node Command Index, Variable Index, Porting mtools, Top |
| 2708 | @unnumbered Command Index |
| 2709 | @printindex pg |
| 2710 | |
| 2711 | @node Variable Index, Concept Index, Command Index, Top |
| 2712 | @unnumbered Variable index |
| 2713 | @printindex vr |
| 2714 | |
| 2715 | @node Concept Index, , Variable Index, Top |
| 2716 | @unnumbered Concept index |
| 2717 | @printindex cp |
| 2718 | |
| 2719 | @comment MANend-skip 1 |
| 2720 | @comment MANend-skip 5 |
| 2721 | @bye |