COHERENT manpages
This page displays the COHERENT manpage for floppy disks [Technical Information].
List of available manpages
Index
floppy disks -- Technical Information The COHERENT system lets you read or write to floppy disks, using a variety of different formats. You can choose the format that best suits the task at hand. Disks Supported COHERENT lets you use either 3.5-inch or 5.25-inch disks, in either high or low density; what you use depends upon the type of hardware that you have. The following table gives some commonly used diskette device names and formats. The minor number of each device is also given; note that all floppy-disk devices have the major number of 4: Device NameSectors/TrackHeadsSectors BytesFormatMinor Number /dev/f9a0 9 2 720 360 KB 5.25" 12 /dev/f9a1 9 2 720 360 KB 5.25" 28 /dev/fqa0 9 2 1440 720 KB 3.5" 13 /dev/fqa1 9 2 1440 720 KB 3.5" 29 /dev/fha0 15 2 2400 1.2 MB 5.25" 14 /dev/fha1 15 2 2400 1.2 MB 5.25" 30 /dev/fva0 18 2 2880 1.44 MB3.5" 15 /dev/fva1 18 2 2880 1.44 MB3.5" 31 Device names ending in `0' indicate drive A:, names ending in `1' indicate drive B:. For a fuller description of COHERENT's floppy-disk devices, see the Lexicon entry for fd. MS-DOS Format COHERENT lets you read or write to floppy disks that contain MS-DOS file systems. Both tasks use the commands doscp or doscpdir. These commands are discussed in full in their respective Lexicon entries. To read files from an MS-DOS disk, use doscp with the name of the appropriate for the floppy-disk device that you will be using (as given in the above table). For example, to copy binary file fred.exe to the current directory from a low-density, 5.25-inch MS-DOS floppy disk in drive A, use the following command: doscp /dev/f9a0:fred.exe . The following command copies to the current directory all files on a high- density, 5.25-inch MS-DOS floppy disk in drive B: doscp /dev/fha1:\* . To write a file to a preformatted MS-DOS floppy disk, again use the doscp command, but invert the order of the arguments. For example, to write file fred.ms, which contains text, to a low-density, 5.25-inch MS-DOS floppy disk in drive A, use the following command: doscp -a fred.ms /dev/f9a0: Note that the `a' flag in the command line tells COHERENT to convert linefeeds to the linefeed/carriage return combination, as used by MS-DOS. You will want to use this flag only when transferring text files to or from an MS-DOS floppy disk. The following command copies all files in the current directory to a high- density, 3.5-inch MS-DOS floppy disk in drive B: doscpdir . /dev/fva1: Note that when you copy a file to an MS-DOS floppy disk, COHERENT observes the MS-DOS file-name conventions: it permits only eight characters to the left of the period, and only three characters to the right of it. (It should be noted in passing that you can use the doscp or doscpdir to read files from or write files to an MS-DOS partition on your hard disk. All that is necessary is to replace the name of floppy-disk device with that of the hard-disk device for the partition in question. See the Lexicon entry for at for a list of hard-disk devices; see the entry for fdisk for information on how to read the layout of your hard disk; and see the entries for doscp and doscpdir for details of how to use these commands.) Finally, COHERENT lets you format a floppy disk and create an MS-DOS file system on it. To do so, you must use the commands fdformat and dosformat. fdformat is described in detail in its Lexicon article. To format a high-density, 5.25-inch floppy disk in drive B and write an MS- DOS file system onto it, use the following commands: /etc/fdformat -av /dev/fha1 dosformat /dev/fha1: COHERENT Format If you wish, you can create a COHERENT file system on a floppy disk, mount it, and use standard COHERENT commands to manipulate the files on it. This illustrates well the fact that to COHERENT a file system is a file system, whether it resides on a hard, a floppy disk, or any other mass-storage device. You can use such mountable floppy disks as an easy method of backing up files, or as a flexible extension to any other file system that you have currently mounted. To create a COHERENT file system on a floppy disk, you must use the commands fdformat and mkfs. Each is described in detail in its own Lexicon article. The following example creates a COHERENT file system on a high- density, 3.5-inch floppy disk placed in drive B: /etc/fdformat -av /dev/rfva1 /etc/mkfs /dev/fva1 2880 In this example, command fdformat formatted the disk. The option -v tells fdformat to use its verification mode. This takes longer, but ensures that the disk is good. If this command fails, it means that the floppy disk has a bad block or sector: throw it away and try again. Command mkfs builds a COHERENT file system on the disk. The file system has 2,880 blocks (1.44 megabytes) of space, which is appropriate for a high-density, 3.5-inch floppy disk. Now that the file system is created on the disk, you must mount it. To do so, use the script mount; this is described in its Lexicon entry. This mounts the file system on directory /f0 if the disk drive is drive 0 (A:); or f1 if the disk drive is drive 1 (B:). While it is customary to mount file systems under directory `/', you are not required to do it. For example, if your login identifier is fred and your home directory is /usr/fred, you can mount the floppy disk's file system onto a subdirectory of /usr/fred and so make the floppy disk, in effect, an extension of your home directory. To mount a floppy on a directory other than its default, use the command /etc/mount. The following command does this for the 3.5-inch disk we formatted in the above example: /etc/mount /dev/fva1 /usr/fred/temp Now, all files you copy into directory /usr/fred/temp using the cp command will be written directly onto the floppy disk. Note that you may need to log in as the superuser root and use the command chown to ensure that fred owns the file system on that floppy disk. For details on chown, see its entry in the Lexicon. For details on shorthand notations for mount, see its entry in the Lexicon. One important point about mounting file systems: before you remove a COHERENT-formatted floppy disk from its drive, you must first use the command /etc/umount to unmount its file system. If you do not, all data that COHERENT has stored in its buffers will not be written to the disk, and may be lost. Worse, if you remove one COHERENT disk and insert another without unmounting the old disk and mounting the new one, COHERENT will write all data in its buffers onto the new disk without regard for what that disk contains; in all likelihood, this will trash the file system on the new disk and render its data unreadable. So, the lesson is: always unmount a floppy disk before you remove it!. To unmount the floppy disk we used in our previous example, use the command: /etc/umount /dev/fva1 By the way, that's not a misprint: the command is umount, not ``unmount''. Finally, please note that you can mount only a COHERENT file system. You cannot mount a file system created with MS-DOS, XENIX, or any other operating system. You can, however import a set of files -- including their directory structure -- from UNIX, XENIX, or any other UNIX-like operating system by using the utilities. cpio or tar. Each of these utilities uses a backup algorithm that is implemented on many operating systems. To import files from another operating system, go to the machine that holds the files you want and use its version of cpio or tar to back up the files or directories to a set of floppy disks or cartridge tape. Then bring the floppy disks back to your COHERENT system and use COHERENT's implementation of cpio to read the back-up disks. The following section gives directions on how to do this; or see the Lexicon entries for cpio and tar for more information. Raw Format Finally, COHERENT lets you use floppy disks in their raw form as a backup medium, much as you would use magnetic tape on a larger computer. You must first use the command /etc/fdformat with the -v option to format the floppy disks you will be using; it is also wise to label and number the disks so you can keep them in some reasonable order. Then you can use any of COHERENT's archiving utilities, such as tar or cpio, to archive directories or entire file systems onto the disks. It is recommended that you format a generous supply of floppy disks before you begin; if you run short of disks while archiving your files, you will have to abort, format more disks, and begin again. For details on how to use the archiving programs, see their respective entries in the Lexicon. Interleave The ``interleave'' of a disk device refers to the pattern with which blocks are scattered around a disk cylinder. It can have a drastic effect on the speed with which data are read from and written to a disk. The interleave is set by the file system written onto that disk. Thus, under COHERENT the interleave is set by the command /etc/mkfs. By default, this command sets the interleave pattern to six. You can request a different interleave pattern; however, the proper interleave for a floppy disk can vary wildly, depending upon what disk drives you have, your CPU speed, amount of RAM, and several other variables. The best way to discover the interleave pattern is to experiment. The following script, by Fred Smith (fredex%fcshome@merk.merk.com), formats a floppy disk to a specified set of factors, generates a file system, and runs a program to exercise it. By running this program with a number of different settings, you can find which is best for your system. You will find this to be especially helpful if you work frequently with floppy disks: # usage: doit <interleave> <skew> <device name> <tracks (not sectors) per drive> # for a 3.5dshd in drive 1: sh doit 3 6 fva1 2880 # for a 5.25dshd in drive 0: sh doit 3 6 fha0 2400 # assumes that iozone is in the current directory, and that there is a # subdirectory named 'test', over which the floppy can be mounted. echo /etc/fdformat -a -i $1 -o $2 /dev/r$3 /etc/fdformat -a -i $1 -o $2 /dev/r$3 /etc/badscan -v -o flop /dev/$3 $4 # in case you want to modify the permissions of the new file system. # if you don't want to do the vi, then run this as root. #vi flop /etc/mkfs /dev/$3 flop /etc/mount /dev/$3 ./test cd test ../iozone cd .. /etc/umount /dev/$3 Debugging Floppy-Disk Problems The COHERENT floppy-disk driver has been used frequently by tens of thousands of users over a number of years, and has been found to be sound. However, from time to time a problem can arise. This usually occurs when users install new equipment into their systems. If you continually see error messages that indicate a problem with the floppy-disk drive, e.g., door open, try the following steps to diagnose the problem: 1. Is CMOS configured for the floppy-disk drives? The CMOS on your machine may have been ``clobbered'' by an event that has nothing to do with COHERENT -- e.g., a power surge. To check your CMOS, you can reboot your system; the BIOS on practically every computer includes a program for reading and resetting the CMOS. Or, you can read the output of device /dev/cmos. The Lexicon entry cmos describes how to interpret the output of this device. 2. If you have switched hard drives, did you change IDE controllers or alter any jumpers? If the same card controls both floppy and hard drives, you may have moved a jumper wrongly. It may also be that the new controller has a bug. 3. Try using the command /etc/conf/bin/idtune to change the value of variable FL_DSK_CH_PROB; then use the command /etc/conf/bin/idmkcoh to link a new kernel, and boot the new kernel. To check the current value of that variable (or of any tunable variable), use the command idtune -p. 4. Is any other equipment conflicting with the drive in question, such as a QIC-80 or QIC-40 tape drive? Try pulling the device in question, and see if that makes the problem go away. 5. Check that all cables are secure and all cards seated properly. If your machine is loaded with equipment, its interior can be a rat's nest of cables and connectors; and while installing new equipment, it is easy to loosen a cable or jar a card so that it no longer works. 6. Try the following command with a floppy disk in place, just after you have booted COHERENT and before any other access to the drive: dd if=/dev/rdev of=/dev/null count=2 bs=30b dev is names the floppy-disk device in question, e.g., fha0 or fva1. This command may help if the driver is not getting the recalibration status it expects. 7. If all else fails, try swapping out the controller or drive. It may be that the device simply has failed. See Also Administering COHERENT, badscan, cpio, doscp, doscpdir, dosformat, fd, fdformat, gtar, mkfs, mount, umount Notes You can create a version of the COHERENT operating system that runs from a floppy disk. Such a version of COHERENT can be used to create test or backup systems for device drivers or other applications. For directions on how to make a version of COHERENT that boots from a floppy disk, see the Lexicon entry booting.