MandrakeUser.Org - Your Mandrake-Linux Knowledge Base!


 
 

*DocIndex - Hardware

Removable Storage I

* The Floppy Device Controller
* Floppies
  Formatting, Low Level
  Formatting, High Level
* Floppy Tape Drives

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

 
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 feedback on handling is strongly encouraged (especially for tape drives)!

* 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.

* section index * top

* 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. Let's say you need a 3.5'' Double Density floppy for a quite old computer and the floppy drive of this computer only accepts 720 KB disks. Insert a standard 1.44 MB disk in your floppy drive and type

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 mounted! If you use 'supermount', you have toumount the disk before formatting it.

You can use fdformat or superformat from the 'fdutils' package to increase the size of your floppies. But be aware that this process will shorten the lifespan of a diskette even further or may not work at all. Furthermore you will have to make a device file for this format first.
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 commandmknod:

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 theminor 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 doesn't complain, you will now have a 1.6 MB floppy (on my box, this works for capacities up to 1.7x MB).

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 usingsuperformat, which theoretically allows formatting 1.44 MB floppies up to 1.99 MB.
superformat will automatically do a high-level format using MS-DOS FAT.

Formatting, High Level

Strictly speaking you don't need a file system: using dd, you can write the data 'raw' onto the blank disk:

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 from the mtools-package:

mformat a:

will quick-format a floppy to FAT.
The commands mkfs.ext2, mkfs.minix,mkfs.msdos or mkfs.vfat also create file systems.

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'.

* section index * top

* 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] command (note: tapes are usually used unmounted). Example:

mt -f /dev/ftape retension

rewinds the tape. Read man mt for more options.
It seems to be a commonly held opinion that the afio program is better than tar and gzip when it comes to making tape backups. You can get an RPM of it from the 'contrib/RPMS' directory of your favourite Cooker server, since it is not part of the standard distribution.

You'll find loads of information on the website of The Linux Floppy Tape Project.

* section index * top

 
Legal: All texts on this site are covered by the GNU Free Documentation License. Standard disclaimers of warranty apply. Copyright LSTB (Tom Berger) and Mandrakesoft 1999-2002.