Cmpt 471 Rebuilding a Workstation 00-1

Using Floppies on and Solaris

Since the Network Lab has no connections to the outside world, your best bet for bulk data transfer is a floppy diskette. There are two approaches, depending on whether you have created a file system on the diskette or not. In the discussion that follows, many commands will be the same for Solaris and Linux. Where there are differences, I’ll try to mention them. The term ‘’ refers to generic Unix systems (Solaris, Linux, etc.), and Wintel means some flavour of Windows on Intel hardware. In the Sun documentation (http://docs.sun.com) you can find information about using flop- pies and CDs by looking in the Solaris 2.6 System Administrator Collection Vol. 1, System Ad- ministration Guide, Managing Removable Media. In the Linux documentation, the System Administrator’s Guide has several good sections on managing file systems and using floppies. Many of you are no doubt asking “How do I know if I have a file system on my floppy?” You need to realise that a file system is simply a rather large linked data structure, just like you might build in a C program. It just happens that a file system is built on a disk instead of in memory. When you format a disk, you very low level timing and positioning information on the disk, but you do not necessarily create a file system. fdformat, the program which does the low level formatting, generally has an option to create an MSDOS file system (on the assumption you’re likely using the floppy to transfer data between unix and Wintel systems). If you want to create a Unix file system, then you need to use the appropriate Unix (newfs for Solaris, mke2fs on Linux) to create a file system after you’ve formatted the diskette. But be aware that a unix file system is not what you want to use to transfer from a Linux system to a Solaris system. For one thing, the data structures are not identical. For a second, SPARC hardware is big-endian, while x86 hardware is little-endian. You can’t even transfer data from a Solaris/SPARC system to a Solaris/x86 system. Fortunately, Linux, Solaris, and Windows all understand a MSDOS file system, and byte order doesn’t seem to be an issue. Returning to the task hand: You already know how to use a floppy with no file system from the tutorial on kickstart: use tar and/or .Usingtar is a good choice if you have a lot of files to move. On a workstation in the Lab, you can tell tar to create the archive directly on the floppy, or you can write the archive to a file and then use dd to copy it to the floppy. If the archive is too bigtofitononefloppy,tryusinggzip to compress it. On the Solaris side, it’s a little complicated. Solaris has something called volume man- agement which attempts to access to floppy diskettes and CDs relatively transparent. After you insert your diskette into the floppy drive on a Solaris machine, the first thing you need to do is run a command called volcheck, which makes the diskette drive available to the file system. Then use dd to copy the archive from the diskette to a file, or use tar directly to unpack the archive from the floppy. The name for the floppy under Solaris is a little bit unintuitive, so here’s the command to extract the files from the archive:

tar xvf /vol/dev/rdiskette0/unlabeled

Just what you’d have guessed, I’m sure. If you’ve gzip’ the archive, it’s easiest to use dd to copy it from the floppy to a normal disk file, then gunzip it and use tar to unpack the archive. As you might guess, you can go the other direction. Consult the documentation for further details.

1 Cmpt 471 Rebuilding a Workstation 00-1

As mentioned above, the second approach is to create an MSDOS file system on the floppy and go from there. In order to access a file system on a floppy diskette, the file system must be mounted — mapped onto some point in the unix file system. On Linux systems, this is accomplished using the command. To make mounting a file system a little easier, there are some predefined entries in /etc/. These are convenient because you don’t have to supply all the options to the mount command; it can read them from the line in fstab. When you say mount /dev/fd0, the rest of the information is obtained from the corresponding line. There’s one small problem: the line for the floppy in fstab is probably not correct (unless someone has already made the following changes). It should contain

/dev/fd0 /mnt/floppy msdos noauto,users 0 0

Thetypeforthemountmustbemsdos, and you want the users option so that ordinary users (not just root) can mount and unmount the floppy. (Again, consult the mount documentation for details of what all this means.) You’ll need to be root to modify /etc/fstab. Once you’ve mounted the floppy as an MSDOS file system, you can use the usual unix com- mmands (, , , etc.) to move files back and forth between the floppy and the rest of the file system. When you’re done, to some directory other than /mnt/floppy and unmount the floppy with the umount command. If you don’t unmount the floppy, the file system will think it’s still present and get confused if you try to access it. When you insert your floppy into a Solaris system, things are actually simpler. When you run volcheck, Solaris will recognise that the floppy contains an MSDOS file system and mount it as /floppy/something,wheresomething will depend on whether you’ve labelled the floppy or not. In any event, there will be a subdirectory under /floppy, and your files will be inside that subdirectory. (The command to mount a file system on Solaris is also mount,butyouwon’thave sufificient access privileges to use it directly.) When you’re done using the floppy, use eject to unmount it before you remove the diskette from the drive. As with Linux, if you don’t unmount the floppy, the file system will have the wrong idea. Given that the file system on the floppy diskette is MSDOS, you can also use this technique to transfer data to and from a Wintel system.

2