diff options
Diffstat (limited to 'sag-0.6.1-www/sag-0.6.1.html/x876.html')
-rw-r--r-- | sag-0.6.1-www/sag-0.6.1.html/x876.html | 812 |
1 files changed, 812 insertions, 0 deletions
diff --git a/sag-0.6.1-www/sag-0.6.1.html/x876.html b/sag-0.6.1-www/sag-0.6.1.html/x876.html new file mode 100644 index 0000000..6b53efb --- /dev/null +++ b/sag-0.6.1-www/sag-0.6.1.html/x876.html @@ -0,0 +1,812 @@ +<!DOCTYPE HTML PUBLIC "-//Norman Walsh//DTD DocBook HTML 1.0//EN"> +<HTML +><HEAD +><TITLE +>Partitions</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="Formatting" +HREF="x817.html"><LINK +REL="NEXT" +TITLE="Filesystems" +HREF="x1029.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="x817.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="x1029.html" +>Next</A +></TD +></TR +></TABLE +><HR +ALIGN="LEFT" +WIDTH="100%"></DIV +><DIV +CLASS="SECT1" +><H1 +CLASS="SECT1" +><A +NAME="AEN876" +>Partitions</A +></H1 +><P +>A hard disk can be divided into several + <I +CLASS="GLOSSTERM" +>partitions</I +>. Each partition functions as if + it were a separate hard disk. The idea is that if you have one + hard disk, and want to have, say, two operating systems on it, + you can divide the disk into two partitions. Each operating + system uses its partition as it wishes and doesn't touch the + other one's. This way the two operating systems can co-exist + peacefully on the same hard disk. Without partitions one would + have to buy a hard disk for each operating system.</P +><P +>Floppies are not partitioned. There is no technical reason + against this, but since they're so small, partitions would be + useful only very rarely. CD-ROM's are usually also not + partitioned, since it's easier to use them as one big + disk, and there is seldom a need to have several operating + systems on one.</P +><DIV +CLASS="SECT2" +><H2 +CLASS="SECT2" +><A +NAME="AEN881" +>The MBR, boot sectors and partition table</A +></H2 +><P +>The information about how a hard disk has been partitioned + is stored in its first sector (that is, the first sector of the + first track on the first disk surface). The first sector is the + <I +CLASS="GLOSSTERM" +>master boot record</I +> (MBR) of the disk; this + is the sector that the BIOS reads in and starts when the machine + is first booted. The master boot record contains a small program + that reads the partition table, checks which partition is active + (that is, marked bootable), and reads the first sector of that + partition, the partition's <I +CLASS="GLOSSTERM" +>boot sector</I +> + (the MBR is also a boot sector, but it has a special status and + therefore a special name). This boot sector contains another + small program that reads the first part of the operating system + stored on that partition (assuming it is bootable), and then + starts it.</P +><P +>The partitioning scheme is not built into the hardware, or + even into the BIOS. It is only a convention that many + operating systems follow. Not all operating systems do follow + it, but they are the exceptions. Some operating + systems support partitions, but they occupy one partition on + the hard disk, and use their internal partitioning method + within that partition. The latter type exists peacefully + with other operating systems (including Linux), and does not + require any special measures, but an operating system + that doesn't support partitions cannot co-exist on the same + disk with any other operating system.</P +><P +>As a safety precaution, it is a good idea to write down the + partition table on a piece of paper, so that if it ever corrupts + you don't have to lose all your files. (A bad partition table + can be fixed with <B +CLASS="COMMAND" +>fdisk</B +>). The relevant information + is given by the <B +CLASS="COMMAND" +>fdisk -l</B +> command: + +<PRE +CLASS="SCREEN" +><TT +CLASS="PROMPT" +>$</TT +> <TT +CLASS="USERINPUT" +><B +>fdisk -l /dev/hda</B +></TT +> +<TT +CLASS="COMPUTEROUTPUT" +></TT +> +<TT +CLASS="COMPUTEROUTPUT" +>Disk /dev/hda: 15 heads, 57 sectors, 790 cylinders</TT +> +<TT +CLASS="COMPUTEROUTPUT" +>Units = cylinders of 855 * 512 bytes</TT +> +<TT +CLASS="COMPUTEROUTPUT" +></TT +> +<TT +CLASS="COMPUTEROUTPUT" +> Device Boot Begin Start End Blocks Id System</TT +> +<TT +CLASS="COMPUTEROUTPUT" +>/dev/hda1 1 1 24 10231+ 82 Linux swap</TT +> +<TT +CLASS="COMPUTEROUTPUT" +>/dev/hda2 25 25 48 10260 83 Linux native</TT +> +<TT +CLASS="COMPUTEROUTPUT" +>/dev/hda3 49 49 408 153900 83 Linux native</TT +> +<TT +CLASS="COMPUTEROUTPUT" +>/dev/hda4 409 409 790 163305 5 Extended</TT +> +<TT +CLASS="COMPUTEROUTPUT" +>/dev/hda5 409 409 744 143611+ 83 Linux native</TT +> +<TT +CLASS="COMPUTEROUTPUT" +>/dev/hda6 745 745 790 19636+ 83 Linux native</TT +> +<TT +CLASS="PROMPT" +>$</TT +></PRE +> </P +></DIV +><DIV +CLASS="SECT2" +><H2 +CLASS="SECT2" +><A +NAME="AEN905" +>Extended and logical partitions</A +></H2 +><P +>The original partitioning scheme for PC hard disks allowed + only four partitions. This quickly turned out to be too little + in real life, partly because some people want more than four + operating systems (Linux, MS-DOS, OS/2, Minix, FreeBSD, NetBSD, or + Windows/NT, to name a few), but primarily because sometimes it + is a good idea to have several partitions for one + operating system. For example, swap space is usually best put + in its own partition for Linux instead of in the main + Linux partition for reasons of speed (see below).</P +><P +>To overcome this design problem, <I +CLASS="GLOSSTERM" +>extended partitions</I +> were + invented. This trick allows partitioning a <I +CLASS="GLOSSTERM" +>primary + partition</I +> into sub-partitions. The + primary partition thus subdivided is the <I +CLASS="GLOSSTERM" +>extended partition</I +>; the + subpartitions are <I +CLASS="GLOSSTERM" +>logical partitions</I +>. They behave + like primary + + <A +NAME="AEN913" +HREF="#FTN.AEN913" +>[1]</A +> + + partitions, but are created differently. There is no speed + difference between them.</P +><P +>The partition structure of a hard disk might look like that + in <A +HREF="x876.html#HARD-DISK-LAYOUT" +>Figure 4-2</A +>. The disk is divided into + three primary partitions, the second of which is divided into + two logical partitions. Part of the disk is not partitioned + at all. The disk as a whole and each primary partition has a + boot sector.</P +><DIV +CLASS="FIGURE" +><P +><B +><A +NAME="HARD-DISK-LAYOUT" +>Figure 4-2. A sample hard disk partitioning.</A +></B +></P +><P +><IMG +SRC="hd-layout.gif"></P +></DIV +></DIV +><DIV +CLASS="SECT2" +><H2 +CLASS="SECT2" +><A +NAME="AEN920" +>Partition types</A +></H2 +><P +>The partition tables (the one in the MBR, and the ones for + extended partitions) contain one byte per partition that + identifies the type of that partition. This attempts to + identify the operating system that uses the partition, or what + it uses it for. The purpose is to make it possible to avoid + having two operating systems accidentally using the same + partition. However, in reality, operating systems do not + really care about the partition type byte; e.g., Linux + doesn't care at all what it is. Worse, some of them use it + incorrectly; e.g., at least some versions of DR-DOS ignore the + most significant bit of the byte, while others don't.</P +><P +>There is no standardization agency to specify what each byte + value means, but some commonly accepted ones are included in + in <A +HREF="x876.html#PARTITION-IDS" +>Table 4-1</A +>. The same list is + available in the Linux <B +CLASS="COMMAND" +>fdisk</B +> program.</P +><DIV +CLASS="TABLE" +><P +><B +><A +NAME="PARTITION-IDS" +>Table 4-1. Partition types (from the Linux <B +CLASS="COMMAND" +>fdisk</B +> program).</A +></B +></P +><TABLE +BORDER="1" +CLASS="CALSTABLE" +><TR +><TD +ALIGN="LEFT" +VALIGN="TOP" +>0</TD +><TD +ALIGN="LEFT" +VALIGN="TOP" +>Empty</TD +><TD +ALIGN="LEFT" +VALIGN="TOP" +>40</TD +><TD +ALIGN="LEFT" +VALIGN="TOP" +>Venix 80286</TD +><TD +ALIGN="LEFT" +VALIGN="TOP" +>94</TD +><TD +ALIGN="LEFT" +VALIGN="TOP" +>Amoeba BBT</TD +></TR +><TR +><TD +ALIGN="LEFT" +VALIGN="TOP" +>1</TD +><TD +ALIGN="LEFT" +VALIGN="TOP" +>DOS 12-bit FAT</TD +><TD +ALIGN="LEFT" +VALIGN="TOP" +>51</TD +><TD +ALIGN="LEFT" +VALIGN="TOP" +>Novell?</TD +><TD +ALIGN="LEFT" +VALIGN="TOP" +>a5</TD +><TD +ALIGN="LEFT" +VALIGN="TOP" +>BSD/386</TD +></TR +><TR +><TD +ALIGN="LEFT" +VALIGN="TOP" +>2</TD +><TD +ALIGN="LEFT" +VALIGN="TOP" +>XENIX root</TD +><TD +ALIGN="LEFT" +VALIGN="TOP" +>52</TD +><TD +ALIGN="LEFT" +VALIGN="TOP" +>Microport</TD +><TD +ALIGN="LEFT" +VALIGN="TOP" +>b7</TD +><TD +ALIGN="LEFT" +VALIGN="TOP" +>BSDI fs</TD +></TR +><TR +><TD +ALIGN="LEFT" +VALIGN="TOP" +>3</TD +><TD +ALIGN="LEFT" +VALIGN="TOP" +>XENIX usr</TD +><TD +ALIGN="LEFT" +VALIGN="TOP" +>63</TD +><TD +ALIGN="LEFT" +VALIGN="TOP" +>GNU HURD</TD +><TD +ALIGN="LEFT" +VALIGN="TOP" +>b8</TD +><TD +ALIGN="LEFT" +VALIGN="TOP" +>BSDI swap</TD +></TR +><TR +><TD +ALIGN="LEFT" +VALIGN="TOP" +>4</TD +><TD +ALIGN="LEFT" +VALIGN="TOP" +>DOS 16-bitf <32M</TD +><TD +ALIGN="LEFT" +VALIGN="TOP" +>64</TD +><TD +ALIGN="LEFT" +VALIGN="TOP" +>Novell</TD +><TD +ALIGN="LEFT" +VALIGN="TOP" +>c7</TD +><TD +ALIGN="LEFT" +VALIGN="TOP" +>Syrinx</TD +></TR +><TR +><TD +ALIGN="LEFT" +VALIGN="TOP" +>5</TD +><TD +ALIGN="LEFT" +VALIGN="TOP" +>Extended</TD +><TD +ALIGN="LEFT" +VALIGN="TOP" +>75</TD +><TD +ALIGN="LEFT" +VALIGN="TOP" +>PC/IX</TD +><TD +ALIGN="LEFT" +VALIGN="TOP" +>db</TD +><TD +ALIGN="LEFT" +VALIGN="TOP" +>CP/M</TD +></TR +><TR +><TD +ALIGN="LEFT" +VALIGN="TOP" +>6</TD +><TD +ALIGN="LEFT" +VALIGN="TOP" +>DOS 16-bit >=32M</TD +><TD +ALIGN="LEFT" +VALIGN="TOP" +>80</TD +><TD +ALIGN="LEFT" +VALIGN="TOP" +>Old MINIX</TD +><TD +ALIGN="LEFT" +VALIGN="TOP" +>e1</TD +><TD +ALIGN="LEFT" +VALIGN="TOP" +>DOS access</TD +></TR +><TR +><TD +ALIGN="LEFT" +VALIGN="TOP" +>7</TD +><TD +ALIGN="LEFT" +VALIGN="TOP" +>OS/2 HPFS</TD +><TD +ALIGN="LEFT" +VALIGN="TOP" +>81</TD +><TD +ALIGN="LEFT" +VALIGN="TOP" +>Linux/MINIX</TD +><TD +ALIGN="LEFT" +VALIGN="TOP" +>e3</TD +><TD +ALIGN="LEFT" +VALIGN="TOP" +>DOS R/O</TD +></TR +><TR +><TD +ALIGN="LEFT" +VALIGN="TOP" +>8</TD +><TD +ALIGN="LEFT" +VALIGN="TOP" +>AIX</TD +><TD +ALIGN="LEFT" +VALIGN="TOP" +>82</TD +><TD +ALIGN="LEFT" +VALIGN="TOP" +>Linux swap</TD +><TD +ALIGN="LEFT" +VALIGN="TOP" +>f2</TD +><TD +ALIGN="LEFT" +VALIGN="TOP" +>DOS secondary</TD +></TR +><TR +><TD +ALIGN="LEFT" +VALIGN="TOP" +>9</TD +><TD +ALIGN="LEFT" +VALIGN="TOP" +>AIX bootable</TD +><TD +ALIGN="LEFT" +VALIGN="TOP" +>83</TD +><TD +ALIGN="LEFT" +VALIGN="TOP" +>Linux native</TD +><TD +ALIGN="LEFT" +VALIGN="TOP" +>ff</TD +><TD +ALIGN="LEFT" +VALIGN="TOP" +>BBT</TD +></TR +><TR +><TD +ALIGN="LEFT" +VALIGN="TOP" +>a</TD +><TD +ALIGN="LEFT" +VALIGN="TOP" +>OS/2 Boot Manag</TD +><TD +ALIGN="LEFT" +VALIGN="TOP" +>93</TD +><TD +ALIGN="LEFT" +VALIGN="TOP" +>Amoeba</TD +><TD +ALIGN="LEFT" +VALIGN="TOP" +> </TD +><TD +ALIGN="LEFT" +VALIGN="TOP" +> </TD +></TR +></TABLE +></DIV +></DIV +><DIV +CLASS="SECT2" +><H2 +CLASS="SECT2" +><A +NAME="AEN1008" +>Partitioning a hard disk</A +></H2 +><P +>There are many programs for creating and removing + partitions. Most operating systems have their own, and it + can be a good idea to use each operating system's own, just + in case it does something unusual that the others can't. + Many of the programs are called <B +CLASS="COMMAND" +>fdisk</B +>, + including the Linux one, or variations thereof. Details on + using the Linux <B +CLASS="COMMAND" +>fdisk</B +> are given on its + man page. The <B +CLASS="COMMAND" +>cfdisk</B +> command is similar + to <B +CLASS="COMMAND" +>fdisk</B +>, but has a nicer (full screen) + user interface.</P +><P +>When using IDE disks, the boot partition (the partition + with the bootable kernel image files) must be completely + within the first 1024 cylinders. This is because the disk is + used via the BIOS during boot (before the system goes into + protected mode), and BIOS can't handle more than 1024 cylinders. + It is sometimes possible to use a boot partition that is only + partly within the first 1024 cylinders. This works as long + as all the files that are read with the BIOS are within the + first 1024 cylinders. Since this is difficult to arrange, + it is <I +CLASS="EMPHASIS" +>a very bad idea</I +> to do it; you never know when + a kernel update or disk defragmentation will result in an + unbootable system. Therefore, make sure your boot partition + is completely within the first 1024 cylinders.</P +><P +>Some newer versions of the BIOS and IDE disks can, in fact, + handle disks with more than 1024 cylinders. If you have such + a system, you can forget about the problem; if you aren't quite + sure of it, put it within the first 1024 cylinders.</P +><P +>Each partition should have an even number of sectors, + since the Linux filesystems use a 1 kilobyte block size, i.e., + two sectors. An odd number of sectors will result in the + last sector being unused. This won't result in any problems, + but it is ugly, and some versions of <B +CLASS="COMMAND" +>fdisk</B +> + will warn about it.</P +><P +>Changing a partition's size usually requires first backing up + everything you want to save from that partition (preferably the + whole disk, just in case), deleting the partition, creating + new partition, then restoring everything to the new partition. + If the partition is growing, you may need to adjust the sizes + (and backup and restore) of the adjoining partitions as well.</P +><P +>Since changing partition sizes is painful, it is preferable to + get the partitions right + the first time, or have an effective and easy to use backup + system. If you're installing from a media that does not require + much human intervention (say, from CD-ROM, as opposed to floppies), + it is often easy to play with different configuration at first. + Since you don't already have data to back up, it is not so + painful to modify partition sizes several times.</P +><P +>There is a program for MS-DOS, called + <B +CLASS="COMMAND" +>fips</B +>, which resizes an MS-DOS partition without + requiring the backup and restore, but for other filesystems it + is still necessary.</P +></DIV +><DIV +CLASS="SECT2" +><H2 +CLASS="SECT2" +><A +NAME="AEN1024" +>Device files and partitions</A +></H2 +><P +>Each partition and extended partition has its own + device file. The naming convention for these files is that a + partition's number is appended after the name of the whole disk, + with the convention that 1-4 are primary partitions (regardless + of how many primary partitions there are) and 5-8 are logical + partitions (regardless of within which primary partition + they reside). For example, <TT +CLASS="FILENAME" +>/dev/hda1</TT +> + is the first primary partition on the first IDE hard disk, and + <TT +CLASS="FILENAME" +>/dev/sdb7</TT +> is the third extended partition on + the second SCSI hard disk. The device list in XXX (device list) + gives more information.</P +></DIV +></DIV +><H3 +>Notes</H3 +><TABLE +BORDER="0" +CLASS="FOOTNOTES" +WIDTH="100%" +><TR +><TD +ALIGN="LEFT" +VALIGN="TOP" +WIDTH="5%" +><A +NAME="FTN.AEN913" +HREF="x876.html#AEN913" +>[1]</A +></TD +><TD +ALIGN="LEFT" +VALIGN="TOP" +WIDTH="95%" +><P +>Illogical?</P +></TD +></TR +></TABLE +><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="x817.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="x1029.html" +>Next</A +></TD +></TR +><TR +><TD +WIDTH="33%" +ALIGN="left" +VALIGN="top" +>Formatting</TD +><TD +WIDTH="34%" +ALIGN="center" +VALIGN="top" +><A +HREF="c701.html" +>Up</A +></TD +><TD +WIDTH="33%" +ALIGN="right" +VALIGN="top" +>Filesystems</TD +></TR +></TABLE +></DIV +></BODY +></HTML +>
\ No newline at end of file |