FLOPPIX Home | FAQ | Download | Labs | ToC | Back |  Next 

Saving your files on a floppy


Notes:

Floppix is configured so that ordinary users can save data on diskettes formatted with a DOS or Windows95 filesystem. There are a few key points to remember:

Linux works with a single logical filesystem which can actually be stored on several physical devices. For example:

                       / 
           |-----|-----|------|-----|
          bin   etc   home   usr   var
                       |            |
                  |---------|     spool
                 abc       xyz

The system administrator will make sure that all devices are "mounted" (inserted into the logical filesystem) when the system boots. Users can move from their own home directory to the /etc directory to /var/spool without worrying about whether or not they are changing from one drive to another. Normally this gives the system administrator the power to add or change the storage devices transparently - an ordinary user doesn't have to worry about the physical organization of the storage system.

Removable storage devices (such as diskettes and cd-roms) are the fly in the ointment. They cannot be mounted when the system boots because you  may want to change disks several times. Therefore, you must tell the operating system when you insert  or remove a diskette; otherwise, the data will NOT be written on the floppy.

On floppix, you can mount a diskette formatted under DOS or Windows95 on the /floppy directory using the command: mount /floppy. The operating system will check in the configuration file for the mount command (/etc/fstab) to see what device should be mounted (/dev/fd0); what type of filesystem is on the diskette (vfat) and whether or not ordinary users are allowed to mount floppies (on floppix, the answer is yes but normally only the superuser can mount devices).

While the diskette is mounted, any files that you copy to the /floppy directory will be copied to the diskette. After the diskette is umounted, the /floppy directory no longer points to the diskette. You can check to see whether or not the diskette is mounted by entering the command: mount. If the floppy is mounted, then the output from mount will be:

/dev/ram on / type ext2 (rw)
proc on /proc type proc (rw)
/dev/ram1 on /usr type ext2 (rw)
/dev/fd0 on /floppy type vfat (rw,nosuid,nodev,user=abc)

As long as the last line (/dev/fd0 on /floppy ... ) is present, then anything you save in the /floppy directory will be saved on the floppy drive. If the line is not present, then you are not writing to the floppy drive.

When you want to eject the floppy, you must tell the operating system before removing the diskette. First, run the sync command. This flushes any data that is stored in the disk cache so that it is physically written to disk. Then, enter the command: umount /floppy. Because linux is a multi-user operating system, the system will check to make sure that none of the users on the system are using the floppy and will NOT unmount the diskette if anyone is using it. If you get the error message: device is busy, then one of the users on your system is still using the diskette. On floppix, that user is probably you! If your working directory is /floppy, then you are still using the diskette and the operating system will not let you unmount it.

Summary: how to save files on a diskette


Exercise:

  1. Find a floppy (blank would be preferable)
     
  2. Insert it in your diskette in the floppy drive but do not mount it.
     
  3. Copy the readme file from your own home directory to /floppy.
     
  4. What files are currently stored in the /floppy directory? _________
     
  5. Enter the command: mount /floppy
     
  6. What files are shown in the /floppy directory now?
     
  7. Copy the penguin file from /home/floopy to /floppy. Please notice the difference between floopy and floppy!
     
  8. What files are now stored in the /floppy directory? _________
     
  9. Enter the command: cd /floppy ; sync
     
  10. Try to unmount the floppy. What error message did you get? __________
     
  11. Enter the cmmand: cd
     
  12. Now try to unmount the floppy. What files are stored in the /floppy directory now? __________
     
  13. Reboot to your normal operating system and look at your diskette. What is stored on it?


Questions & Answers:

  1. What happens if I forget to mount the floppy diskette and copy files to /floppy?
     
    Answer: The files get copied to the /floppy directory but not to the diskette.
     
  2. What happens to files that are currently stored in /floppy when I mount the diskette.
     
    Answer: Those files are unavailable until you unmount the diskette.
     
  3. When I try to unmount the diskette, I get the message "device busy"; help!
     
    Answer: Some one (probably you) is using the /floppy directory. Cd to your home directory and do the umount again.

Copyright © L. M. MacEwan
FLOPPIX Home | FAQ | Download | Labs | ToC | Back |  Next