You have never thought about it, but the DOS command FORMAT A:
does a
lot more work than it seems. In fact, when you issue the command FORMAT
it will: 1) physically format the disk; 2) create the A:\ directory (=
create a filesystem); 3) make the disk available to the user (= mount the
disk).
These three steps are addressed separately under Linux. You can use floppies in MS-DOS format, though other formats are available and are better---the MS-DOS format won't let you use long filenames. Here is how to prepare a disk (you'll need to start a session as root):
# fdformat /dev/fd0H1440
# mkfs -t ext2 -c /dev/fd0H1440
To create an MS-DOS filesystem, use msdos
instead of ext2
. Before
using the disk, you must mount it.
# mount -t ext2 /dev/fd0 /mnt
or
# mount -t msdos /dev/fd0 /mnt
Now you can address the files in the floppy. When you've finished, before
extracting the disk you must unmount it.
# umount /mnt
Now you can extract the disk. Obviously, you have to fdformat
and
mkfs
only unformatted disks, not previously used ones. If you want to
use drive B:, refer to fd1H1440
and fd1
instead of fd0H1440
and fd0
in the examples above.
All you used to do with A: or B: is now done using /mnt
instead. Examples:
DOS Linux
---------------------------------------------------------------------
C:\GUIDO>DIR A: $ ls /mnt
C:\GUIDO>COPY A:*.* $ cp /mnt/* /docs/temp
C:\GUIDO>COPY *.ZIP A: $ cp *.zip /mnt/zip
C:\GUIDO>A: $ cd /mnt
A:>_ /mnt/$ _
If you don't like this mounting/unmounting thing, use the mtools
suite:
it's a set of commands that are perfectly equivalent to their DOS
counterpart, but start with an `m': i.e., mformat
, mdir
,
mdel
, and so on. They can even preserve long file names, but not file
permissions. Use these commands as you'd use the DOS commands and rest in
peace.
Needless to say, what holds for floppies also holds for other devices; for instance, you may want to mount another hard disk or a CD-ROM drive. Here's how to mount the CD-ROM:
# mount -t iso9660 /dev/cdrom /mnt
This was the ``official'' way to mount your disks, but there's a trick in store. Since it's a bit of a nuisance having to be root to mount a floppy or a CD-ROM, every user can be allowed to mount them this way:
~# mkdir /mnt/a: ; mkdir /mnt/a ; mkdir /mnt/cdrom
~# chmod 777 /mnt/a* /mnt/cd*
~# # make sure that the CD-ROM device is right
~# chmod 666 /dev/hdb ; chmod 666 /dev/fd*
/etc/fstab
the following lines:
/dev/cdrom /mnt/cdrom iso9660 ro,user,noauto 0 0
/dev/fd0 /mnt/a: msdos user,noauto 0 0
/dev/fd0 /mnt/a ext2 user,noauto 0 0
Now, to mount a DOS floppy, an ext2 floppy, and a CD-ROM:
$ mount /mnt/a:
$ mount /mnt/a
$ mount /mnt/cdrom
/mnt/a
, /mnt/a:
, and /mnt/cdrom
can now be
accessed by every user. Remember that allowing everyone to mount disks this
way is a gaping security hole, if you care.
Now that you know how to handle floppies etc., a couple of lines to see how to do your backup. There are several packages to help you, but the very least you can do for a multi-volume backup is (as root):
# tar -M -cvf /dev/fd0H1440 dir_to_backup/
Make sure to have a formatted floppy in the drive, and several more ready. To restore your stuff, insert the first floppy in the drive and do:
# tar -M -xpvf /dev/fd0H1440