Using Linux:Managing the Filesystem
-->
Previous
Table of Contents
Next
Formatting and creating a Linux floppy fstab entry
1. Log on as the root operator and insert a blank disk into your floppy drive.
2. Use the mkfs command, followed by the t option, the name of a filesystem, and the floppy device name on the command line to format a floppy:
# mkfs -t ext2 /dev/fd1
mke2fs 1.10, 24-Apr-97 for EXT2 FS 0.5b, 95/08/09
Linux ext2 filesystem format
Filesystem label=
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
Writing inode tables: done
Writing superblocks and filesystem accounting
information: done
3. After the mkfs command creates the filesystem on your disk, you can include the disk in your filesystems table by changing an existing line referring to a vfat filesystem on /dev/fd1, or by creating a new line.
Log on as the root operator, and then, using your favorite text editor, open the /etc/fstab file. Type an entry for your floppy like this:
/dev/fd1 /mnt/floppy ext2
user,sync,errors=continue 0 0
4. You can then use the mount command to mount your new Linux disk, like this:
# mount -t ext2 /dev/fd1 /mnt/floppy
5. Use the ls command, along with the la (long-format and all) options, to verify the contents of the new disk:
# ls -la /mnt/floppy
total 14
drwxr-xr-x 3 root root 1024 Aug 1
19:49 .
drwxr-xr-x 7 root root 1024 Jul 3
21:47 ..
drwxr-xr-x 2 root root 12288 Aug 1 19:49
lost+found
6. Finally, you can unmount the disk with the umount command, followed by the mount point of the disk:
# umount /mnt/floppy
The structure and creation of an ext2 filesystem on a floppy shows that there is no volume label, and there are 4,096 bytes (4KB) per inode (360 × 4 = 1,440). The block size is 1KB and 5% of the disk is reserved for root. These are the defaults (which are explained in the mke2fs manual page).
The first three columns in the floppy disks /etc/fstab entry are the Device, Mount Point, and Filesystem type. The Options column is more complex than previous ones. The user option indicates that users are allowed to mount this filesystem. The sync option indicates that programs writing to this filesystem wait while each write finishes, and only then continue.
This might seem obvious, but it is not the normal state of affairs. The kernel normally manages filesystem writes in such a way as to provide high performance (data still gets written to the device, of course, but it doesnt necessarily happen immediately). This is perfect for fixed devices such as hard disks, but for low-capacity removable devices such as floppy disks, its less beneficial. Normally, you write a few files to a floppy, then unmount it and take it away. The unmount operation must wait until all data has been written to the device before it can finish (and the disk can then be removed).
Having to wait like this is off-putting, and there is always the risk that someone might copy a file to the floppy, wait for the disk light to go out, and remove it. With asynchronous writes, some buffered data might not have yet been written to disk. Hence, synchronous writes are safer for removable media.
The ext2 filesystem has a configurable strategy for errors. If an ext2 filesystem encounters an error (for example, a bad disk block), there are three possible responses to the error:
Remount the device read-onlyFor filesystems that contain mostly nonessential data (for example, /tmp, /var/tmp, or news spools), remounting the filesystem read-only so that it can be fixed with fsck is often the best choice.
PanicContinuing in the face of potentially corrupted system configuration files is unwise, so a kernel panic (that is, a controlled crashor emergency landing, if you prefer) can sometimes be appropriate.
Ignore itCausing a system shutdown if a floppy disk has a bad sector is a little excessive, so the continue option tells the kernel to carry on regardless in this situation. If this actually does happen, the best thing to do is to use the -c option of e2fsck, for example, with fsck -t ext2 -c /dev/fd1. This runs e2fsck, giving it the -c option, which invokes the badblocks command to test the device for bad disk blocks. After this is done, e2fsck does its best to recover from the situation.
Previous
Table of Contents
Next
Wyszukiwarka
Podobne podstrony:
505 (3)Peugeot 508 napełnianie zbiornika dodatku(1)2014 12 23 Dec nr 508 MON 1 BPZ 17 Wlkp BZ odznaki505 praktycznych skryptow dla webmastera508 (3)instrukcja obslugi dla zestawu s uchawkowego Nokia BH 505 PL503 505505 (2)04 (508)508 510demo cgi 505503 50504 (505)503 508więcej podobnych podstron