You are not logged in.

#1 2013-12-22 00:52:00

jmetal88
Member
Registered: 2007-12-09
Posts: 85

Tips for working with USB floppy drives

I was just wondering if anyone had any tips on working with USB floppy drives in Archlinux.

One thing I've noticed is that trying to use mkfs.msdos on my USB floppy drive directly doesn't seem to result in a usable disk (it's mountable, but reports that I don't have enough space available to copy files), but if I use the command on an image file the same size as a floppy disk and then use dd to copy the blank image to my USB drive I get a disk that's perfectly usable.  Anybody know what the deal is with that or how I might be able to successfully format a disk in fewer steps (other than keeping the blank images around and just using dd to format the floppies, haha)?

Also, I'd like to hear any other tips or tricks any of you have for working with USB floppy drives.  They just seem so much more usable under Windows as opposed to Linux, and that disappoints me a little.

Offline

#2 2013-12-22 01:15:34

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: Tips for working with USB floppy drives

I don't have any suggestions for you, but I just have to ask - why are still using floppies?? smile

Offline

#3 2013-12-22 01:37:29

jmetal88
Member
Registered: 2007-12-09
Posts: 85

Re: Tips for working with USB floppy drives

I'm a vintage computer enthusiast.  Sometimes the best option for copying files to one of my older machines is a floppy disk.

Offline

#4 2013-12-26 22:38:37

jmetal88
Member
Registered: 2007-12-09
Posts: 85

Re: Tips for working with USB floppy drives

I guess I'm the only Arch user that still uses floppies at all.  Good to know.

Offline

#5 2013-12-26 23:07:14

alphaniner
Member
From: Ancapistan
Registered: 2010-07-12
Posts: 2,810

Re: Tips for working with USB floppy drives

I have a USB floppy drive at work, but I've never had much need to use it in Linux. I don't know the proper way to format a floppy, so I tried mkfs.msdos -I /dev/sdX. That worked and seemed to give me full capacity. I used dd to create a single file to fill up the fs, 1454080 bytes were written. I was able to open it on an XP box and the file was accessible and intact.


But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner

Offline

#6 2013-12-27 00:09:02

jmetal88
Member
Registered: 2007-12-09
Posts: 85

Re: Tips for working with USB floppy drives

Hmm. That gives me two thoughts. First, that my problem may be related to the controller in my floppy drive. Second, that my problem may be related to the fact that I was initially trying to format a 720k floppy. I haven't tried with a 1.44M floppy, but I know that when I tried to
format a 720k floppy using that command it reported that the disk was out of space as soon as I tried to copy something.

Offline

#7 2013-12-27 18:58:42

amvakar
Member
Registered: 2013-12-04
Posts: 21

Re: Tips for working with USB floppy drives

ufiformat will do an actual low-level format of the disk, and also show what the drive can handle with the

ufiformat -i

command. You're limited to what the controller explicitly supports, as USB abstracts away the baroque interface a standard drive presents.

Offline

#8 2013-12-27 20:29:30

jmetal88
Member
Registered: 2007-12-09
Posts: 85

Re: Tips for working with USB floppy drives

Well, the drive handles 720k disks just fine in Windows, and works with Linux if I use the dd method of formatting like I described above.  I have not tried ufiformat, though, so I will do so and post back about my results.

Offline

#9 2013-12-27 20:47:49

jmetal88
Member
Registered: 2007-12-09
Posts: 85

Re: Tips for working with USB floppy drives

Okay, thanks guys.  I haven't figured out the issue yet, but you're helping me narrow it down.  I decided to run a df -h command after each try of formatting the disk this time.  I tried the low-level ufiformat command followed by a mkfs.msdos on the device, using a 720k disk, and df -h showed 700k free on the file system.  It's just not making the file system large enough (I believe the file I was trying to copy over was 710k or so).  When I run mkfs.msdos on a 720k disk image and then dd the image over to the drive, df -h shows 713k free after mounting the drive.  Any idea why mkfs.msdos isn't filling out the full 720k on the disk itself, but is on the image?

Offline

#10 2013-12-28 01:55:44

amvakar
Member
Registered: 2013-12-04
Posts: 21

Re: Tips for working with USB floppy drives

jmetal88 wrote:

