-->

Previous | Table of Contents | Next

Page 317

CAUTION
You should know that editing the filesystem table by hand is inherently dangerous. You learned to add quotas in Hour 20, "Basic System Administration," but generally you should not edit this file by hand. Instead, use Red Hat's graphical filesystem configuration tool, fstool, discussed in Hour 22. Use this tool if you need to add a hard drive, new partitions, and so on. Although you can edit the fstab file, before you do, make sure you have a backup boot disk on hand, and make a copy of the fstab file before you edit it.

Normally the root operator mounts and unmounts filesystems. But if you take my advice and don't run Linux as root all the time, you'll have to use the su command to mount and unmount filesystems. By using the user option of the mount command, you won't have to use the su command to mount CD-ROMs. You can, for example, change the original fstab entries to


/dev/cdrom      /mnt/cdrom           iso9660 noauto,ro,user 0 0

/dev/hdb        /mnt/cdrom           iso9660 noauto,ro,user 0 0

You'll now be able to mount CD-ROMs without having to be the root operator, by using


# mount /dev/cdrom

or


# mount /mnt/cdrom

This will automatically mount your CD-ROM's filesystem at the /mnt/cdrom path. You'll also be able to switch your disks with the umount command, for example:


# umount /dev/cdrom

or


# umount /mnt/cdrom

Although you should enable this type of convenience only if you're using Linux on a standalone computer, and only for certain types of filesystems, such as CD-ROMs, it is convenient, especially for removable filesystems. Another type of removable filesystem is the venerable floppy drive. The next section discusses floppy drives, and is followed by a discussion of a package of floppy utilities that can make life easier when dealing with floppies under Linux.

Page 318

Formatting a Floppy

This section introduces you to three programs you might need to format a floppy under Linux and takes you step-by-step through the process. You might find this information useful if you want to back up files or use the floppy to install and test new software. You'll also learn how to format and then mount your floppy in Linux native format using the ext2 filesystem (used for your Linux partition, and the root, or /, directory).

The floppy devices are located under the /dev directory, and there are quite a few of them. You'll find a device corresponding to just about any type of floppy device ever made. You can look at the /dev directory for floppy devices as follows:


# ls /dev/fd*

/dev/fd0        /dev/fd0H1722   /dev/fd0h1600   /dev/fd1E3200   /dev/fd1H830

/dev/fd0CompaQ  /dev/fd0H1743   /dev/fd0h360    /dev/fd1E3520   /dev/fd1d360

/dev/fd0D1040   /dev/fd0H1760   /dev/fd0h410    /dev/fd1E3840   /dev/fd1h1200

/dev/fd0D1120   /dev/fd0H1840   /dev/fd0h420    /dev/fd1H1440   /dev/fd1h1440

/dev/fd0D360    /dev/fd0H1920   /dev/fd0h720    /dev/fd1H1600   /dev/fd1h1476

/dev/fd0D720    /dev/fd0H360    /dev/fd0h880    /dev/fd1H1680   /dev/fd1h1494

/dev/fd0D800    /dev/fd0H720    /dev/fd1        /dev/fd1H1722   /dev/fd1h1600

/dev/fd0E2880   /dev/fd0H820    /dev/fd1CompaQ  /dev/fd1H1743   /dev/fd1h360

/dev/fd0E3200   /dev/fd0H830    /dev/fd1D1040   /dev/fd1H1760   /dev/fd1h410

/dev/fd0E3520   /dev/fd0d360    /dev/fd1D1120   /dev/fd1H1840   /dev/fd1h420

/dev/fd0E3840   /dev/fd0h1200   /dev/fd1D360    /dev/fd1H1920   /dev/fd1h720

/dev/fd0H1440   /dev/fd0h1440   /dev/fd1D720    /dev/fd1H360    /dev/fd1h880

/dev/fd0H1600   /dev/fd0h1476   /dev/fd1D800    /dev/fd1H720

/dev/fd0H1680   /dev/fd0h1494   /dev/fd1E2880   /dev/fd1H820

This section concentrates on the more common device for 3.5-inch, 1.44MB floppies.
These are

/dev/fd0—Drive A
/dev/fd1—Drive B

A number of supported floppy formats are listed in the fdprm, or floppy drive parameter file, under the /etc/ directory. Take a look at a portion of the file:


# /etc/fdprm  -  floppy disk parameter table



# Common disk formats. Names are of the form

#  actual media capacity/maximum drive capacity

# (Note: although 5.25" HD drives can format disks at 1.44M, they're listed

#        as 1200 because that's the common maximum size.)



#               size sec/t hds trk stre gap  rate spec1 fmt_gap

360/360          720     9   2  40    0 0x2A 0x02 0xDF     0x50

1200/1200       2400    15   2  80    0 0x1B 0x00 0xDF     0x54

360/720          720     9   2  40    1 0x2A 0x02 0xDF     0x50

720/720         1440     9   2  80    0 0x2A 0x02 0xDF     0x50

720/1440        1440     9   2  80    0 0x2A 0x02 0xDF     0x50

360/1200         720     9   2  40    1 0x23 0x01 0xDF     0x50

720/1200        1440     9   2  80    0 0x23 0x01 0xDF     0x50

1440/1440       2880    18   2  80    0 0x1B 0x00 0xCF     0x6C

...

Page 319

The format you'll most likely be interested in is the 1440/1440 description of today's 3.5-inch high-density drives. Using this name, you'll use the setfdprm (set floppy disk parameter) command (found under the /usr/bin directory), to associate your drive A: floppy with its device, /dev/fd0, as follows:


# setfdprm -p /dev/fd0 1440/1440

After that, you can proceed with a low-level format of your drive. To do this, you'll use the fdformat (floppy disk formatting) command (found under the /usr/bin directory). Insert a blank disk in your drive and then use


# fdformat /dev/fd0

Double-sided, 80 tracks, 18 sec/track. Total capacity 1440 kB.

Formatting ... done

Verifying ... done

Here, you've told the fdformat command to do a low-level format of the /dev/fd0 device. Be careful! Make sure to specify the correct device.

TIME SAVER
You should also know that you can alternatively use a specific floppy device to do the low-level format, for example:

          # fdformat /dev/fd0H1440

This tells fdformat to use the specific floppy device for high-density drives, in this case, the A: drive.

The next step is to create a filesystem on the floppy. You'll use the mke2fs command to make a Linux second extended filesystem on the floppy. The mke2fs command, found under the /sbin directory, has at least two dozen command-line options, but you'll only use a few, for example:


# mke2fs -c -v -L "Linux1" /dev/fd0

mke2fs 1.10, 24-Apr-97 for EXT2 FS 0.5b, 95/08/09

Linux ext2 filesystem format

Filesystem label=Linux1

360 inodes, 1440 blocks

72 blocks (5.00%) reserved for the super user

First data block=1

Block size=1024 (log=0)

Fragment size=1024 (log=0)

1 block group

8192 blocks per group, 8192 fragments per group

360 inodes per group



Running command: badblocks -s /dev/fd0 1440

Checking for bad blocks (read-only test): done

Writing inode tables: done

Writing superblocks and filesystem accounting information: done

Previous | Table of Contents | Next