diff options
Diffstat (limited to 'sag-0.6.1-www/sag-0.6.1.html/x817.html')
-rw-r--r-- | sag-0.6.1-www/sag-0.6.1.html/x817.html | 411 |
1 files changed, 411 insertions, 0 deletions
diff --git a/sag-0.6.1-www/sag-0.6.1.html/x817.html b/sag-0.6.1-www/sag-0.6.1.html/x817.html new file mode 100644 index 0000000..e7184cc --- /dev/null +++ b/sag-0.6.1-www/sag-0.6.1.html/x817.html @@ -0,0 +1,411 @@ +<!DOCTYPE HTML PUBLIC "-//Norman Walsh//DTD DocBook HTML 1.0//EN"> +<HTML +><HEAD +><TITLE +>Formatting</TITLE +><META +NAME="GENERATOR" +CONTENT="Modular DocBook HTML Stylesheet"><LINK +REL="HOME" +TITLE="The Linux System Administrators' Guide" +HREF="book1.html"><LINK +REL="UP" +TITLE="Using Disks and Other Storage Media" +HREF="c701.html"><LINK +REL="PREVIOUS" +TITLE="Tapes" +HREF="x811.html"><LINK +REL="NEXT" +TITLE="Partitions" +HREF="x876.html"></HEAD +><BODY +BGCOLOR="#FFFFFF" +TEXT="#000000" +><DIV +CLASS="NAVHEADER" +><TABLE +WIDTH="100%" +BORDER="0" +CELLPADDING="0" +CELLSPACING="0" +><TR +><TH +COLSPAN="3" +ALIGN="center" +>The Linux System Administrators' Guide</TH +></TR +><TR +><TD +WIDTH="10%" +ALIGN="left" +VALIGN="bottom" +><A +HREF="x811.html" +>Prev</A +></TD +><TD +WIDTH="80%" +ALIGN="center" +VALIGN="bottom" +>Chapter 4. Using Disks and Other Storage Media</TD +><TD +WIDTH="10%" +ALIGN="right" +VALIGN="bottom" +><A +HREF="x876.html" +>Next</A +></TD +></TR +></TABLE +><HR +ALIGN="LEFT" +WIDTH="100%"></DIV +><DIV +CLASS="SECT1" +><H1 +CLASS="SECT1" +><A +NAME="AEN817" +>Formatting</A +></H1 +><P +><I +CLASS="GLOSSTERM" +>Formatting</I +> is the process of writing marks on the + magnetic media that are used to mark tracks and sectors. + Before a disk is formatted, its magnetic surface is a complete + mess of magnetic signals. When it is formatted, some order is + brought into the chaos by essentially drawing lines where the + tracks go, and where they are divided into sectors. The + actual details are not quite exactly like this, but that is + irrelevant. What is important is that a disk cannot be used + unless it has been formatted.</P +><P +>The terminology is a bit confusing here: in MS-DOS, the word + formatting is used to cover also the process of creating a + filesystem (which will be discussed below). There, the two + processes are often combined, especially for floppies. When + the distinction needs to be made, the real formatting is + called <I +CLASS="GLOSSTERM" +>low-level formatting</I +>, while making the filesystem + is called <I +CLASS="GLOSSTERM" +>high-level formatting</I +>. In UNIX circles, + the two are called formatting and making a filesystem, so + that's what is used in this book as well.</P +><P +>For IDE and some SCSI disks the formatting is actually + done at the factory and doesn't need to be repeated; hence most + people rarely need to worry about it. In fact, formatting a + hard disk can cause it to work less well, for example because + a disk might need to be formatted in some very special way to + allow automatic bad sector replacement to work.</P +><P +>Disks that need to be or can be formatted often require a + special program anyway, because the interface to the formatting + logic inside the drive is different from drive to drive. + The formatting program is often either on the controller BIOS, + or is supplied as an MS-DOS program; neither of these can easily + be used from within Linux.</P +><P +>During formatting one might encounter bad spots on the + disk, called <I +CLASS="GLOSSTERM" +>bad blocks</I +> or <I +CLASS="GLOSSTERM" +>bad + sectors</I +>. These are sometimes handled by the drive + itself, but even then, if more of them develop, something needs + to be done to avoid using those parts of the disk. The logic to + do this is built into the filesystem; how to add the information + into the filesystem is described below. Alternatively, one + might create a small partition that covers just the bad part of + the disk; this approach might be a good idea if the bad spot is + very large, since filesystems can sometimes have trouble with + very large bad areas.</P +><P +>Floppies are formatted with <B +CLASS="COMMAND" +>fdformat</B +>. The floppy device + file to use is given as the parameter. For example, the + following command would format a high density, + 3.5 inch floppy in the first floppy drive: + +<PRE +CLASS="SCREEN" +><TT +CLASS="PROMPT" +>$</TT +> <TT +CLASS="USERINPUT" +><B +>fdformat /dev/fd0H1440</B +></TT +> +<TT +CLASS="COMPUTEROUTPUT" +>Double-sided, 80 tracks, 18 sec/track. Total capacity 1440 kB.</TT +> +<TT +CLASS="COMPUTEROUTPUT" +>Formatting ... done</TT +> +<TT +CLASS="COMPUTEROUTPUT" +>Verifying ... done</TT +> +<TT +CLASS="PROMPT" +>$</TT +></PRE +> + + Note that if you want to use an autodetecting device (e.g., + <TT +CLASS="FILENAME" +>/dev/fd0</TT +>), you <I +CLASS="EMPHASIS" +>must</I +> set the parameters of the device + with <B +CLASS="COMMAND" +>setfdprm</B +> first. To achieve the same effect as + above, one would have to do the following: + +<PRE +CLASS="SCREEN" +><TT +CLASS="PROMPT" +>$</TT +> <TT +CLASS="USERINPUT" +><B +>setfdprm /dev/fd0 1440/1440</B +></TT +> +<TT +CLASS="PROMPT" +>$</TT +> <TT +CLASS="USERINPUT" +><B +>fdformat /dev/fd0</B +></TT +> +<TT +CLASS="COMPUTEROUTPUT" +>Double-sided, 80 tracks, 18 sec/track. Total capacity 1440 kB.</TT +> +<TT +CLASS="COMPUTEROUTPUT" +>Formatting ... done</TT +> +<TT +CLASS="COMPUTEROUTPUT" +>Verifying ... done</TT +> +<TT +CLASS="PROMPT" +>$</TT +></PRE +> + + It is usually more convenient to choose the correct device file + that matches the type of the floppy. Note that it is unwise to + format floppies to contain more information than what they are + designed for.</P +><P +><B +CLASS="COMMAND" +>fdformat</B +> will also validate the floppy, i.e., check it + for bad blocks. It will try a bad block several times (you + can usually hear this, the drive noise changes dramatically). + If the floppy is only marginally bad (due to dirt on the + read/write head, some errors are false signals), <B +CLASS="COMMAND" +>fdformat</B +> won't + complain, but a real error will abort the validation process. + The kernel will print log messages for each I/O error it + finds; these will go to the console or, if <B +CLASS="COMMAND" +>syslog</B +> + is being used, to the file <TT +CLASS="FILENAME" +>/usr/log/messages</TT +>. <B +CLASS="COMMAND" +>fdformat</B +> + itself won't tell where the error is (one usually doesn't care, + floppies are cheap enough that a bad one is automatically thrown + away). + +<PRE +CLASS="SCREEN" +><TT +CLASS="PROMPT" +>$</TT +> <TT +CLASS="USERINPUT" +><B +>fdformat /dev/fd0H1440</B +></TT +> +<TT +CLASS="COMPUTEROUTPUT" +>Double-sided, 80 tracks, 18 sec/track. Total capacity 1440 kB.</TT +> +<TT +CLASS="COMPUTEROUTPUT" +>Formatting ... done</TT +> +<TT +CLASS="COMPUTEROUTPUT" +>Verifying ... read: Unknown error</TT +> +<TT +CLASS="PROMPT" +>$</TT +></PRE +> + + The <B +CLASS="COMMAND" +>badblocks</B +> command can be used to search any disk or + partition for bad blocks (including a floppy). It does not + format the disk, so it can be used to check even existing + filesystems. The example below checks a 3.5 inch + floppy with two bad blocks. + +<PRE +CLASS="SCREEN" +><TT +CLASS="PROMPT" +>$</TT +> <TT +CLASS="USERINPUT" +><B +>badblocks /dev/fd0H1440 1440</B +></TT +> +<TT +CLASS="COMPUTEROUTPUT" +>718</TT +> +<TT +CLASS="COMPUTEROUTPUT" +>719</TT +> +<TT +CLASS="PROMPT" +>$</TT +></PRE +> + + <B +CLASS="COMMAND" +>badblocks</B +> outputs the block numbers of the bad + blocks it finds. Most filesystems can avoid such bad blocks. They + maintain a list of known bad blocks, which is initialized when the + filesystem is made, and can be modified later. The initial search + for bad blocks can be done by the <B +CLASS="COMMAND" +>mkfs</B +> command + (which initializes the filesystem), but later checks should be + done with <B +CLASS="COMMAND" +>badblocks</B +> and the new blocks should + be added with <B +CLASS="COMMAND" +>fsck</B +>. We'll describe \cmd{mkfs} + and <B +CLASS="COMMAND" +>fsck</B +> later.</P +><P +>Many modern disks automatically notice bad blocks, and attempt + to fix them by using a special, reserved good block instead. + This is invisible to the operating system. This feature should + be documented in the disk's manual, if you're curious if it + is happening. Even such disks can fail, if the number of bad + blocks grows too large, although chances are that by then the disk + will be so rotten as to be unusable.</P +></DIV +><DIV +CLASS="NAVFOOTER" +><HR +ALIGN="LEFT" +WIDTH="100%"><TABLE +WIDTH="100%" +BORDER="0" +CELLPADDING="0" +CELLSPACING="0" +><TR +><TD +WIDTH="33%" +ALIGN="left" +VALIGN="top" +><A +HREF="x811.html" +>Prev</A +></TD +><TD +WIDTH="34%" +ALIGN="center" +VALIGN="top" +><A +HREF="book1.html" +>Home</A +></TD +><TD +WIDTH="33%" +ALIGN="right" +VALIGN="top" +><A +HREF="x876.html" +>Next</A +></TD +></TR +><TR +><TD +WIDTH="33%" +ALIGN="left" +VALIGN="top" +>Tapes</TD +><TD +WIDTH="34%" +ALIGN="center" +VALIGN="top" +><A +HREF="c701.html" +>Up</A +></TD +><TD +WIDTH="33%" +ALIGN="right" +VALIGN="top" +>Partitions</TD +></TR +></TABLE +></DIV +></BODY +></HTML +>
\ No newline at end of file |