Floppy drives in Unix
This page gives instructions on how to write to and read from the
floppy drives on the IT Labs and CS UNIX machines, using either mtools
or vold. mtools is a generic tool that should work on most UNIX machines.
vold can only be used on Solaris machines.
The mtools Package
The mtools package is a group of commands that allow users to use
MSDOS formatted floppies under UNIX.
Command List
| mattrib |
|
| change MSDOS file attribute flags |
| mcd |
|
| change MSDOS directory |
| mcopy |
|
| copy MSDOS files to/from Unix |
| mdel |
|
| delete an MSDOS file |
| mdir |
|
| display an MSDOS directory |
| mformat |
|
| add an MSDOS filesystem to a low-level formatted diskette |
| mlabel |
|
| make an MSDOS volume label |
| mmd |
|
| make an MSDOS subdirectory |
| mrd |
|
| remove an MSDOS subdirectory |
| mread |
|
| low level read (copy) an MSDOS file to Unix |
| mren |
|
| rename an existing MSDOS file |
| mtype |
|
| display contents of an MSDOS file |
| mwrite |
|
| low level write (copy) a Unix file to MSDOS |
Example
-
Stick a floppy in the drive. To use the mtools package, it must be
MSDOS formatted. If it is not, you can use the
mformat
command to format it for use with MSDOS.
(whale) % mformat a:
-
At this point, you may begin to copy files to your floppy. The
following example is based on the idea that you have a file named
foo.out in your home directory that you want to save to a floppy.
(whale) % mcopy foo.out a:
(whale) % mdir a:
foo.out
If you have saved files on your floppy that you want to copy to
your home directory, you might do something like:
(whale) % mcopy a:\foo.out foo.out
Remember that your shell will by default perform expansion on any
wildcards that you include on the commandline. So, if you want to
copy every file that begins with foo on your floppy, you need to
use quotes.
(whale) % mcopy 'a:\foo.*' .
will copy all files beginning with foo on your floppy to the
current directory.
-
After entering the following command, you can get your floppy back
from the drive.
(whale) % eject
The rest of the commands in the mtools package are similar to their MSDOS
counterparts. For more information, either read the man pages for each
command or consult the following
Mtools documentation.
vold is the best way to use removable media under Solaris.
-
Place your floppy in the drive.
-
Run volcheck to mount your floppy.
(thetick) % volcheck
-
Check to see where your disk was mounted
(thetick) % mount | grep floppy
You should see something along the lines of:
/floppy/d3_mspub20 on /vol/dev/diskette0/d3_mspub20 \
read/write on Wed Nov 1 19:34:29 1995
As you can see,the floppy is now mounted at /floppy/d3_mspub20.
You can use the floppy like any other partition. For example,
if you want to copy foo.out to the floppy, you would do the
following:
(thetick) % cp foo.out /floppy/d3_mspub20/
-
When you are done using your floppy, type the following
command, and then remove the floppy disk from the drive
(thetick) % eject
For more information see the Sun Product Documentation for
volcheck and
Managing Removable Media
-
Load your Floppy into the drive.
-
Use the
mount command to mount your floppy.
user@lind24-3 (~) % mount /floppy
The floppy is now mounted on /floppy, and is usable just
like other disk.
To change to that directory, type:
user@lind24-3 % cd /floppy
To copy the file foo.txt from the floppy to your home directory,
type:
user@lind24-3 % cp /floppy/foo.txt ~/
-
When you are done using your floppy, type the following command
to eject it from the drive:
user@lind24-3 % umount /floppy
|