| [Top] | [Contents] | [Index] | [ ? ] |
Fdutils is a collection of utililties for configuring and using the Linux floppy driver. With fdutils, you can:
This manual describes these utilities, and also the floppy driver itself.
1. Where to get fdutils and its documentation 2. Basic usage How to get started 3. Device numbers 4. Media description How can a floppy disk and a format be described to fdutils? 5. Drive descriptions How can a drive and its characteristics be described to fdutils? 6. Storing more data on a floppy disk How to store more data on your floppy disks 7. How autodetection works How the floppy driver distinguishes among the different kinds of disks 8. Configuring the floppy driver via lilo or insmod Lilo boot options understood by the floppy driver 9. Floppy ioctls The ioctl's understood by the floppy driver 10. Command list The available fdutils commands 11. Compile-time configuration via GNU autoconf How to use GNU autoconf to customize fdutils A. Acronyms A brief listing of acronyms used in this documentation B. Interesting formats A brief list of legacy and other formats Command Index Concept index Concept Index
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Fdutils can be found at the following places (+ mirrors):
ftp://www.tux.org/pub/knaff/fdutils/fdutils-5.5.tar.gz ftp://metalab.unc.edu/pub/Linux/utils/disk-management/fdutils-5.5.tar.gz ftp://tsx-11.mit.edu/pub/linux/sources/sbin/fdutils-5.5.tar.gz |
The FAQ included in this package is also available separetely at:
http://alain.knaff.linux.lu/floppy/FAQ.html http://www.tux.org/pub/knaff/floppy/FAQ.html |
Before reporting a bug, make sure that it has not yet been fixed in the Alpha patches which can be found at:
http://fdutils.linux.lu ftp://www.tux.org/pub/knaff/fdutils |
These patches are named
fdutils-version-ddmm.taz, where version
stands for the base version, dd for the day and mm for the
month. Due to a lack of space, I usually leave only the most recent
patch.
There is an fdutils mailing list at fdutils @ www.tux.org . Please send all bug reports to this list. You may subscribe to the list by sending a message with 'subscribe fdutils @ www.tux.org' in its body to majordomo @ www.tux.org . (N.B. Please remove the spaces around the "@" both times. I left them there in order to fool spambots.) Announcements of new fdutils versions will also be sent to the list, in addition to the linux announce newsgroups. The mailing list is archived at http://www.tux.org/hypermail/fdutils/latest
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This chapter describes basic usage of floppies, and gives a few simple tips for using floppies under Linux.
2.1 How disks are organized How a disk is organized, high-level and low-level formats 2.2 File systems supported by Linux Which file systems does Linux support 2.3 What's in a name How floppy drives are named 2.4 What to do if you get an unidentified floppy disk How to identify a disk 2.5 Nickel tours Short summaries of the various storage methods 2.7 New Features of 1.2+ kernels New features of the kernel, mtools, and fdutils
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
All floppies have two levels of formatting, both of which must be known in order to read them. The first is the binary or sector level format, which is how raw data is stored on the disk. The second is a higher level organization, often called a file system, which allows multiple files to be conveniently stored on the disk.
For example, a typical 1.44MB disk contains a low-level format, with 18 sectors per track, 80 tracks, and two sides (or heads); each sector can hold 512 bytes of data for a total of 1474560 bytes (or 1440 KB). When used under MS-DOS, this floppy would have a small portion of the disk used to keep track of files on the disk (including a bootsector, file allocation tables, directories, etc.).
The floppy driver generally takes care of reading the binary, or
low-level format. It can often "guess" the low-level disk geometry
needed to read the disk. This is called autodetection
(see section 7. How autodetection works). If the driver can't autodetect the disk
(e.g. if it is in an unusual format) you can tell the driver what the
geometry is either by using the setfdprm (see section 10.9 setfdprm)
utility or by using a fixed geometry device device
(e.g. `/dev/fd0H1440').
Under Linux, many different file systems from many sources can be used.
Some of these file systems are interpreted via a utility program (for
example mtools for using disks with an MS-DOS file system). Many
file systems can alternatively be "mounted" to appear in the UNIX
directory structure until subsequently being unmounted; this is usually
implemented by having the kernel itself interpret the file system on the
disk.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The following file systems are supported:
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The following figure shows the meaning of the different parts of the name of a floppy device:
+--------------- /dev: directory for devices | +------------- fd: floppy disk device prefix | | +------------ 0: floppy drive #0 (A:) (0-1 typical, 0-7 | | | possible) | | |+-- 3.5" drive: (use d for 5.25" double density drives, and | | || h for 5.25" high density drives, | | || u for 3.5" drive of any density) | | || +---- 1440: Capacity (in KB) of format (usually between | | || | 360 and 3920) /dev/fd0u1440 |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
dd if=/dev/fd0 of=/tmp/foo count=1
# If it works:
getfdprm # This will report what geometry the disk has
file /tmp/foo # This may indicate the type of file system
mdir a: # Check for an MS-DOS file system
tar tvf /dev/fd0 # Check for a tar archive
cpio -itv < /dev/fd0 # Check for a cpio archive
e2fsck /dev/fd0 # Check for an "ext2" file system
# If it doesn't work:
# Try the above dd command using various /dev/fd0* devices
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
2.5.1 mtools Access MS-Dos disks from Unix 2.5.2 Tar (Tape ARchive) Tarring files directly to floppy disks 2.5.3 CPIO (CoPy In/Out) Another archive format 2.6 Ext2 (Second Extended File System) Seconded Extended File System
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
mdir a: # Read directory of MS-DOS disk in drive A: mcopy /tmp/foo\* a: # Copy files beginning with foo in /tmp to A: mcopy a:\* . # Copy all files from A: to current directory mformat a: # Add MS-DOS file system to formatted disk |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
tar tvf /dev/fd0 # Read directory of tar archive in
# drive A:
tar cvf /dev/fd0 foo1 foo2 # Write foo1 and foo2 to A: in tar
# format foo1/foo2 can be entire
# directory trees
tar xvfp /dev/fd0 # extract entire tar archive in
# drive A:
|
Tar is not a file system. Only low-level format (superformat,
see section 10.10 superformat) are needed to prepare a disk to accept a tar
archive.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
cpio -itv < /dev/fd0 # Read directory of cpio archive in A:
find foo1 foo2 -print | cpio -ov < /dev/fd0
# Write foo1/foo2 to A:
# foo1/foo2 can be entire directory trees
cpio -idumv < /dev/fd0 # extract entire CPIO archive in drive A:
|
Note: blocks reported are in 512-byte units (due to UNIX System V heritage). Cpio is not a file system. Only low-level format (fdformat or superformat (see section 10.10 superformat) needed.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
mke2fs /dev/fd0 1440 # Makes an ext2 filesystem of 1440
# block on A:
mke2fs -c /dev/fd0 1440 # Same as above, but tests floppy first
e2fsck /dev/fd0 # Tests filesystem integrity. (like
# chkdsk in Dos)
e2fsck -p /dev/fd0 # Repairs filesystem. (like chkdsk /f
# in Dos)
mount -t ext2 /dev/fd0 /mnt # Mounts the disk in A: on /mnt.
# The directory /mnt must already exist
umount /mnt # Unmounts /mnt. No process should
# have its working directory in /mnt
# No process should have open files in
# /mnt
|
Note: don't use ext2 on 2m disks
On some systems mke2fs is also called mkfs.ext2, and e2fsck is also
called fsck.ext2
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
2.7.1 New features of 1.2+ kernels New kernel features since 1.2.0 2.7.2 New features of mtools-3.0 New mtools features since mtools-3.0 2.7.3 New Utilities Utilities contained in the fdutils package
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
NOTE: Mtools has no longer maintained by its original maintainer Emmet P. Gray after 2.0.7.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
superformat (replaces fdformat; up to 3.84 MB floppies, faster,
calls mformat)
getfdprm/setfdprm
fdrawcmd (allows user-mode programs to do low-level floppy
actions) floppycontrol (general-purpose floppy driver
configuration utility)
MAKEFLOPPIES (makes floppy devices)
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The floppy device nodes are usually made using the MAKEFLOPPIES
shell script (See section 10.8 makefloppies.).
The major device number for the floppy drives is 2. The minor device number contains describes which drive it represents, and may in addition describe the kind of media which is currently in the drive.
There are two kind of floppy devices:
minor_device = 128 * fdc_nr + unit_nr |
minor_device = 128 * fdc_nr + unit_nr + 4 * format_nr |
In this formula, fdc_nr is the number of the floppy disk
controller (0 or 1, usually 0), and unit_nr is the Unit number (0
to 3, 0 for Dos drive A:, and 1 for Dos drive B:).
Format_nr is only meaningful for the fixed format devices. It
describes the disk geometry that is used. It is an index into the
geometry list 3.3 The geometry list. Using all available
controller numbers and all available drive numbers, you may thus connect
up to 8 floppy drives to a single Linux box.
3.1 Variable format devices 3.2 Fixed format devices 3.3 The geometry list 3.4 Adding new formats
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Variable format devices don't have an intrinsic geometry. When using
these devices, the geometry has to be set either by using autodetection
(see section 7. How autodetection works), or by using the FDSETPRM or
FDGETPRM ioctl. The latter ioctl can be issued using the
setfdprm (see section 10.9 setfdprm) and getfdrpm
(see section 10.7 getfdprm) programs. With the default settings, common formats
are detected transparently, and you can access any disk transparently
using the variable format devices.
The geometry information is kept as long as the disk is in the drive,
and is discarded as soon as the disk is removed, unless the geometry has
been declared permanent by using setfdprm's -p flag
(see section 10.9 setfdprm).
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Fixed format devices should not be used under normal circumstances.
Fixed format devices have an intrinsic geometry. They are useful for
the fdformat program (which is now considered obsolete), and for
booting off floppies which have formats that are different from the
default format (because during booting, there is no application that can
issue the otherwise needed FDSETPRM ioctl).
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The floppy driver contains a builtin list of 32 formats. This list is used for two purposes:
The following formats (geometries) are known:
This table lists first the format_nr (0-31) used to compute the minor number, then the capacity of the format (360KB - 3200KB), and then the type of the drive in which this format is used.
The formats 0..8 are the standard PC formats. The remaining formats are extended capacity formats. Some of them have been taken from Heiko Schroeder's fdpatches (after correcting some minor bugs). Others have been added by David Niemi and me (Alain Knaff). Formats 9, 12, 13, 16, 17, 30 and 31 are non-interleaved formats with normal sized sectors, and have the highest capacity that can be achieved without resorting to interleaving or bigger sectors (6.1 More sectors per cylinder). Formats 10, 11, 14, 15, 18, 19 use interleaving interleaving to achieve a higher capacity (6.2 Using interleave). Formats 20 and 22 to 29 use bigger sectors than usual (6.5 Larger sectors and 6.6 Mixed sector size (MSS) formats).
In addition to these techniques, formats 13-19 use more cylinders than usual (6.4 More Cylinders). USE THESE FORMATS (13-19) ONLY IF YOUR DRIVE SUPPORTS THE NECESSARY NUMBER OF TRACKS
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
You can redefine the default formats using the setfdprm program (10.9 setfdprm) (1). The following example illustrates how to add a new 19 sector format, and make a device entry for it. First, we pick an entry for it, which we want to reuse. I recommend to redefine an entry which is only rarely used. For instance, if you have no 5 1/4 drive on your system, you can redefine any 5 1/4 entry without a loss. In our example, we pick 10.
First we make the device node:
mknod /dev/fd0H1520 b 2 40
^ ^ ^ ^
| | | Minor device number (format number * 4 +
| | | drive + controller*128)
| | Major device number (always 2!)
| Blockdevice
A name that you choose for the format. I
recommend to base the name on the capacity,
but you may choose any name you want.
|
Then we redefine the geometry of the new device:
setfdprm /dev/fd0H1520 1520 19 2 80 0 0x1b 0 0xcf 0x6c |
Note: This redefines the geometry for any device node with the same format number, not just the new node.
The new geometry is only valid until the next reboot (or removal of the
floppy module). In order to make it permanent, you have to execute the
setfdprm command from your `/etc/rc' file or whenever you
insert the floppy module.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
4.1 Introduction Benefits of the new representation 4.2 Syntax What a media description looks like 4.3 The media description dictionary in /etc/fdmediaprm Refer to media by a symbolic name
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Fdutils-5.0 introduces a new uniform format description, which is supported both by setfdprm and superformat. The new format description is easyer to handle, because it allows to set the different parameters of a format description in a symbolic and position independant way, using a series of variable=value clauses. Moreover, it automatically fills in sensible default values for unspecified parameters. Thus you only need to describe those aspects of the format that are important to you, and let the system handle the others.
Moreover, the new description separates those aspects that were specific to the drive (like for instance its rotation speed) from those that are specific to the media (spacial density, number of sectors, etc.).
The same description can be used both by setfdprm and superformat:
setfdprm /dev/fd0 hd sect=21 cyl=83 superformat /dev/fd0 hd sect=21 cyl=83 |
The first line above configures a 21 sector/83 cylinder format for drive 0, and the second line formats a disk using this same format.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
A media description is a series of variable=value and
selector clauses. Value is a number followed by an
optional unit. The unit is either KB (1024 bytes) or b
(blocks of 512 bytes), or none (bytes).
4.2.1 Selecting the density 4.2.2 Selecting the number of cylinders, heads and sectors 4.2.3 Selecting non-standard sector sizes 4.2.4 Legacy formats 4.2.5 Expert options
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
To select a density just insert its two letter code into the format description. Selecting a density also selects its default number of sectors, heads and cylinders. However, these latter parameters can be overridden.
hd
dd
ed
qd
sd
If no density is given, the maximal density supported by the drive is used. However, in order to keep the drive description and the media description independent, I strongly suggest that you always indicate the density anyways.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This subsection describes how to select custom formats with a non-standard number of heads, cylinders or sectors. However, note that just describing the number of sectors, heads and cylinders is not enough: you also need to indicate which density your custom format is based on (cf. previous section).
sect=nb_of_sectors
head=nb_of_heads
cyl=nb_of_cylinders
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In order to achieve a higher capacity, you may want to use a bigger sector size.
ssize=sector_size
sect=nb_of_sectors
hd sect=11
ssize=1024 describes a format where one track (1 side) is made up of 11
sectors of 1024 bytes each (thus 11KB per track, and 22KB per cylinder).
tracksize=size_of_one_track
hd tracksize=11KB
ssize=1KB describes a format where one track contains 11KB of data
(tracksize) stored in sectors of 1KB each.
This option exists mainly to describe MSS (mixed sector size) formats.
For example, hd tracksize=12KB mss describes a format where one
track which contains 12 KB of data. The sectors size are chosen by the
system in a way to take up the least raw space: 8KB + 4KB.
mss
This option says that the format is an MSS format.
2m
This option says that the format is a so-called 2M format. These formats are intended for easy readability on DOS boxes. Their first track has the usual 18 sectors, whereas the other tracks have bigger sector, and in some cases mixed sector sizes.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The swapsides format allows to descibe disks whose sides are
swapped, such as CBM1581 disks.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The following options are not needed in most common situations, as they are implied by the density selector. They may be needed to read some legacy (CP/M) formats.
tpi=48
tpi=96
fm=0
fm=1
dtr=dtr-code
dtr-code rate for FM rate for MFM ============================================= 0 250kb/s 500kb/s 1 150kb/s 300kb/s 2 125kb/s 250kb/s 3 500kb/s 1000kb/s |
perp=0
perp=1
gap=value
fmt_gap=value
fdformat program, and not by superformat.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
`/usr/local/etc/fdmediaprm' (2) contains a dictionary of commonly used media descriptions. Each description is identified by a name, which can then be used by setfdprm or superformat to refer to it, instead of an explicit description.
Each definition starts with "name":, followed by
the actual description. Definitions may be spread over several lines,
for better readability. The file may contain comments, which start with
# and stop at the end of the line.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Unlike earlyer version, fdutils-5.0 separates drive descriptions and media description. For more details on this separation, see section 4.1 Introduction. Drive descriptions are used to describe the hardware characteristics of a drive, such as their maximal density, their rotation speed, their form factor, etc.
5.1 Syntax What to put into a drive description 5.2 The drive definition file in `/usr/local/etc/fddriveprm' Where drive definitions are stored
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
A drive description is a series of variable=value and selector clauses.
5.1.1 Density The maximal available density on the drive 5.1.2 Form factor Whether this drive is a 3 1/2", 5 1/4" or 8" drive 5.1.3 Cmos code Sums up both density and form factor 5.1.4 Other parameters Rotation speed and tracks per inch
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The density of a drive is the highest media density that it supports.
Density is one of sd, dd, qd, hd or
ed. Usually, you do not need to specify this parameter, as it
can be derived from the drives CMOS code.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The form factor of a drive describes the physical dimensions of the
media it accepts. It is one of 3.5, 5.25 or 8.
Usually, you do not need to specify this parameter, as it can be derived
from the drives CMOS code.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The PC Bios already knows on its own about the most common drive types. These are named by an integer from 1 to 6, according to the following table.
0 no drive installed 1 5.25 DD 2 5.25 HD 3 3.5 DD 4 3.5 HD 5 3.5 ED 6 3.5 ED |
As you see 3.5 ED drives have two possible codes. Some BIOSes use 5, others use 6. The reason for this is that initially 5 was intended for floppy tape drives, and only 6 was for 3.5 ED drives. However, some BIOS manufacturers didn't know about this convention, and used 5 for the then "new" 3.5 ED drives.
Usually, you do not need to specify this parameter, as it can be read from the physical CMOS of your PC. This parameter may be useful if your BIOS does not store the drive's CMOS code at the expected place, or if you have more than two drives.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
deviation=deviation
Deviation is expressed in ppm. Positive values mean a higher raw
capacity than normal, and negative values mean a lower raw capacity than
normal. The deviation can be measured using the floppymeter
program.
rpm=rotation_speed
Prescribed rotation speed of the drive, expressed in rotations per minute. This is 360 for 5 1/4 HD drives, and 300 for all other commonly available drive types. Usually, you do not need to specify this parameter, as it can be derived from the drive's CMOS code. It is useful however for single density drives or other drives not commonly found on a PC. Usually, you do not to specify this parameter, as it can be derived from the drive's form factor and maximal density.
tpi=cylinder_density
This parameter is only meaningful for 5 1/4 drives. It expresses
whether the drive is able to use 80 tracks (tpi=96) or only 40
(tpi=48). Usually, you do not to specify this parameter, as it
can be derived from the drive's maximal density: quad density and high
density drives are 96 tpi, whereas double density drives are 48 tpi.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
`/usr/local/etc/fddriveprm' (4) contains a dictionary of commonly used media descriptions. Each description is identified by a name, which can then be used by setfdprm or superformat to refer to it, instead of an explicit description.
Each definition starts with "drivenumber":,
followed by the actual description. Definitions may be spread over
several lines, for better readability. The file may contain comments,
which start with # and stop at the end of the line.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This section describes the techniques that are used by Linux' floppy driver and superformat to store more data than usual on a floppy disk.
Each section contains a description of the technique used, lists the usages of the disks formatted using this technique (whether they are bootable, whether they are accessible on MS-DOS and for which kind of filesystems they are suitable) and finishes with a table listing the most interesting formats which can be obtained by the described technique.
The table lists for each format the media type it is used for, the total
capacity which can be achieved, the throughput for large reads or writes
and the media description for these disks. This description can the be
used with superformat to make such disks, or with setfdprm to configure
the drive to read/write to them. Some formats (the XDF and XXDF
formats) cannot be accessed directly, and thus there is no media
description for them. For these, we indicate a formatting command used
to make these disks. The formatting command assume that the disk is in
the first drive (/dev/fd0). Substitute /dev/fd1 if you
want to format XDF or XXDF disks in the second drive.
6.1 More sectors per cylinder Using more sectors per track by packing them close together 6.2 Using interleave Use interleave to pack the sectors even closer together 6.3 Sector skewing Speeding up multi-track reads 6.4 More Cylinders Use up to 83 cylinders 6.5 Larger sectors Minimize per byte overhead by using larger sectors 6.6 Mixed sector size (MSS) formats Minimize slack by using several sector sizes in a same track 6.7 Smart use of the data transfer rate How to get more out of your disk by playing games with the data transfer rate 6.8 2M formats Make autodetection easyer by using a readable first track 6.9 XDF formats Fast high capacity formats 6.10 XXDF formats Fast formats with even higher capacity
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The official formats used by MS-DOS and other operating systems are generally very conservative. It is often possible to fit more sectors on each track than the default by simply reducing the size of the gap between tracks and/or the size of the leftover space at the end of the disk.
For example, a 3 1/2 disk has a raw track capacity of around 12500 bytes. The raw capacity of a floppy disk is not rigorously constant among different boxes, because both the data transfer rate of the floppy controller, and the rotation speed of the drive are subject to small variations. In order to account for these, we have to use a safety margin, and we only use up 12450 bytes of the 12500 bytes that are theoretically available.
A sector contains a header of 62 bytes and 512 bytes of data. A minimum gap of about 45 bytes should be used in order to leave enough time to the floppy controller to "rest" between reading two successive sectors. In total, 619 bytes per sector are thus needed.
This shows that we can fit 12450 / 619 = 20 sectors per track.
Usage: These disks are bootable by Lilo, and can be read in
MS-DOS using numerous shareware utilities such as vgacopy, or
fdformat or many others. Check your nearest Simtel mirror.
With dos6, you don't need any add-on utilities, just put the following
line in your config.sys:
drivparm=/d:0 /f:7 /h:2 /s:21 /t:82
^ ^ \______________/
| | |
drive number | max geometry
|
drive type, consult the dos help system for details
|
Interesting Formats:
density tot. cap. throughput media description 5 1/4 DD 800KB 30KB/s dd sect=10 3 1/2 DD 800KB 25KB/s dd sect=10 3 1/2 HD 1600KB 50KB/s hd sect=21 3 1/2 ED 3200KB 100KB/s ed sect=42 |
The --dd, --hd and --ed options describe the
density of the media to be formatted (double density, high density or
extra density).
The -s options describes the number of 512 byte sectors per
track.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
After having read a sector, the floppy controller needs to "rest" for a short time. This time is used to compute checksums, to reset internal circuitry, etc. During this time, the floppy disk continues to rotate, and the "rest" time thusly translates to a certain minimal gap size. If a smaller gap is used, the next sector header flies by the read-write head before the floppy controller is ready again to pick up the data. Thus, it has to wait until the next disk rotation until that sector comes back again. This leads to an unacceptably low throughput, as now the system can only read one sector per rotation instead of all sectors in one rotation. If we want to use smaller gaps, we have thus to use sector interleaving. This technique consists in arranging the sectors in a way such that the next logical sector does not immediately follow the current sector, but instead another sector is inserted between two successive sectors. Instead of having the following order:
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21 |
we would use the following order:
1,12,2,13,3,14,4,15,5,16,6,17,7,18,8,19,9,20,10,21,11, |
This new order allows the floppy controller to rest during the whole time that sector 12 flies by between reading sector 1 and 2. This technique still cuts throughput in half, because two rotations are needed (one for reading sectors 1 to 11, and the second to read sectors 12 to 21). However, this is far better than the 21 rotations which would be needed without interleave.
This technique allows us to use a gap size of just 1, and thus fit 21 sectors on one track.
Usage: Once formatted, interleaved disks can be used in a
similar way to disks which have simply more tracks. They can be
accessed using vgacopy in Dos, you can boot from them using Lilo,
and you may install any filesystem on them.
Interesting Formats:
density tot. cap. throughput media description 5 1/4 HD 1440KB 27KB/s hd sect=18 3 1/2 HD 1680KB 26KB/s hd sect=21 3 1/2 ED 3360KB 52KB/s ed sect=42 |
You don't need to tell superformat to use interleaving, it
figures out by itself when interleaving is needed. You don't need to
tell setfdprm either that a disk is interleaved, as this
information is not needed to read the disk
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Sector skewing is a technique that allows bigger throughputs. It does not increase the capacity of the disk. Sector skewing is only relevant during formatting. Sector skewed disks are indistinguishable from non-skewed disk by software, except for a different throughput.
The principle of sector skewing is to start each track a little bit later than the previous one, i.e. the first logical sector of the second cylinder would for exemple lie near the sixth logical sector of the first cylinder. This is done in order to account for the time needed to seek the drive head from the first cylinder to the second. Without skewing, the first sector would already have passed the drive head after seeking, and we would need to wait for a whole rotation for it to come back again.
By default, superformat applies appropriate skewing to all formats, and
the listed throughput values refer to skewed disks. It is possible to
provide different values for the skew using the --head_skew and
--track_skew parameters. head_skew refers to the offset
between both sides of the same cylinder, and track_skew refers to
the offset of two consecutive cylinders. 0 means no skew.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Many nominally 40-cylinders or 80-cylinder drives are capable of more cylinders, usually 41 and 83 respectively. These can be used to get extra capacity. However, not all drives can seek to these unofficial extra cylinders, and even on drives which can, these extra cylinders tend to be less reliable.
WARNING: Although most drives are able to use 83 cylinders, some may not. If your drive is making strange noises while accessing these tracks.
Although most drives support more than 80 tracks, I have heard rumors
that some do not, and repeatedly trying to read beyond track 80 might be
damaging to them. In order to know wether your drive supports more than
eighty tracks, first set the number of allowed tracks to 82. (using
floppycontrol --cylinders 82 -d drive)
Then format a disk with a 82 track format (for example `/dev/fd0H1722'), and copy on or several files to the disk until there are less than 18 KB of free space on the disk. Then eject and reinsert the disk, and compare the files on the disk with the originals. If they are the same, your drive does support 82 tracks. If so, you might want to go further and try with 83 cylinders: `/dev/fd0H1743') This single experience should not damage the drive, although repeating it many times may be dangerous.
If you do have a drive which supports more than 80 cylinders, you have
to call floppycontrol --cylinders 82 drive before you can
use the extra cylinders. You may put this line into your
`/etc/rc.local', so that the driver is automatically configured for
the addition cylinder after each boot.
If on the other hand your drive doesn't support more than 80 tracks,
you should remove the entries for formats 13-19 from your `/dev'
directory after running MAKEFLOPPIES, and you should call
floppycontrol --cylinder 80 drive from your
`/etc/rc.local' (or floppycontrol --cylinder 40 drive
for 5 1/4 DD drives).
By default, 83 cylinder are enabled for any high density and double density drives. 3 1/2 double density drives have 80 cylinders enables, and 5 1/4 double density drives have 40 enabled.
Usage: These disks can be booted from using LILO, and can be
accessed in MS-DOS using vgacopy.
Interesting Formats:
All formats presented in the two previous sections may be amended to use
83 cylinders instead of 80. Just add the cyl=83 to the format
description for superformat. Using more cylinders has no effect on the
throughput.
density tot. cap. throughput media description 5 1/4 HD 1494KB 27KB/s hd sect=18 cyl=83 3 1/2 HD 1743KB 26KB/s hd sect=21 cyl=83 3 1/2 ED 3486KB 52KB/s ed sect=42 cyl=83 |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The floppy controller allows us to use larger sectors than the default size of 512 bytes. All powers of two larger than 256 bytes are acceptable sector sizes. Large sectors have the same header and gap sizes than smaller sectors, thus the overhead per byte of data is smaller. A little calculation shows this: A 1024 byte sector takes up at least 1024+62+1 = 1087 raw bytes. You can fit eleven sectors of this size into a 12450 byte track. This represents 11KB of data per track, versus the 10.5KB only that can be achieved with 512 byte sectors.
Usage: MS-DOS and other operating systems cannot normally read these formats. Lilo is not yet able to boot from this kind of disks.
Performance: When any portion of one of these larger sectors is read, the entire sector must be read. When any portion of such a sector is written to, the entire sector must be read, and then written back with just the necessary portion modified. Both of these circumstances can entail worse performance than are listed in this table for small reads and (especially) small writes.
Interesting Formats:
density tot. cap. throughput media description 5 1/4 HD 1440KB 30KB/s dd sect=9 ssize=1KB 3 1/2 HD 1760KB 55KB/s hd sect=11 ssize=1KB 3 1/2 ED 3520KB 110KB/s ed sect=11 ssize=2KB |
The ssize parameter of the format description indicates the
sector size to be used.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Using larger sectors has the disadvantage that the granularity is larger. For example, when using 4096 byte sectors, there is enough space to fit two sectors in a track of 12450 bytes raw capacity, but not three. However, the two sector format leaves plenty of space available (4132 bytes), in which smaller sectors would fit. For example, these 4142 raw bytes can be put to good use by filling them with a 2 KB sector (2048+62), plus an 1 KB sector (1024+62) and a 512 byte sector, leaving still 362 bytes for gaps.
Mixed sector size formats take advantage of this by using sectors of several different sizes on a same track. This way, a maximum capacity of 12KB per track, distributed in one 8k sector and one 4k sector can be achieved.
Usage: There is no known MS-DOS utility which can read basic MSS disks. Lilo is not yet able to boot from this kind of disks.
Performance: As any format with larger sectors, the performance for small reads and writes is worse due to the larger granularity.
Interesting Formats:
density tot. cap. throughput media description 3 1/2 DD 880KB 28KB/s hd tracksize=11b mss 5 1/4 HD 1600KB 30KB/s hd tracksize=10KB mss 3 1/2 DD 880KB 28KB/s hd tracksize=11b mss 3 1/2 HD 1840KB 28KB/s hd tracksize=23b mss 3 1/2 HD 1920KB 30KB/s hd tracksize=12KB mss 3 1/2 ED 3680KB 56KB/s ed tracksize=23KB mss 3 1/2 ED 3840KB 60KB/s ed tracksize=24KB mss |
For MSS formats, the system figures out the most efficient repartition
of sector sizes by itself. You do not need to describe the number of
sectors and their size. For MSS disks, the capacity of one track is
described directly, using the tracksize parameter.
The 1920KB and 3840KB formats may be unreliable on some
computers.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Due to different drive rotations speeds, 5 1/4 double density disks and 3 1/2 double density disks are accessed using different raw data transfer rates (300 kb/s for the faster spinning 5 1/4 disks, and only 250 kb/s for the slower spinning 3 1/2 disks). The method described in this section consists in using the faster data transfer rate intended for 5 1/4 disks on 3 1/2 disks, and thus boost the raw capacity per track of these disks. This is possible because 300 kb/s is still low enough not to excede the specification of the disk surface of a double density disk (which 500 kb/s would).
Usage: this method is only available for 3 1/2 double density disks. The disk obtained cannot be booted from by LILO, and are inaccessible from MS-DOS.
The following table shows the media description for a format using this method in conjuncion with the previous methods:
density tot. cap. throughput media description 3 1/2 DD 1120KB 17KB/s qd tracksize=7KB mss |
We use the QD density selector to describe this particular DTR
set-up, although the acronym QD is already taken to name 96tpi
double density 5 1/4 disks. However, as this dtr trickery is only
meaningful for 3 1/2, we hope that there will be no ambiguity.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
2M formats use a standard geometry (18 normal sized sectors) on the first side of the first cylinder, and an MSS geometry on the rest of the disk. They are inspired for Ciriaco Garcia de Celis' 2M utility for MS-DOS.
The advantage of 2M disks over simple MSS disks is twofold:
Although 2m disk have less sectors on the first track than on the others, the Linux floppy driver, and 2M's low level floppy access routines pretend that it contains the same number of sectors. The missing sectors are called phantom sectors. Writes to these sectors are ignored, and reads return random data. In order to make up for this, 2M and mtools pretend that there is a duplicate FAT in the missing sectors, which is simulated by using data from the first (real) FAT. Thus 2M disks work fine for their intended purpose, which is to hold an MS-DOS filesystem. Never use 2M disks for anything other than a MS-DOS filesystem. For example, never make an ext2 filesystem on a 2M disk. If you need a high capacity ext2 filesystem (or minix fs, raw tar or cpio archive), use the corresponding MSS format instead
Usage: 2M disks are not bootable by LILO. They can be accessed in MS-DOS using the 2M utility. 2M can be found at ftp://FTP.Coast.NET/SimTel/msdos/diskutil/2m30.zip or at any other simtel mirror. 2M disks are not suitable for non MS-DOS filesystems.
Performance: Just as with MSS disks, performance is bad for small reads and writes.
To describe a 2M format, add the keyword 2m to its media
description:
density tot. cap. throughput media description 3 1/2 HD 1840KB 28KB/s hd tracksize=23b mss 2m |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
XDF is the format used for OS/2 installation floppies.
Just like 2M, XDF uses mixed sector sizes on "generic tracks". The first cylinder uses 512 byte sectors.
However, for XDF disks, the logical order of the sectors on a given track, and their physical order is not the same. This allows a faster access, in a similar way that interleaving does for disk with normal sized sectors and too small gaps. XDF's sector arrangement allows it to read sectors alternatively from both sides, i.e. the first sector from side 0, the second from side 1, and the third from side 0 again. This differs from the usualy formats, where first the entire side 0 is read, and then the entire side 1. This technique allows to read both sides of a disk in roughly three rotations.
The following example illustrates how this is done. In our example we use the XDF format used for 3 1/2 HD disks, which contains one 8KB sector, one 2KB sector, one 1KB sector, and one 512 byte sector per track. The upper line represents the sectors on side 0, and the lower line represents the sectors on side 1. Different numbers represent different sectors. Repeated identical numbers represent a single larger sector. As the disk is circular, some sectors wrap around at the end: we find parts of the 8KB sector, represented by 6, both at the beginning and at the end of each track.
position:| 1 2 5 4
| 1234567890123456789012345678901234567890
|==========================================
side 0: | 6633332244444446666666666666666666666666
side 1: | 6666444444422333366666666666666666666666
2 512 byte sector
3 1KB sector
4 2KB sector
6 8KB sector
|
When reading a track, sectors are read in the following order:
sector id head position at start position at end
----------------------------------------------------------
3 0 3 7
4 0 9 16
6 1 18 5 (1st wrap around)
2 0 7 9
2 1 12 14
6 0 16 3 (2nd wrap around)
4 1 5 12
3 1 14 18
|
We notice that the start of each sector happens at least 2 units of position (around 300 bytes), after the end of the previously read sector, thus allowing the floppy disk controller sufficient time to rest. Moreover, we notice two wrap-arounds, yielding three rotations to read the whole cylinder (the third rotation is due to the fact that we stop at a higher position than we started, and that we also need to allow some time for seeking to the next track).
MSS or 2M formats of the same capacity nead at least 2 rotations per side (i.e. 4 per track), yielding a lower throughput.
Usage: XDF disks are not bootable by LILO. They can be
accessed from MS-DOS and OS/2 using xdfcopy.exe or
xdf.com. They are only suitable for MS-DOS filesystems. The
floppy driver has no direct support for this format yet, but
mtools is able to read them using the FDRAWCMD ioctl.
Interesting Formats:
density tot. cap. throughput formatting command 5 1/4 HD 1600KB 46KB/s xdfcopy -0 /dev/fd0 3 1/2 HD 1840KB 38KB/s xdfcopy -1 /dev/fd0 3 1/2 ED 3840KB 102KB/s xdfcopy -2 /dev/fd0 |
The options -1, -2 and -3 descibre one out of the
five formats understoood by xdfcopy (3 XDF formats and 2 XDF
formats).
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These use the simple principle as XDF, but use a higher geometry. No new principle is used, these formats are simply more daring (smaller gaps, and smaller margin at the end of the sector).
Usage: XXDF disks are not bootable by LILO, and can't be
accessed by MS-DOS. They are only suitable for MS-DOS filesystems. The
floppy driver has no direct support for this format yet, but
mtools is able to read them using the FDRAWCMD ioctl. Due
to their smaller tolerances, XXDF formats may not work on all
drives. Problems may also occur if you write to XXDF disks using a
different drive than the one you used to format the disk.
Interesting Formats:
density tot. cap. throughput formatting command 3 1/2 HD 1920KB 45KB/s xdfcopy -3 /dev/fd0 3 1/2 ED 3840KB 90KB/s xdfcopy -4 /dev/fd0 |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The principle of autodetection is rather simple. When a floppy disk is first accessed, and its geometry is not yet known, the floppy driver tries out a list of up to 8 geometries (format descriptions) until one is found that matches (i.e. that makes it possible to read the first sector or track). This list of geometries is called the autodetection list. There is one autodetection list per drive type (as indicated in the cmos).
The autodetection list doesn't contain the geometry descriptions
themselves, but rather references to entries in the geometry list
(see section 3.3 The geometry list). Each list may contain up to 8 such references.
Each reference can be tagged with a t flag. If this tag is set,
the floppy driver tries to read the whole track when trying out that
description; if it is not set, it only tries to read the boot sector.
Reading the whole track is useful to distinguish among geometries which
differ only in the amount of sectors per track. In order to do this,
put the geometry with the most sectors first in the list, and set its
t tag. Use the t tag only in this case, as it makes
autodetection slower.
Autodetection cannot distinguish between geometries that only differ in the number of heads or in the number of tracks.
Autodetection is meant to supply only a first approximation of the
actual format of the disk. It supplies enough information to enable a
program such as mtools to read the boot sector, which contains
the exact information. Mtools then uses the information
contained in the boot sector to set the exact geometry.
The autodetection list is set using the following command:
floppycontrol --autodetect list |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The following example restores the default autodetection sequence for a 3 1/2 ED drive:
floppycontrol --autodetect 7,8,4,25,28,22,31,21 |
The following example changes this sequence, so as to add the 1680KB
format (number 11). As only 8 formats are allowed in the autodetection
list, we have to dump one entry (we chose the last, which is numbered
21). The 1680KB format is identical with the default 1440KB format
except for the number of sectors. Thus we must read the whole track in
order to distinguish it from the 18 sector format (t flag).
Furthermore, the the 1680KB sector format should be detected first, as
an 21 sector disk would also matches the standard format with its 18
sectors.
floppycontrol --autodetect 11t,7,8,4,25,28,22,31 |
The following example attempts to autodetect CBM 1581 disks along with the more usual formats. CBM 1581 disks are not among the predefined formats. Thus we first have to pick one of the predefined formats and change it so it fits our needs. We may for example pick one of the rarely used 5 1/4 formats, such as h880, which bears number 20). We first make a device node bearing the requested number (so that we have a filename to pass to setfdprm), then we chmod it so it becomes accessible to mortal users, finally we configure the geometry of the new node, and enter it into the autodetection list. We place it at the 4th position, just behind the usual ED, HD and DD formats, and before the more exotic extended formats. Indeed, formats which are nearer to the head of the list are autodetected faster, and hence more commonly used formats should be put nearer to the beginning (5).
mknod /dev/fd0cbm1581 b 2 80 chmod 666 /dev/fd0cbm1581 setfdprm /dev/fd0cbm1581 DD DS sect=10 cyl=80 ssize=512 fmt_gap=35 gap=12 swapsides floppycontrol --autodetect 7,8,4,20,25,28,22,31 |
Some formats use more than 80 tracks. It is not possible for the kernel to autodetect the number of tracks in a reasonable time, so you have to use a sufficiently recent version of mtools to set the number of tracks according to the boot sector of the disk. Mtools 3.0 and up are ok. This doesn't obviously work with disks containing something else than a MS-DOS filesystem.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The floppy driver is configured using the floppy= options in
lilo. These options can be typed at the boot prompt, or entered in the
lilo configuration file.
Example: If your kernel is called linux-2.0, type the following
line at the lilo boot prompt (if you have a thinkpad):
linux-2.0 floppy=thinkpad |
linux-2.0:
append = "floppy=thinkpad" |
Several floppy related options may be given, example:
linux-2.0 floppy=daring floppy=two_fdc append = "floppy=daring floppy=two_fdc" |
If you give options both in the lilo config file and on the boot prompt, the option strings of both places are concatenated, the boot prompt options coming last. That's why there are also options to restore the default behaviour.
If you use the floppy driver as a module, use the following syntax:
insmod floppy 'floppy="options"'. (This line may be
unreadable in the info version of this document. If so, please refer to
the printed version).
Example:
insmod floppy 'floppy="daring two_fdc"' |
Note that in this case floppy= should only be typed out once,
and not once for each option. You need at least modules-1.3.57 for this
method. However, the older environment variable based syntax is still
available:
floppy="daring two_fdc" insmod floppy
setenv floppy "daring two_fdc" ; insmod floppy
Some versions of insmod are buggy in one way or another. If you have
any problems (options not being passed correctly, segfaults during
insmod), first check whether there is a more recent version. If there
isn't, use the old method using environment variables. Problems with
insmod happen mostly for options involving both a number and a
string, such as floppy=0,4,cmos. Options only involving strings,
such as floppy=daring are not affected.
The floppy related options include:
floppy=daring
floppy=0,daring
floppy=one_fdc
floppy=two_fdc
floppy=address,two_fdc