floppy(7) — Series 700 Only
NAME
floppy − direct flexible or “floppy” disk access
DESCRIPTION
Flexible disk devices are removable-media disk devices that are typically used to share data with other systems. Media types are identified by physical size (such as 3.5-inch and 5.25-inch), number of data surfaces (or sides), and data density. By convention, flexible disk devices are named using the same conventions as those used for other disk devices (see disk(7)), with the exception that the device special files reside in the directories: /dev/rfloppy/ and /dev/floppy/.
Data can be stored on flexible disk media in a variety of logical formats. The capacity of these devices is generally too small to hold useful HP-UX file systems. Instead, DOS or LIF file systems (see dosif(4) and lif(4) for a detailed description of these file systems) are commonly used. Data can also be stored in an archive-utility format. For example, tar and cpio are commonly used to share data with other HP-UX systems (see tar(1) and cpio(1)).
In addition to the various logical formats, data can be stored on flexible disk media in a variety of physical data formats called geometries. The following parameters are used to describe a flexible disk geometry:
heads Number of surfaces (or sides) on the media that contain valid data.
tracks Number of tracks on a single media surface or side (the term cylinders is sometimes also used). This value does not include spare tracks.
sectors Number of sectors in a single track. The number of sectors that can fit on a track depends on the bit density (as controlled by transfer rate and media rotation rate) and the sector size.
sector size Number of bytes in a logical sector. Since all I/O operations must be an integral number of sectors in length, this parameter also indicates the minimum character-special file I/O size.
transfer rate Media data rate in Kbits per second. The transfer rate is an indirect means of representing bit density. Bit density is measured in bits per radian, and is the formal intra-track data density parameter for standard specification. Transfer rate is generally used to program flexible media devices and is therefore more appropriate for this interface. Since the media rotation rate for most flexible disk devices is standard, conversion between these two representations is straight-forward.
track density Number of tracks per inch. Some low density formats can be supported on high-density drives by skipping tracks during head stepping.
data encoding Encoding method used to store data. FM (frequency modulation) and MFM (modified frequency modulation) are the most common encoding methods.
The following table shows some useful flexible disk media geometries (without density information). The right-most column indicates which mediainit -f option should be used to format media to the indicated geometry (see mediainit(1M)).
| Media Type | Use | Capacity | Heads | Tracks | Sectors | Sector Size | -f |
| 3.5in DS DD | 630,784 | 2 | 77 | 16 | 256 | 1 | |
| 3.5in DS DD | 655,360 | 2 | 80 | 16 | 256 | 21 | |
| 3.5in DS DD | 655,360 | 2 | 80 | 8 | 512 | 26 | |
| 3.5in DS DD | 709,632 | 2 | 77 | 9 | 512 | 2 | |
| 3.5in DS DD | DOS 720K | 737,280 | 2 | 80 | 9 | 512 | 16 |
| 3.5in DS DD | 788,480 | 2 | 77 | 5 | 1024 | 3 | |
| 3.5in DS HD’ | DOS 1.2M | 1,228,800 | 2 | 80 | 15 | 512 | 26 |
| 3.5in DS HD’ | 1,261,568 | 2 | 77 | 8 | 1024 | 22 | |
| 3.5in DS HD | 1,261,568 | 2 | 77 | 32 | 256 | 1 | |
| 3.5in DS HD | 1,419,264 | 2 | 77 | 18 | 512 | 2 | |
| 3.5in DS HD | DOS 1.44M | 1,474,560 | 2 | 80 | 18 | 512 | 16 |
| 3.5in DS HD | 1,567,960 | 2 | 77 | 10 | 1024 | 3 | |
| 3.5in DS HD | 1,638,400 | 2 | 80 | 10 | 1024 | 23 | |
| 5.25in DS | DOS 360K | 368,640 | 2 | 40 | 9 | 512 | 2 |
| 5.25in DS DD | 655,360 | 2 | 80 | 8 | 512 | 26 | |
| 5.25in DS HD | DOS 1.2M | 1,228,800 | 2 | 80 | 15 | 512 | 16 |
| 5.25in DS HD | 1,261,568 | 2 | 77 | 8 | 1024 | 24 |
The following table shows the density information for some standard flexible disk media.
| MediaType | BitDensity | RPM | TransferRate | TrackDensity | DataEncoding |
| 3.5in DS DD | 7,958 | 300 | 250 | 135 | MFM |
| 3.5in DS HD’ | 13,262 | 360 | 500 | 135 | MFM |
| 3.5in DS HD | 15,916 | 300 | 500 | 135 | MFM |
| 5.25in DS | 7,958 | 300 | 250 | 48 | MFM |
| 5.25in DS DD | 7,958 | 300 | 250 | 96 | MFM |
| 5.25in DS HD | 13,262 | 360 | 500 | 96 | MFM |
Abbreviations are interpreted as follows:
DS Double-sided media
DD Double-density media
HD High-density media
HD’ High-density media (alternate media rotation rate)
Normally each open() call causes the device and/or floppy device driver to attempt to determine the geometry of the installed media. As a result, the current flexible disk geometry is set to the supported geometry that matches the physical data format on the media currently installed in the device. To maintain reasonable open times, not all possible media geometries are checked. Therefore, it is possible that a flexible disk medium may contain valid data even though its format is not recognized. This automatic geometry sensing functionality may be disabled in some drivers by use of the O_NDELAY flag in the open() call or device driver dependent minor numbers.
The FLOPPY_GET_INFO ioctl indicates the characteristics and current status of a floppy device. Information for interpreting the media and data_encoding fields can be found in <sys/floppy.h>. The following macros are defined for decoding the status and valid fields. These macros return a non-zero (true) value for the associated conditions.
FLOPPY_NO_MEDIA(x) /∗ Drive is empty ∗/
FLOPPY_BLANK_MEDIA(x) /∗ Media geometry is not recognizable ∗/
FLOPPY_WRITE_PROT(x) /∗ Media is write protected ∗/
FLOPPY_MEDIA_CHANGED(x) /∗ Media has changed since last status ∗/
FLOPPY_HIGH_DENSITY(x) /∗ Media has high density indication ∗/
Some floppy devices or floppy device drivers may be unable to determine some status information. The valid field indicates whether or not the corresponding status information is meaningful. Applying a macro to the valid field indicates whether or not the application of that same macro to the status field results in a valid device status.
The FLOPPY_GET_GEOMETRY ioctl can be used to determine the flexible disk device’s current media geometry. Current geometry parameters are indicated in the fields of the resultant floppy_geometry structure.
The FLOPPY_SET_GEOMETRY ioctl can be used to specify the desired media geometry. Exclusive access to the device, obtained through use of the DIOC_EXCLUSIVE ioctl (see disk(7)), is required prior to setting the media geometry. Exclusive access is necessary to ensure that other applications are not affected.
The FLOPPY_FORMAT_TRACK ioctl can be used to reformat a media track. Exclusive access to the device, obtained through use of the DIOC_EXCLUSIVE ioctl (see disk(7)), is required prior to reformatting to ensure that other applications are not affected.
Flexible disk devices support the generic disk ioctls (see disk(7)), typically used for hard disk devices. Flexible disk device drivers may also support driver specific ioctls (see the appropriate driver manual section).
The header file <sys/floppy.h> has useful information for flexible-media device control. The following is included from <sys/floppy.h>:
/* ioctls for flexible (floppy) disk devices */
#define FLOPPY_GET_INFO _IOR(’F’, 1, struct floppy_info)
#define FLOPPY_GET_GEOMETRY _IOR(’F’, 2, struct floppy_geom)
#define FLOPPY_SET_GEOMETRY _IOW(’F’, 3, struct floppy_geom)
#define FLOPPY_FORMAT_TRACK _IOW(’F’, 4, struct floppy_format)
/* structure for FLOPPY_GET_INFO ioctl */
struct floppy_info {
unsigned media;
unsigned status;
unsigned valid;
};
/* structure for FLOPPY_GET_GEOMETRY and FLOPPY_SET_GEOMETRY ioctls */
struct floppy_geometry {
unsigned heads;
unsigned tracks;
unsigned sectors;
unsigned sector_size;
unsigned transfer_rate;
unsigned track_density;
unsigned data_encoding;
};
/* structure for FLOPPY_FORMAT_TRACK ioctl */
struct floppy_format {
unsigned head;
unsigned track;
unsigned interleave;
};
ERRORS
The following errors can be returned by a flexible-disk device-driver call:
[EACCES] Required permission is denied for the the device or operation.
[ENXIO] If resulting from an open call, this indicates there is no device at the specified address. For other calls, this indicates the specified address is out of range or the device can no longer be accessed.
[EINVAL] From an open() call: the device is not a floppy device. For other calls: Invalid request or parameter.
[EIO] I/O error (e.g., media defect or device communication problem).
WARNING
A floppy disk containing a mounted file system should not be removed prior to being unmounted. Removal of floppy disks containing mounted file systems is likely to result in file system errors, and system panics.
Reformatting flexible disk media from one geometry to another that differs only in that it has fewer tracks can cause the automatic geometry sensing functionality of open() to fail to recognize the new media geometry. Bulk erasing (degaussing) the media or formatting the media to a substantially different geometry prior to reformatting prevents automatic geometry sensing problems.
Single track formatting may not be supported by some floppy devices.
Some devices permit configuration for geometries which they are unable to support. The FLOPPY_SET_GEOMETRY ioctl for such a configuration may not result in an error. However, subsequent I/O operations will fail.
DEPENDENCIES
Devices and Drivers
Geometry support varies, depending on device and device driver capabilities.
SEE ALSO
disk(7), mediainit(1M), mknod(1M), dosif(4), lif(4).
— April 21, 1994