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
or
# mformat a:
to create an MS-DOS filesystem. 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/$ _
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:
/mnt/a
,
/mnt/a:
, and /mnt/cdrom
/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. I've found that to write on /mnt/a
without being root, right after preparing the floppy it's necessary to
do:
# mount /mnt/a
# chmod 777 /mnt/a
# umount /mnt/a
Remember that allowing anyone 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 ready. To restore your stuff, insert the first floppy in the drive and do:
# tar -M -xpvf /dev/fd0H1440