How to use floppy drive and floppies in FreeBSD

Basically floppy drives and floppies are outdated history, but if someone has computer with floppy drive, it can use with the next script:

Edit: packages yad and xterm are required for the script.

Code:
#!/bin/sh
##
## RJP 24.7.2025
## FreeBSD FLOPPY mount and umount script
# Packages yad and xterm are needed



1=$({
echo '#!/bin/sh
yad --center --width=500 --height=100 --text-align=center --text="Fdcontrol tells floppy drive state. If floppy is not mounted, it tells size (1,4M). If floppy is mounted it tells more information"
xterm -hold -e su root -c "'fdcontrol /dev/fd0 '"
'
} > /tmp/fdcontrol)


2=$({
echo '#!/bin/sh
yad --center --width=500 --height=100 --text-align=center --text="Make mount point for floppy drive"
xterm -e su root -c "'mkdir /media/floppy '"
'
} > /tmp/make-mountpoint)

3=$({
echo '#!/bin/sh
yad --center --width=500 --height=100 --text-align=center --text="Mount floppy in read only mode"
xterm -e su root -c "'mount -r -t msdos /dev/fd0 /media/floppy '"
'
} > /tmp/mount-ro)

4=$({
echo '#!/bin/sh
yad --center --width=500 --height=100 --text-align=center --text="Mount floppy in read-write mode"
xterm -e su root -c "'mount -rw -t msdos /dev/fd0 /media/floppy '"
'
} > /tmp/mount-rw)

6=$({
echo '#!/bin/sh
yad --center --width=500 --height=100 --text-align=center --text="List floppy drive contents"
xterm -hold -e su root -c "'ls -lRa /media/floppy '"
'
} > /tmp/list)


6=$({
echo '#!/bin/sh
yad --center --width=500 --height=100 --text-align=center --text="Open root file manager in floppydrive"
xterm -e su root -c "'xdg-open /media/floppy '"
'
} > /tmp/filemanager)

8=$({
echo '#!/bin/sh
yad --center --width=500 --height=100 --text-align=center --text="Umount floppy .. wait and listen floppydrive"
xterm -e su root -c "'umount /media/floppy '"
'
} > /tmp/umount)

echo '

In 64-bit FreeBSD has a bug … or a feature which prevents system to see floppy drive. No problem, it can be fixed. The fix is to add the next lines to the /boot/device.hints file.

hint.fdc.0.at="isa"
hint.fdc.0.port="0x3F0"
hint.fdc.0.irq="6"
hint.fdc.0.drq="2"
hint.fdc.0.flags="0x0"
hint.fd.0.at="fdc0"
hint.fd.0.drive="0"
hint.fd.0.flags="0x0"
hint.fd.1.at="fdc0"
hint.fd.1.drive="1"
hint.fd.1.flags="0x0"

After editing, reboot, and floppy drive should be workable

fdcontrol /dev/fd0

If floppy is not mounted, the message tells its size (1,4 M)

If floppy is mounted, the message tells full information.

To mount floppy

mkdir /a

mount -t msdos /dev/fd0 /a

To see if floppy is mounted

fdcontrol /dev/fd0

========================

https://www.unixguide.net/freebsd/fbsd_installguide71/10.07-Using_the_Floppy_drive.htm

To format a FBSD file system floppy disk

Load a floppy disk into the floppy drive.

disklabel –w -r /dev/fd0 fd1440 # FBSD ufs file system.

newfs /dev/fd0 # create ufs file system on floppy

To use the floppy, the floppy drive must first be mounted to the system. The basic FBSD system comes with a generic mount point called /mnt I find it much more convenient to create a floppy mount point call /a like MS/Windows drive A which is the floppy drive. Since we have a new, clean, fresh install of FBSD the /a mount point has to be created. This only has to be done once.

To create /a floppy mount point

cd / # change to top of directory tree

mkdir /a # make directory

To mount floppy drive

Load a FBSD formatted floppy disk into the floppy drive.

mount /dev/fd0 /a # mount device to mount point /a

cd /a # change to /a

To test floppy drive

You have already formatted the floppy, created the mount point, and mounted the drive.

cp /etc/motd /a/ # copy motd file to floppy

ls # list contents of directory,
# You should see the motd
# file listed as being on /a

To remove floppy from drive

It is real easy to just press the floppy drive eject button and remove the floppy disk. This will create problems for you as the floppy drive is still mounted and cannot be un-mounted without a floppy disk loaded in the drive. There is a sequence of commands you have to execute to free up the floppy drive before removing the floppy disk.

cd / # change directory to top of directory tree

umount /a # un-mount the floppy drive

If you get error message 'device busy', that means you forgot to change the directory pointer to a different location instead of /a. Do the cd / command again.

To mount MS/Windows formatted floppy disk

Load MS/Windows floppy into floppy drive

mount –t msdos /dev/fd0 /a # mount device to mount point /a

cd /a # change to /a

For /etc/fstab line

/dev/fd0 /a msdos rw,noauto,longnames 0 0
' > /tmp/readme-floppy-helper.txt


chmod +x /tmp/fdcontrol
chmod +x /tmp/make-mountpoint
chmod +x /tmp/mount-ro
chmod +x /tmp/mount-rw
chmod +x /tmp/list
chmod +x /tmp/filemanager
chmod +x /tmp/umount



#!/bin/sh
yad --form --columns=3 --rows=4 --width=1000 --text="FLOPPY HELPER" --title="FLOPPY HELPER" \
\
--field="Floppy Status Checker":fbtn "/tmp/./fdcontrol " \
--field="Make mount point":fbtn "/tmp/./make-mountpoint " \
--field="Mount read only":fbtn "/tmp/./mount-ro " \
--field="Mount read write":fbtn "/tmp/./mount-rw " \
--field="List floppy contents":fbtn "/tmp/./list " \
--field="Open root filemanager in floppy drive":fbtn "/tmp/./filemanager " \
--field="Umount floppy":fbtn "/tmp/./umount " \
--field="README FIRST":fbtn "sh -c 'xdg-open /tmp/readme-floppy-helper.txt ; exec sh' & " \
--button=Exit:1
sleep 4
cd /tmp && rm fdcontrol make-mountpoint mount-ro mount-rw list filemanager umount readme-floppy-helper.txt


 
Back
Top