Computing: Computer Administration

Using a floppy drive on FreeBSD.

Not really sure if there is any reason to use a floppy drive on FreeBSD... Anyway, here you can read how to proceed if you want to do so.

If your floppy drive contains a diskette that has been formatted on Windows and you try to mount the drive, FreeBSD will issue the error message Device not configured. The reason for this is that FreeBSD cannot read the diskette, and that the diskette has to be first prepared for usage on a BSD operating system.

To configure a floppy drive and create an ufs file system on a 1440 kB diskette, enter the following commands in a terminal (obvious that you have to do it as root):
    disklabel –w -r /dev/fd0 fd1440
    newfs /dev/fd0

To use the floppy drive, it has first to be mounted to the system. If we haven't yet done so (i.e. this only has to be done once), we'll have to create a mount point. FreeBSD system comes with a generic mount point called /mnt and we can mount the floppy drive in some subdirectory of /mnt (I chose to mount it at /mnt/floppy). For Windows users, mounting it at /A (cf. floppy A: drive on DOS and Windows) could perhaps be more convenient. To mount the drive, run the following commands (the first two commands creating the mount point, the last command mounting the floppy):
    cd /mnt
    mkdir floppy
    mount /dev/fd0 /mnt/floppy

Configuring and mounting a floppy drive on FreeBSD

Note: To unmount the floppy, use the command
    umount /mnt/floppy
If you get the error message device busy, it's because you forgot to change the directory pointer to a different location instead of /mnt/floppy. Run the command cd / and then run the unmount command again.

The screenshot below shows how, after having mounted the floppy drive, I accessed it (as root), making a directory listing (showing the hidden file .snap; I did not look up what this is about), copied a text file to the diskette and opened it in the kate text editor.

Accessing a newly configured floppy drive on FreeBSD

As you can see on the following screenshot, my standard FreeBSD user "allu" has access to the floppy drive and can read the text file, created before (as root).

Standard user access to a text file located on a floppy drive on FreeBSD

I suppose that you expected that my standard user has no write access to the floppy drive. So, "allu" can neither create a new directors, nor copy a file to the diskette, nor delete the file created by root before. In all these cases, you will get a permission denied error.

I'm not sure if this is what a professional FreeBSD user would have done, but I considered it as the simplest way to give my standard user full access to the diskettes in the floppy drive: I simply set the /mnt/floppy read, write and execute permissions for all users (be sure not to forget the execute permission, it is needed to cd to /mnt/floppy). As root, run the command;
    chmod ugo=rwx /mnt/floppy

On the screenshot below, you can see that after running this command, I dropped my super-user privileges (using the exit command to return from the root console to allu's console), and that now, as standard user, I was able to copy a file (that I created before in my home directory) to the diskette.

Read-write access for everyone on a floppy drive on FreeBSD

Note: FreeBSD, as all Unix based systems, does not support the unexpected removal of a diskette (or other removable media). On DOS or Windows, if you change the diskette, and then access it, the content shown will be the one of the newly inserted diskette. On Unix based systems, this does not work. The floppy drive is not locked (as is the CD drive), and I would say that the results of changing a diskette are unpredictable (with possible corruption of the data on the diskette). Unmounting the floppy drive should resolve this problem (in fact, it's not a problem, but a security measure). Maybe, it's also a good idea to unmount the floppy drive before shutting down your FreeBSD machine (?). And finally, maybe accessing the diskette on Windows (what anyway makes no sense, as Windows cannot read the ufs filesystem) could wipe out the diskette content (?).


If you find this text helpful, please, support me and this website by signing my guestbook.