Unix/Linux Basics: Floppy Disks

If you are coming from the Windows world, Unix floppy drives are going to seem really dumb. In Windows, the drive is just there: you pop it open in My Computer, the files are visible, you run the program you want or just drag files off to your hard drive. Simple.

Unix makes it much harder. You gain something because it's harder, but that gain is not obvious at first, and if you don't need anything but the simple Windows like access, you may feel that the Unix way is dumb. It really isn't, so grit your teeth and bear with me.


Windows and DOS people are used to using floppy drives as file systems. Unix folk are more apt to use floppies like you'd use a tape (Unix floppies CAN be used the Windows way, it's just not typical). Because of that basic culture clash, you need to understand some differences:

Formatting

When you use "format" in Windows or DOS, you actually get much more than a format: you also get a file system. That's why you can copy files to A:, that's why it looks just like your C: drive, only smaller.

When you format in Unix, you don't get a file system. Of course you can get one if you want it, but that's a separate command: mkfs (or, for a more friendly front-end [SCO]: mkdev fd).

So when you stick a floppy into a Unix box, you can't just copy files to it or from it as you would in DOS. If you did want to use it that way, you'd need to make a filesystem on it, and then mount that filesystem into your hierarchy.

A floppy filesystem does allow you to transfer files from one place to another by way of a shirt pocket. However, a file system has a fair amount of overhead (which means that it will hold less data) and absolutely cannot carry files bigger than 1 floppy in size. In Dos or Windows if we want to copy a big file like that, we might use an archive program like Zip or just use the BACKUP program to span the file across multiple file systems. Unix has things like Zip, and has tools like BACKUP. The common Unix tools are "tar" and "cpio", which are very similar to BACKUP in concept and use, but they dispense with the unnecessary file system for such tasks. Why waste the space? By not having a file system, there is less overhead, and (probably more importantly) you can split large files across multiple floppies, or just put lots of files out there without worrying about when you will run out of space- because tar and cpio will tell you when they need another floppy.

Some old versions of tar don't understand splitting files across multiple volumes. Newer versions do, and some of the newest also offer the ability to compress while creating the archive. There are third party tar compatible programs, too: see The Supertars


I'm going to assume that your floppy is a 3.5 inch 1.44 MB and that it is unit 0. If that's true, you could put everything in /usr/dfw onto floppies with:

cd /usr/dfw
tar cvf /dev/fd0 .
 

Or, if you wanted just certain files, you might do something like:

tar cvf /dev/fd0 document*
 

If all of your files won't fit on one floppy, tar will ask you for another, and so on. Note there is no mounting or unmounting, and that you didn't need to make a filesystem on the floppy, though you probably should format new floppies.

To examine what you put on, do:

tar tvf /dev/fd0
 

After taking these floppies somewhere else, lets say you wanted to restore them to /usr/dfw2. You'd just:

cd /usr/dfw2
tar xvf /dev/fd0

If you wanted one specific file, you might say:

tar xvf /dev/fd0 document1

Isn't that easier than mounting and unmounting filesystems?

To find out more about tar and other archivers, do:

man tar
man cpio
 

Disk Images

The difference between tar or cpio disks and file system disks sometimes causes real confusion for Dos/Windows people when they have ftp'd a patch file and the instructions are to put it on a Unix floppy. The problem often is that the file downloaded is obviously too big to fit on a floppy- or too big to fit on a Dos floppy, anyway.

Such a file is often a floppy image: that is, it is the bytes that tar or cpio would write directly to the floppy. You may not need to transfer this to a floppy at all. If it is a tar or cpio image, you can just ftp it to the Unix machine and use it as such without bothering to put it on a floppy at all. If you DO want or need it on a floppy, you need to use "dd":

dd if=myimagefile of=/dev/fd0
 

That's a minimal invocation; in practice I might really do something more complex but apt to be faster:

dd if=myimagefile of=/dev/fd0135ds18 bs=18k
 

There are also Windows tools that will let you create raw disk images. One is RAWRITE, which is available from a number of places on the web, including ftp://stage.sco.com/TLS/tls096.zip. See http://aplawrence.com/cgi-bin/ta.pl?arg=105004 for more information.

