Basic Use of Floppy Disk in Linux
The first step in being able to use a floppy drive on Linux is to know where to find it in the file system. Mine is in /dev/fd0 (that's floppy drive zero in the device directory) and the following instructions will be written using that path. If your path is different, substitute accordingly.
Let's check to see where your floppy drive is:
Find your file system table (fstab ), usually in /etc/fstab .
find / -type f -name fstab
And see what it says:
cat /path_to_fstab/fstab
Mine said:
/dev/fd0 /mnt/floppy auto noauto, owner, kudzu 0 0
That translates to:
floppy device location: | /dev/fd0 |
mounted read/write location for the file system: | /mnt/floppy |
file system type | auto |
mount options | noauto, owner, kudzu |
file system dump frequency | 0 |
file system check frequency | 0
|
We are only going to concern ourselves with the first three fields. The first field maps the location of the floppy device. To format a floppy disk for use in Linux (this will also delete everything on the disk), use the command (substitute your floppy device path):
mkfs -t ext3 /dev/fd0 1440
Now we have a blank disk we can use and need to figure out how to read and write to it.
We need to check our second field, the read/write location (/mnt/floppy in my case) to see if a mount point has already been set up for our floppy. Look in the path to the floppy directory:
ls -l /mnt
If "floppy" is not listed as a directory, we need to create it:
mkdir floppy
Then map the floppy device to the file system read/write area (need to be root to do this and the command will not work unless there is a disk in the floppy drive.):
mount /dev/fd0 /mnt/floppy
Now let's look again:
ls -l /mnt
We see the floppy directory and the permissions associated with it. These permissions can be changed in the standard ways. Let's look and see what's in the floppy
ls /mnt/floppy
We should see either nothing or just lost+found because
we just formatted it.
|
Mounting Elsewhere
You aren't limited to using the default read/write directory (in my case /mnt/floppy ) for mounting the floppy. All you need to do to set up a new place for the floppy to mount is to create an empty directory and then mount the floppy there. Here's an example of that:
mkdir /home/username/mnt
mkdir /home/username/mnt/floppy
mount /dev/fd0 /home/username/mnt/floppy
Make sure you set the appropriate permissions to your read/write directory (and its parent directory).
The umount command (to unmount, explained below) must point to the same directory from which the floppy is being read:
umount /home/username/mnt/floppy
Similarly, if you are not using /mnt/floppy as your read/write directory, you need to substitute your read/write directory path everywhere /mnt/floppy appears on this page.
|
Copy something into the floppy:
cp somefile /mnt/floppy
When I look into the floppy:
ls /mnt/floppy
I can see my file there, and I can read it.
cat /mnt/floppy/somefile
So far so good, but what happens when you eject that floppy disk and slip another into the floppy drive?
ls /mnt/floppy
Problem: your original files are still showing! Oh, if every OS handled floppy mounting and unmounting as smoothly as Macintosh does.... Fortunately, Linux is not too much more difficult.
|
Rule
Everytime you switch floppy disks, you will need to unmount your previous files and mount the file system from your new floppy. The umount command is used for unmounting. In addition to unmounting, the umount command also "flushes the buffers" so that whatever you wrote to your floppy really does get written there.
Important
Unmounting the floppy will also happen automatically (with your kill-scripts) at shutdown. If your buffers haven't flushed properly, and you have unmounted your disk by shutting down your computer (with a kill script), it is possible to lose the copy of the data that you thought you had moved or copied to your floppy.
umount /mnt/floppy
And now to mount your new floppy:
mount /dev/fd0 /mnt/floppy
ls /mnt/floppy
|
What if your floppy was originally formatted on a Windows computer and contains files from Windows on it? If your third column in /path_to_fstab/fstab , that is, your file system type is: auto , it shouldn't matter. The auto means you will be able to read whatever file system type is on your floppy. You should be able to view plain text from Windows just as if it had been written on Linux. You might need to run dos2unix on your text files to remove the extra carriage return character used by DOS. However, if your file system type listed ext2 , or if you are having difficulty reading text files from Windows, try this as your mount command:
mount -t vfat /dev/fd0 /mnt/floppy
|
|