The FreeBSD Corporate Networker's Guide

Working with floppies


Why use floppies when the network is there?
Floppy disks are generally not used under UNIX, because they hold so little data and because most admins are used to moving files around on the network. However, they can be useful in a pinch. Once I had a server go down hard when power was shut down to it. When the system came back up (after I ran fsck on it) somehow the file /usr/lib/libpam.so.1 was deleted, perhaps because the file was open when the system was shut off. This was a problem because no one couldn't log into the system as a result--at least not when the system was up running multiuser. Fixing it was easy. I formatted a floppy and then copied th needed file from another FreeBSD system. I then booted the system into single user mode and copied the file off the floppy. So this was an occasion where using a floppy was necessary.

With floppies, like other media, formatting is divided into low-level formatting and high-level formatting. It is particularly critical to low-level format floppies because often floppy media can develop bad spots. This is not a problem under DOS or Windows because the File Allocation Table (FAT) that those operating systems put onto the floppy media will mark off bad sectors. However, under UNIX, there is no mechanism for dealing with bad sectors. In general, UNIX assumes that media are inherently perfect, and it is up to the electronics on the media to make bad sectors transparent. Hard disks can do this, but floppies can't, so they must be low-level formatted to ensure perfect media.

UNIX high-level formatting is a bit different. A floppy can be high-level formatted as a UNIX File System (UFS) format, or a MS-DOS format, or it can have no format and be treated as a raw media device like a tape is. What you do depends on what application you need to use. The tar, dd, and cpio programs don't require that the floppy media be formatted. MS-DOS format is required if the floppy is to be used in DOS or Windows systems. UFS format is required if the floppy is to be mounted in other UNIX systems. I'll assume that you know how to format a floppy with DOS or Windows and just cover dd, tar and UFS here.

For all applications, the first thing to do is to low-level format the floppy. To low-level format a 1.4MB floppy in the A: drive type:

fdformat -f 1440 /dev/rfd0

The output should be a row of V's like this:

VVVVVVVVVVVVVVVVVVVVVVVVVVVVVV

If there are any Es (errors) in there, don't use the floppy under UNIX. After that, it's ready for use by another application.

dd

dd is used with floppies for copying image files. For example, creating an installation floppy from a new FreeBSD CD mounted in the CD drive could be done like this:

dd if=/cdrom/floppies/boot.flp of=/dev/fd0

tar

tar is used for making floppies that are readable between different UNIX versions, For example, to copy a file named "test.txt" you might do the following:

tar cf /dev/fd0 test.txt

To get the file off the floppy you would do

tar xf /dev/fd0

UFS

UFS is used to copy files between UNIX systems. There is a 2-step process for this with floppies:

  1. Mount the floppy onto a convenient directory, before copying the file
  2. After copying the file, unmount the floppy from the directory before it is removed from the FreeBSD system.
Failure to unmount the floppy from the directory could result in a crash to the FreeBSD system.

To format a 1.4MB floppy in the A: drive with UFS, do the following:

disklabel -r -w /dev/rfd0 fd1440

newfs /dev/fd0

To mount it onto the /fd directory, do this:

mount /dev/fd0c /fd

Copying files to /fd will copy them onto the floppy, and copying files from the /fd directory will copy them off of the floppy.

To unmount the floppy, type:

umount /fd


Site hostingSite design and maintenance
Internet Partners Inc.
info@ipinc.net
Web-Strider Enterprises
jeanm@web-strider.com

© Copyright 2000-2003 Ted Mittelstaedt. All rights reserved.