Also see my Data Transfer article for more general advice on transferring data.

Mounting Dos Disks

Almost all Unixes include the ability to mount Dos diskettes. Possibly, all you'd have to do is:

mount /dev/fd0 /mnt
 

However, it may not be quite that easy. For example, on SCO systems, you might need to enable that capability in the kernel by running "mkdev dos" first. On some systems, you'd need to specify that you're mounting a Dos diskette:

mount -f DOS /dev/fd0 /mnt
 

The exact command is going to vary with whatever Unix you have; try "man mount" (on SCO, "man ADM mount" is the specific page).

Some systems may, like Windows, automatically mount a floppy or CDROM. You may find that convenient at first, but sooner or later you'll probably want to disable it, especially for floppies.

Or, you may be able to access files on a Dos diskette without mounting: most Unixes include tools that let you directly access Dos filesystems. Linux uses "mtools". On SCO, either "doscp" or the "mtools" are apt to be available (for SCO, see Skunkware).

Copying

On SCO systems, you have the "diskcp" command, but all that it does is "dd" up to a temporary file and then back out to a new floppy, which you can do on any Unix/Linux:

dd if=/dev/fd0 of=myimagefile
dd if=myimagefile of=/dev/fd0
 

For efficiency you'd probably really do:

dd if=/dev/fd0 of=myimagefile bs=18k
dd if=myimagefile of=/dev/fd0 bs=18k
 

By the way, although the standard at the time of their beginning to fade was 1.44 MB, those disks could be formatted for 1.68 MB; the device on old SCO Unix was /dev/fd0135ds21 (21 sectors per cylinder and 80 sectors per track). See How to identify an unknown disk for a description of the Linux fdrawcmd - imagine the fun you could have identifying ancient floppy disks :-)

There were a few 2.88 MB floppys. This format did not last long: See reasons why 2.88 MB 3.5" Floppy disks disappeared quickly.



Got something to add? Send me email.





(OLDER) <- More Stuff -> (NEWER)    (NEWEST)   

Printer Friendly Version

-> -> Unix/Linux Basics - Floppy disks


7 comments



Increase ad revenue 50-250% with Ezoic


More Articles by

Find me on Google+

© Tony Lawrence







Tue Jan 24 15:06:29 2006: 367   anonymous


It helps to know that everything is a file, and it does not matter what your file type is. The last section was the most helpful for me. Thanks! Nabs






Mon Jul 11 09:27:35 2005: 774   anonymous


Once you create an image, with a command like dd if=/dev/fd0 of=/tmp/floppy.img, you can mount the image file as a normal partition, using the loop option when mounting it. example:

mount -t msdos floppy.img /mnt/somedirectory/ -o loop

Cheers!



Mon Jul 11 09:51:34 2005: 775   TonyLawrence

gravatar
The particular syntax of a loopback mount varies. Most unixes nowadays have some method of doing this - Linux with its -o loop, SCO used a "marry" command for the same effect, etc.

You only need the loopback if it's an iso image - a file system that the OS understands can of course be mounted directly.



Tue Feb 23 16:08:39 2010: 8118   SUBHAYUKHATUA

gravatar


Reduce the number of key strokes to execute this command:
tar -t -v -f /dev/fd0





Tue Feb 23 19:06:58 2010: 8122   TonyLawrence

gravatar


OK:

tar tvf /dev/fd0


Good luck with the rest of the class..



Mon Mar 25 21:42:06 2013: 11992   anonymous

gravatar


there is nothing here for putting a unix image onto a floppy under windows.
i have access to a win7 pc, a usb floppy drive and a previously unix server with a new raw format harddrive, the server has no OS. I have a .boot file, now under windows how to i transfer the image to the floppy



Mon Mar 25 21:48:18 2013: 11994   TonyLawrence

gravatar


I googled RAWRITE and got 423,000 results.

Use the force, Luke.

------------------------
Kerio Samepage


Have you tried Searching this site?

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us





Great minds discuss ideas; average minds discuss events; small minds discuss people. (Eleanor Roosevelt)

It is not only that there is no hiding place for the gods from the searching telescope and microscope; there is no such society any more as the gods once supported. (Joseph Campbell)








This post tagged: