This chapter covers various peripheral devices that may be attached to your computer. Although compiling and installing the low-level drivers for your kernel are the first steps in getting any device including peripherals working, you may also need additional utilities or servers to do anything useful with the device.
A great deal of the work involved when configuring peripherals is digging through kernel log messages to see exactly how the kernel assigns a device and whether the kernel recognizes the device correctly in the first place. Therefore, this chapter contains a great number of example kernel messages that you can use as a guide for your own installation.
When working with a PC floppy drive, you must remember that it is one of the most unreliable pieces of hardware that you can find on a PC. You can mount the first floppy drive using the device /dev/fd0, but this can be dangerous, because the kernel will not like any hardware errors. Using the mtools programs is a good alternative to mounting the filesystem directly.
The mtools programs look like their MS-DOS counterpart commands with an m at the beginning. For example, you can use mdir for a directory listing.
To copy a file from a floppy disk to the current directory, run this command:
mcopy a:file .
Copying files from the local system to the disk is similar:
mcopy file a:
You can also format a floppy with an MS-DOS filesystem using the mformat command:
mformat a:
For more options and commands, refer to the mtools(3) manual page.
Sometimes it's more convenient to copy the entire image of a floppy disk to a file on your hard disk than it is to deal with individual floppy disk operations. You can perform the extraction with dd:
dd if=/dev/fd0 of=image_file bs=512
You might be able to make the extraction go a little faster by changing the bs parameter to 32k. After you have the image file, it's convenient to mount the image file on your system with a loopback block device. This example mounts an image of an MS-DOS filesystem:
mount -t vfat -oloop=/dev/loop0 image_file mount_point
Warning? |
Remember to unmount the image file after you finish, especially if you plan to alter the filesystem in the image. |
If you absolutely need to write to a floppy disk, but you keep getting I/O errors, you can try to format a disk with the superformat program (which is part of the fdutils package) or with fdformat.