Okay, thanks guys.  I haven't figured out the issue yet, but you're helping me narrow it down.  I decided to run a df -h command after each try of formatting the disk this time.  I tried the low-level ufiformat command followed by a mkfs.msdos on the device, using a 720k disk, and df -h showed 700k free on the file system.  It's just not making the file system large enough (I believe the file I was trying to copy over was 710k or so).  When I run mkfs.msdos on a 720k disk image and then dd the image over to the drive, df -h shows 713k free after mounting the drive.  Any idea why mkfs.msdos isn't filling out the full 720k on the disk itself, but is on the image?

I would assume this happens because (as far as I can tell from skimming through the source over the course of a few minutes) mkfs.fat only applies floppy size heuristics to fd and lo devices -- your USB floppy drive is treated as a hard drive, and that leads to less-than-ideal default parameters. Run

fsck.fat -v

on the more spacious filesystem to figure out what options need to be set when you attempt formatting an actual disk. Or just make things easier by keeping newly-formatted blank disk images on hand so that dd and (maybe) ufiformat are all you need to worry about.

Offline

#11 2013-12-28 05:12:41

jmetal88
Member
Registered: 2007-12-09
Posts: 85

Re: Tips for working with USB floppy drives

That was a good tip.  Thanks!

Looks like the command I need to use to format a 720k floppy (and still get the same results as with the dd image) is:

mkfs.msdos -I -M 0xF9 -r 112 -s 2 -S 512 /dev/sdb

Provided, of course, my floppy drive is attached as sdb.

For a 1.44M floppy, the command SHOULD be:

mkfs.msdos -I -M 0xF0 -r 224 -s 1 -S 512 /dev/sdb

But mkfs complains that 0xF0 is not a valid media descriptor and refuses to perform the format (even though it writes 0xF0 to the 1.44M image file automatically).  I consider that a bug that should be fixed as 0xF0 is definitely the proper media descriptor for a 3.5" HD floppy.  How would I report this so it can be fixed?

EDIT: I found the e-mail address of someone claiming to maintain the dosfstools package.  I'll e-mail him and see what he says about it.

Last edited by jmetal88 (2013-12-29 20:52:49)

Offline

#12 2013-12-28 16:40:55

amvakar
Member
Registered: 2013-12-04
Posts: 21

Re: Tips for working with USB floppy drives

What is the exact output run with the  -v option? There is most certainly a bug, even in the manpage if you check the description of the -M option ("This value is usually 0xF8 for hard disks and has a value from 0xF9 to 0xFF for floppies..."). It seems to have been written with only 5.25" disks in mind.

Offline

#13 2013-12-29 05:49:41

jmetal88
Member
Registered: 2007-12-09
Posts: 85

Re: Tips for working with USB floppy drives

For the 1.44M image (formatted with 'mkfs.msdos ./floppy144.img', no options specified):

fsck.fat 3.0.24 (2013-11-23)
fsck.fat 3.0.24 (2013-11-23)
Checking we can access the last sector of the filesystem
Boot sector contents:
System ID "mkfs.fat"
Media byte 0xf0 (5.25" or 3.5" HD floppy)
       512 bytes per logical sector
       512 bytes per cluster
         1 reserved sector
First FAT starts at byte 512 (sector 1)
         2 FATs, 12 bit entries
      4608 bytes per FAT (= 9 sectors)
Root directory starts at byte 9728 (sector 19)
       224 root directory entries
Data area starts at byte 16896 (sector 33)
      2847 data clusters (1457664 bytes)
18 sectors/track, 2 heads
         0 hidden sectors
      2880 sectors total
Checking for unused clusters.
./floppy144.img: 0 files, 0/2847 clusters

So the automatic decision making in the thing definitely writes 0xF0 as the media descriptor of the image file, which makes it extremely perplexing to me that the program wouldn't allow specifying it explicitly.

By the way, I've received no response from the supposed maintainer of dosfstools yet.  Although now that I've done another Google search, I've come up with a completely different person who claims to be the current maintainer, so perhaps I sent the e-mail to a past maintainer who just hasn't admitted abandoning the thing yet.

Offline

#14 2013-12-29 18:12:35

amvakar
Member
Registered: 2013-12-04
Posts: 21

Re: Tips for working with USB floppy drives

I actually meant for the real floppy disk, as I might be able to better figure out where it decides 3.5" disks don't exist. Though I'll probably just see if I can clean up the floppy size logic and add a command line switch to force its use.

Offline

#15 2013-12-29 20:41:23

jmetal88
Member
Registered: 2007-12-09
Posts: 85

Re: Tips for working with USB floppy drives

