Removable Storage I
Summary:
- The Floppy Device Controller
- Floppies
Formatting, Low Level
Formatting, High Level - Floppy Tape Drives
Almost everyone uses external data media to transport or store data. These pages will cover some of the most popular and explain how to handle them in GNU/Linux. Contrary to my usual practice, I can't rely on experience with some of them, so is strongly encouraged (especially for tape drives)1.1
1 The Floppy Device Controller
The floppy controller (FDC) is a legacy device still used in almost all PCs. It is slow and the media are unreliable.
Like all In/Out interfaces which depend on the doomed ISA bus (LPT, COM, PS/2, KBD), it is bound to cease sometime soon.
But it is still a standard, though I would not recommend to use other devices than the omnipresent 3,5'' floppy drive with it. All modern attempts to replace this standard ('LS-120' aka 'a:Drive', 'ZIP') use at least the IDE interface (and have therefore failed to replace the floppy...) and will be dealt with in the appropriate section.
Floppies
Until 8.1, Mandrake provided two device files for them: '/dev/fd0' for the first drive and '/dev/fd1' for the second (you can have up to seven). 8.1 uses 'devfs', so if you've only got one floppy drive, you will only have one device file for it, and you can skip the next paragraph.
If you dare having a look at '/dev', you will note, that there are some more files (like 'fd0h720' or 'fd0u2880'). Usually you don't have to care about them, they denote legacy or non-standard floppy sizes like 360 KB or 2880 KB. The characters specify the type of the floppy: d, q or h the various types of 5.25'' floppies and D, H, E or u the various types of 3.5'' floppies.
GNU/Linux detects the size format of a mounted floppy and uses the correct file automatically. So if you insert your standard 1.44 MB floppy in the first floppy drive and mount it (or let 'supermount' do the mounting), GNU/Linux uses '/dev/fd0u1440' internally when you access the floppy via '/dev/fd0'. In 8.1, devfs generates the necessary device file 'on the fly'.
Formatting, Low Level
Low-level formatting is used to change the data size of a floppy. The command used is
fdformat
fdformat /dev/fd0D720
This will turn your 1.44 MB High Density floppy into a 720 KB Double Density one (it looks like you have to tape the hole not containing the write block mechanism, too).
Note that the floppy mustn't be mounted1.1 If you use 'supermount', you have to
umount
You can use
fdformat
superformat
Example: You want to give it a try and make your 1.44 MB floppy to a 1.6 MB one. To create the appropriate device file, you'll need the command
mknod
mknod {name} {type} {major minor}.
Huh? ;-) Don't worry, it's easier than it looks. Go to the 'Documentation' directory in '/usr/src/linux' and open 'devices.txt'. This file lists all accepted device entries for '/dev'. The entry concerning floppies is quite at the beginning. The format of these entries is:
{major number} {type} {minor number} = {name}
Search the file for 'Floppy'. You will find an entry listing all kinds of '/dev/fd{...}' files, the number in front of these entries is the minor device number. You see that floppy disks are regarded as 'block' devices (meaning that data is read and written in blocks, not character by character). The entry for a 1600 KB disk reads:
124 = /dev/fd?u1600 3.5" 1600K High Density(1)
The '?' stands for 'Controller / drive'. It is '0' for the first. By now you've got the minor number, the correct device file name and the type of the device. But where's the major number? Scroll the file upward until you see a number in the first column (it's '2'). This is the major number. If you think about this system for a while, it actually does make sense ;-).
Now put it all together (as 'root'):
mknod /dev/fd0u1600 b 2 124
Test it with an inserted but unmounted floppy which is dispensable (as root):
fdformat /dev/fd0u1600
If
fdformat
All that's left to do is to do a high-level formatting to put a file system onto the disk.
N.B.: If you really want to get into this, you should prefer using
superformat
superformat
Formatting, High Level
Strictly speaking you don't need a file system: using
dd
dd if={filename} of=/dev/fd0
This is commonly used to create boot floppies, since you don't 'waste' space on a file system this way which enables you to put more data onto the floppy. This approach has some severe limitations, though: every write will overwrite previous data and you can't mount the medium.
Since floppies are pre-formatted, you usually have no reason to reformat them either. The DOS file system, FAT, was designed for floppies (that's why it sucks on hard disks ;-)). You can put a GNU/Linux EXTFS2 file system onto a floppy, but it will eat up more space (more than 90KB) and usually you don't need its features on a floppy anyway. An alternative might be the old Minix file system, which needs even less space than FAT.
M's own 'drakfloppy' utility allows you to format floppies easily using either FAT or EXTFS2.
On the console you can use
mformat
mformat a:
will quick-format a floppy to FAT.
The commands
mkfs.ext2
mkfs.minix
mkfs.msdos
mkfs.vfat
If you use extfs2 formatted floppies, don't forget to change the according entry in '/etc/fstab' from 'vfat' to 'auto', otherwise 'mount' or slocate's 'updatedb' will complain about a 'wrong fstype'.
Floppy Tape Drives
I've never used one of these, so I don't have much to say about them. These drives are slow (well, it's the old lame FDC which controls them) and you should definitely consider buying an IDE or SCSI tape drive which is at least five times faster.
Internal and external floppy tape drives (like Iomegas / Tekmars Ditto and various brands adhering to the QIC standards) are handled by the (z)ftape kernel module. The appropriate device file is '/dev/ftape' (which is a link to '/dev/rft0').
The tape is controlled with the
mt -f {device}
mt -f /dev/ftape retension
rewinds the tape. Read
man mt
It seems to be a commonly held opinion that the
afio
tar
gzip
You'll find loads of information on the website of The Linux Floppy Tape Project.
Related Resources:
'devices.txt' in 'linux/Documentation'
man fdformat, man mknod
The Linux Floppy Tape Project
Ftape-HOWTO
Revision / Modified: Sep. 11, 2001
Author: Tom Berger
Legal: This page is covered by the GNU Free Documentation License. Standard disclaimers of warranty apply. Copyright LSTB and Mandrakesoft.
Version 1.3 last modified by AdminWiki on 22/03/2004 at 09:44
Document data
- Lost account?
- Join the community, be part of the Club: it's free!
- Get the PWP Download Subscription!