Storing data on floppy disks is sometimes useful, for example when one does not have any other removable storage media or when one needs to transfer small amounts of data to another computer.
This section will explain how to use floppy disks in FreeBSD. It will primarily cover formatting and usage of 3.5inch DOS floppies, but the concepts are similar for other floppy disk formats.
Floppy disks are accessed through entries in /dev, just like other devices. To access the raw floppy disk in 4.X and earlier releases, one uses /dev/fdN, where N stands for the drive number, usually 0, or /dev/fdNX, where X stands for a letter.
In 5.0 or newer releases, simply use /dev/fdN.
There are also /dev/fdN.size devices, where size is a floppy disk size in kilobytes. These entries are used at low-level format time to determine the disk size. 1440kB is the size that will be used in the following examples.
Sometimes the entries under /dev will have to be (re)created. To do that, issue:
# cd /dev && ./MAKEDEV "fd*"
In 5.0, devfs(5) will automatically manage device nodes in /dev, so use of MAKEDEV is not necessary.
A floppy disk needs to be low-level formated before it can be used. This is usually done by the vendor, but formatting is a good way to check media integrity. Although it is possible to force larger (or smaller) disk sizes, 1440kB is what most floppy disks are designed for.
To low-level format the floppy disk you need to use fdformat(1). This utility expects the device name as an argument.
Make note of any error messages, as these can help determine if the disk is good or bad.
Use the /dev/fdN.size devices to format the floppy. Insert a new 3.5inch floppy disk in your drive and issue:
# /usr/sbin/fdformat /dev/fd0.1440
Use the /dev/fdN devices to format the floppy. Insert a new 3.5inch floppy disk in your drive and issue:
# /usr/sbin/fdformat -f 1440 /dev/fd0
After low-level formatting the disk, you will need to place a disk label on it. This disk label will be destroyed later, but it is needed by the system to determine the size of the disk and its geometry later.
The new disk label will take over the whole disk, and will contain all the proper information about the geometry of the floppy. The geometry values for the disk label are listed in /etc/disktab.
You can run now disklabel(8) like so:
# /sbin/disklabel -B -r -w /dev/fd0 fd1440
Now the floppy is ready to be high-level formated. This will place a new file system on it, which will let FreeBSD read and write to the disk. After creating the new file system, the disk label is destroyed, so if you want to reformat the disk, you will have to recreate the disk label.
The floppy's file system can be either UFS or FAT. FAT is generally a better choice for floppies.
To put a new file system on the floppy, issue:
# /sbin/newfs_msdos /dev/fd0
The disk is now ready for use.
This, and other documents, can be downloaded from ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/.
Hosting by: Hurra Communications Ltd.
Generated: 2007-01-26 17:58:42