Now I'm not actually sure what you want me to do.  Do you want one from a properly formatted floppy or one that I've used the mkfs.msdos command on without any options except -I?  I guess I could just post both and let you compare.  Just give me a minute and I'll post another reply with those results.  I would assume, from the error I'm getting, that the problem is just an arbitrary limit set on the -M switch option, where it never accepts values less than 0xF8 or above 0xFF, but since I haven't looked at the source code (and doubt that I would fully understand what I was looking at if I did) I guess I'll have to trust that you know more about it than I do.

Offline

#16 2013-12-29 20:45:34

jmetal88
Member
Registered: 2007-12-09
Posts: 85

Re: Tips for working with USB floppy drives

Here is the result from a Windows-formatted floppy, written using a 'real' floppy drive, and read back on Linux using the USB floppy drive:

fsck.fat 3.0.24 (2013-11-23)
fsck.fat 3.0.24 (2013-11-23)
Checking we can access the last sector of the filesystem
Boot sector contents:
System ID "MSDOS5.0"
Media byte 0xf0 (5.25" or 3.5" HD floppy)
       512 bytes per logical sector
       512 bytes per cluster
         1 reserved sector
First FAT starts at byte 512 (sector 1)
         2 FATs, 12 bit entries
      4608 bytes per FAT (= 9 sectors)
Root directory starts at byte 9728 (sector 19)
       224 root directory entries
Data area starts at byte 16896 (sector 33)
      2847 data clusters (1457664 bytes)
18 sectors/track, 2 heads
         0 hidden sectors
      2880 sectors total
Checking for unused clusters.
/dev/sdb: 0 files, 0/2847 clusters

Offline

#17 2013-12-29 20:47:31

jmetal88
Member
Registered: 2007-12-09
Posts: 85

Re: Tips for working with USB floppy drives

Whereas, a disk formatted directly on the USB floppy drive using 'mkfs.msdos -I /dev/sdb' comes up with this, instead:

fsck.fat 3.0.24 (2013-11-23)
fsck.fat 3.0.24 (2013-11-23)
Checking we can access the last sector of the filesystem
Boot sector contents:
System ID "mkfs.fat"
Media byte 0xf8 (hard disk)
       512 bytes per logical sector
      2048 bytes per cluster
         1 reserved sector
First FAT starts at byte 512 (sector 1)
         2 FATs, 12 bit entries
      1536 bytes per FAT (= 3 sectors)
Root directory starts at byte 3584 (sector 7)
       512 root directory entries
Data area starts at byte 19968 (sector 39)
       710 data clusters (1454080 bytes)
3 sectors/track, 1 heads
         0 hidden sectors
      2880 sectors total
Checking for unused clusters.
/dev/sdb: 0 files, 0/710 clusters

Offline

#18 2013-12-29 20:50:37

jmetal88
Member
Registered: 2007-12-09
Posts: 85

Re: Tips for working with USB floppy drives

As you can see, mkfs.msdos formats the image file practically identically to the way that Windows formats a real floppy disk (with the exception of the System ID), but tries to format a real floppy disk in a USB drive the way it would format a hard drive instead.  This would easily be overcome by specifying the options manually, if only mkfs.msdos would allow me to specify 0xF0 as the media descriptor.

EDIT:  If you want me to post a similar comparison for a 720k disk (in case you're thinking of trying to add automatic detection in or something), let me know, although the program doesn't have a problem with me manually specifying the media descriptor for those.

Last edited by jmetal88 (2013-12-29 20:52:29)

Offline

#19 2014-01-01 13:46:21

Andreaskem
Member
Registered: 2013-10-13
Posts: 67

Re: Tips for working with USB floppy drives

jmetal88 wrote:

By the way, I've received no response from the supposed maintainer of dosfstools yet.  Although now that I've done another Google search, I've come up with a completely different person who claims to be the current maintainer, so perhaps I sent the e-mail to a past maintainer who just hasn't admitted abandoning the thing yet.

Dosfstools seems to be actively maintained (last release on  Sat, 23 Nov 2013) here. A look at the last commit will give you the name and the e-mail address of the current (as of 5 weeks ago) maintainer. If he doesn't react to your e-mail, you could maybe talk to him on IRC. According to his website, he's dba on irc://irc.oftc.net. (Also: Maybe he took some time off over the holidays).

Last edited by Andreaskem (2014-01-01 14:14:05)

Offline

Board footer

Powered by FluxBB