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.
_D_e_v_i_c_e _N_a_m_S_e_e_c_t_o_r_s_/_T_r_a_c_k_H_e_a_d_s_S_e_c_t_o_r_s _B_y_t_e_s_F_o_r_m_a_t_M_i_n_o_r _N_u_m_b_e_r /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.
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 ffrreedd..eexxee 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 ffrreedd..mmss, 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 _o_n_l_y 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:
To create a COHERENT file system on a floppy disk, you must use the commands ffddffoorrmmaatt and mmkkffss. 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 //ff00 if the disk drive is drive 0 (A:); or ff11 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 ccpp 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 mmuusstt 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: _a_l_w_a_y_s _u_n_m_o_u_n_t _a _f_l_o_p_p_y _d_i_s_k _b_e_f_o_r_e _y_o_u _r_e_m_o_v_e _i_t_!. 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 _c_a_n_n_o_t mount a file system created with MS-DOS, XENIX, or any other operating system.
You can, however _i_m_p_o_r_t 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.
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
dd if=/dev/r_d_e_v of=/dev/null count=2 bs=30b