Fdutils and Mtools can be used to read and format regular and alternatively formatted diskettes on GNU/Linux and other *nix systems. At a minimum, you sould use the fdutils utility superformat to format your diskettes, and adjust your driveprm parameter. When you install Debian, at one point in the install there is warning about driveprm because the install is using superformat. You may say to yourself, this is not my beautiful floppy drive. Really, though, all floppy drives have some deviation.
The compile of both utilities is straightforward. There is a configure option, –enable-xdf, for mtools that you might want to pay attention to if that format is something you need. First off, you need to test your diskette drive and adjust driveprm using floppymeter, a utility in fdutils:
[u-1@srv-1 ~]$ floppymeter /dev/fd0 Warning: all data contained on the floppy disk will be lost. Continue? yes _____________________________________________ |rotations |average |sliding |missed | |since start|time per |average of |rotations| |of test |rotation |the last | | | |since start|10 | | | |of test |rotations | | |===========|===========|===========|=========| | 1000 | 199361 | 199357 | 0 | |___________|___________|___________|_________| capacity=199372 half bits (should be 200000 half bits) time_per_rotation=199361 microseconds (should be 200000) data transfer rate=500027 bits per second (should be 500000) deviation on capacity: -3140 ppm deviation on time_per_rotation: -3195 ppm deviation on data transfer rate: +54 ppm Insert the following line to your /usr/etc/driveprm file: drive0: deviation=-3140 |
Do what they say, and add the line. It will save time in the future. To make a normal 1.44 formatted diskette:
[root@srv-33 /]# superformat /dev/fd0 Formatting cylinder 79, head 1 mformat -s18 -t80 -h2 -S2 -M512 a: [root@srv-33 /]# mdir Volume in drive A has no label Volume Serial Number is 2239-C031 Directory for A:/ No files 1 457 664 bytes free [root@srv-33 /]# |
Woohoo! We can format floppies. 🙂 Now, for the juicy stuff. Let’s format the diskette at a higher capacity. We tested the configs on the fdutils site here, but had no luck with the 83 cylinder options. We also had a problem with the initial format. Any out there remember when 1.2 meg and 360k floppies intermingled? Well, if you formatted a 1.2 meg floppy as 360k, the 360k drive could read it, but things went nasty if the 360k drive tried to rewrite it. If you just reformatted a couple of times with the 360k drive, it would eventually work. This is a slightly different root problem, but it did inspire us to fix the initial format problem by not verifying on the first pass, and then use verify on subsequent passes. We also had problems with 83 cylinders. We used 80 instead with the -f option to skip the verify:
$ superformat /dev/fd0 tracksize=12KB cyl=80 mss -f -D a: --biggest-last Formatting cylinder 79, head 1 mformat -s24 -t80 -h2 -S7 -M512 a: $ |
The -D calls mformat, part of mtools, which creates an MS-DOS filesystem on the diskette. Now, let’s use the superverify option:
$ superformat /dev/fd0 tracksize=12KB cyl=80 mss --superverify -D a: --biggest-last Verifying cylinder 79, head 1 mformat -s24 -t80 -h2 -S7 -M512 a: |
mdir shows a directory of the MS-DOS filesystem on a:
[u-1@srv-1 ~]$ mdir Volume in drive A has no label Volume Serial Number is 3A2C-97F5 Directory for A:/ No files 1 947 648 bytes free [u-1@srv-1 ~]$ |
Let’s copy a big file to the floppy:
[u-1@srv-1 ~]$ ls -l testflop* 1944068 Jan 21 09:14 testflopfile [u-1@srv-1 ~]$ mcopy testflopfile a: [u-1@srv-1 ~]$ mdir Volume in drive A has no label Volume Serial Number is 424B-751C Directory for A:/ TESTFL~1 1944068 01-21-2003 9:15 testflopfile 1 file 1 944 068 bytes 3 072 bytes free [u-1@srv-1 ~]$ |
We were able to use mcopy to copy the file to another system, used scp to copy it to the original system, and did a diff on the files and they were identical.
Back to the theory about formatting without verify. If we take the above diskette and try to format it normally again:
[u-1@srv-1 ~]$ superformat /dev/fd0 Verifying cylinder 0, head 1 |
We see in the logs:
end_request: I/O error, dev 02:00 (floppy), sector 128 end_request: I/O error, dev 02:00 (floppy), sector 130 end_request: I/O error, dev 02:00 (floppy), sector 132 end_request: I/O error, dev 02:00 (floppy), sector 134 |
The fix, again, is to use the -f option first, and do a pass at the media. Once you do one pass at formatting the media without verify, you can format without the -f option:
[u-1@srv-1 ~]$ superformat /dev/fd0 -f Formatting cylinder 79, head 1 mformat -s18 -t80 -h2 -S2 -M512 a: [u-1@srv-1 ~]$ superformat /dev/fd0 Verifying cylinder 79, head 1 mformat -s18 -t80 -h2 -S2 -M512 a: [u-1@srv-1 ~]$ mdir Volume in drive A has no label Volume Serial Number is 219D-D628 Directory for A:/ No files 1 457 664 bytes free [u-1@srv-1 ~]$ |