/[gentoo]/xml/htdocs/doc/en/handbook/hb-install-x86+amd64-disk.xml
Gentoo

Diff of /xml/htdocs/doc/en/handbook/hb-install-x86+amd64-disk.xml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.10 Revision 1.11
2<!DOCTYPE sections SYSTEM "/dtd/book.dtd"> 2<!DOCTYPE sections SYSTEM "/dtd/book.dtd">
3 3
4<!-- The content of this document is licensed under the CC-BY-SA license --> 4<!-- The content of this document is licensed under the CC-BY-SA license -->
5<!-- See http://creativecommons.org/licenses/by-sa/2.5 --> 5<!-- See http://creativecommons.org/licenses/by-sa/2.5 -->
6 6
7<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-install-x86+amd64-disk.xml,v 1.10 2008/04/01 08:53:46 nightmorph Exp $ --> 7<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-install-x86+amd64-disk.xml,v 1.11 2008/05/02 08:04:23 nightmorph Exp $ -->
8 8
9<sections> 9<sections>
10 10
11<abstract> 11<abstract>
12To be able to install Gentoo, you must create the necessary partitions. 12To be able to install Gentoo, you must create the necessary partitions.
13This chapter describes how to partition a disk for future usage. 13This chapter describes how to partition a disk for future usage.
14</abstract> 14</abstract>
15 15
16<version>6.0</version> 16<version>6.1</version>
17<date>2008-04-01</date> 17<date>2008-05-02</date>
18 18
19<section> 19<section>
20<title>Introduction to Block Devices</title> 20<title>Introduction to Block Devices</title>
21 21
22<subsection> 22<subsection>
40</p> 40</p>
41 41
42<p> 42<p>
43A <e>primary</e> partition is a partition which has its information stored in 43A <e>primary</e> partition is a partition which has its information stored in
44the MBR (master boot record). As an MBR is very small (512 bytes) only four 44the MBR (master boot record). As an MBR is very small (512 bytes) only four
45primary partitions can be defined (for instance, <path>/dev/hda1</path> to 45primary partitions can be defined (for instance, <path>/dev/sda1</path> to
46<path>/dev/hda4</path>). 46<path>/dev/sda4</path>).
47</p> 47</p>
48 48
49<p> 49<p>
50An <e>extended</e> partition is a special primary partition (meaning the 50An <e>extended</e> partition is a special primary partition (meaning the
51extended partition must be one of the four possible primary partitions) which 51extended partition must be one of the four possible primary partitions) which
93 <th>Filesystem</th> 93 <th>Filesystem</th>
94 <th>Size</th> 94 <th>Size</th>
95 <th>Description</th> 95 <th>Description</th>
96</tr> 96</tr>
97<tr> 97<tr>
98 <ti><path>/dev/hda1</path></ti> 98 <ti><path>/dev/sda1</path></ti>
99 <ti>ext2</ti> 99 <ti>ext2</ti>
100 <ti>32M</ti> 100 <ti>32M</ti>
101 <ti>Boot partition</ti> 101 <ti>Boot partition</ti>
102</tr> 102</tr>
103<tr> 103<tr>
104 <ti><path>/dev/hda2</path></ti> 104 <ti><path>/dev/sda2</path></ti>
105 <ti>(swap)</ti> 105 <ti>(swap)</ti>
106 <ti>512M</ti> 106 <ti>512M</ti>
107 <ti>Swap partition</ti> 107 <ti>Swap partition</ti>
108</tr> 108</tr>
109<tr> 109<tr>
110 <ti><path>/dev/hda3</path></ti> 110 <ti><path>/dev/sda3</path></ti>
111 <ti>ext3</ti> 111 <ti>ext3</ti>
112 <ti>Rest of the disk</ti> 112 <ti>Rest of the disk</ti>
113 <ti>Root partition</ti> 113 <ti>Root partition</ti>
114</tr> 114</tr>
115</table> 115</table>
178</p> 178</p>
179 179
180<pre caption="Filesystem usage example"> 180<pre caption="Filesystem usage example">
181$ <i>df -h</i> 181$ <i>df -h</i>
182Filesystem Type Size Used Avail Use% Mounted on 182Filesystem Type Size Used Avail Use% Mounted on
183/dev/hda5 ext3 509M 132M 351M 28% / 183/dev/sda5 ext3 509M 132M 351M 28% /
184/dev/hda2 ext3 5.0G 3.0G 1.8G 63% /home 184/dev/sda2 ext3 5.0G 3.0G 1.8G 63% /home
185/dev/hda7 ext3 7.9G 6.2G 1.3G 83% /usr 185/dev/sda7 ext3 7.9G 6.2G 1.3G 83% /usr
186/dev/hda8 ext3 1011M 483M 477M 51% /opt 186/dev/sda8 ext3 1011M 483M 477M 51% /opt
187/dev/hda9 ext3 2.0G 607M 1.3G 32% /var 187/dev/sda9 ext3 2.0G 607M 1.3G 32% /var
188/dev/hda1 ext2 51M 17M 31M 36% /boot 188/dev/sda1 ext2 51M 17M 31M 36% /boot
189/dev/hda6 swap 516M 12M 504M 2% &lt;not mounted&gt; 189/dev/sda6 swap 516M 12M 504M 2% &lt;not mounted&gt;
190<comment>(Unpartitioned space for future usage: 2 GB)</comment> 190<comment>(Unpartitioned space for future usage: 2 GB)</comment>
191</pre> 191</pre>
192 192
193<p> 193<p>
194<path>/usr</path> is rather full (83% used) here, but once 194<path>/usr</path> is rather full (83% used) here, but once
218<tr> 218<tr>
219 <th>Partition</th> 219 <th>Partition</th>
220 <th>Description</th> 220 <th>Description</th>
221</tr> 221</tr>
222<tr> 222<tr>
223 <ti><path>/dev/hda1</path></ti> 223 <ti><path>/dev/sda1</path></ti>
224 <ti>Boot partition</ti> 224 <ti>Boot partition</ti>
225</tr> 225</tr>
226<tr> 226<tr>
227 <ti><path>/dev/hda2</path></ti> 227 <ti><path>/dev/sda2</path></ti>
228 <ti>Swap partition</ti> 228 <ti>Swap partition</ti>
229</tr> 229</tr>
230<tr> 230<tr>
231 <ti><path>/dev/hda3</path></ti> 231 <ti><path>/dev/sda3</path></ti>
232 <ti>Root partition</ti> 232 <ti>Root partition</ti>
233</tr> 233</tr>
234</table> 234</table>
235 235
236<p> 236<p>
244<body> 244<body>
245 245
246<p> 246<p>
247<c>fdisk</c> is a popular and powerful tool to split your disk into partitions. 247<c>fdisk</c> is a popular and powerful tool to split your disk into partitions.
248Fire up <c>fdisk</c> on your disk (in our example, we use 248Fire up <c>fdisk</c> on your disk (in our example, we use
249<path>/dev/hda</path>): 249<path>/dev/sda</path>):
250</p> 250</p>
251 251
252<pre caption="Starting fdisk"> 252<pre caption="Starting fdisk">
253# <i>fdisk /dev/hda</i> 253# <i>fdisk /dev/sda</i>
254</pre> 254</pre>
255 255
256<p> 256<p>
257Once in <c>fdisk</c>, you'll be greeted with a prompt that looks like this: 257Once in <c>fdisk</c>, you'll be greeted with a prompt that looks like this:
258</p> 258</p>
266</p> 266</p>
267 267
268<pre caption="An example partition configuration"> 268<pre caption="An example partition configuration">
269Command (m for help): <i>p</i> 269Command (m for help): <i>p</i>
270 270
271Disk /dev/hda: 240 heads, 63 sectors, 2184 cylinders 271Disk /dev/sda: 240 heads, 63 sectors, 2184 cylinders
272Units = cylinders of 15120 * 512 bytes 272Units = cylinders of 15120 * 512 bytes
273 273
274Device Boot Start End Blocks Id System 274Device Boot Start End Blocks Id System
275/dev/hda1 1 14 105808+ 83 Linux 275/dev/sda1 1 14 105808+ 83 Linux
276/dev/hda2 15 49 264600 82 Linux swap 276/dev/sda2 15 49 264600 82 Linux swap
277/dev/hda3 50 70 158760 83 Linux 277/dev/sda3 50 70 158760 83 Linux
278/dev/hda4 71 2184 15981840 5 Extended 278/dev/sda4 71 2184 15981840 5 Extended
279/dev/hda5 71 209 1050808+ 83 Linux 279/dev/sda5 71 209 1050808+ 83 Linux
280/dev/hda6 210 348 1050808+ 83 Linux 280/dev/sda6 210 348 1050808+ 83 Linux
281/dev/hda7 349 626 2101648+ 83 Linux 281/dev/sda7 349 626 2101648+ 83 Linux
282/dev/hda8 627 904 2101648+ 83 Linux 282/dev/sda8 627 904 2101648+ 83 Linux
283/dev/hda9 905 2184 9676768+ 83 Linux 283/dev/sda9 905 2184 9676768+ 83 Linux
284 284
285Command (m for help): 285Command (m for help):
286</pre> 286</pre>
287 287
288<p> 288<p>
297<title>Removing all Partitions</title> 297<title>Removing all Partitions</title>
298<body> 298<body>
299 299
300<p> 300<p>
301We will first remove all existing partitions from the disk. Type <c>d</c> to 301We will first remove all existing partitions from the disk. Type <c>d</c> to
302delete a partition. For instance, to delete an existing <path>/dev/hda1</path>: 302delete a partition. For instance, to delete an existing <path>/dev/sda1</path>:
303</p> 303</p>
304 304
305<pre caption="Deleting a partition"> 305<pre caption="Deleting a partition">
306Command (m for help): <i>d</i> 306Command (m for help): <i>d</i>
307Partition number (1-4): <i>1</i> 307Partition number (1-4): <i>1</i>
320<c>d</c> and the number of the partition to delete it. Eventually, you'll end 320<c>d</c> and the number of the partition to delete it. Eventually, you'll end
321up with a partition table with nothing in it: 321up with a partition table with nothing in it:
322</p> 322</p>
323 323
324<pre caption="An empty partition table"> 324<pre caption="An empty partition table">
325Disk /dev/hda: 30.0 GB, 30005821440 bytes 325Disk /dev/sda: 30.0 GB, 30005821440 bytes
326240 heads, 63 sectors/track, 3876 cylinders 326240 heads, 63 sectors/track, 3876 cylinders
327Units = cylinders of 15120 * 512 = 7741440 bytes 327Units = cylinders of 15120 * 512 = 7741440 bytes
328 328
329Device Boot Start End Blocks Id System 329Device Boot Start End Blocks Id System
330 330
369</p> 369</p>
370 370
371<pre caption="Created boot partition"> 371<pre caption="Created boot partition">
372Command (m for help): <i>p</i> 372Command (m for help): <i>p</i>
373 373
374Disk /dev/hda: 30.0 GB, 30005821440 bytes 374Disk /dev/sda: 30.0 GB, 30005821440 bytes
375240 heads, 63 sectors/track, 3876 cylinders 375240 heads, 63 sectors/track, 3876 cylinders
376Units = cylinders of 15120 * 512 = 7741440 bytes 376Units = cylinders of 15120 * 512 = 7741440 bytes
377 377
378Device Boot Start End Blocks Id System 378Device Boot Start End Blocks Id System
379/dev/hda1 1 14 105808+ 83 Linux 379/dev/sda1 1 14 105808+ 83 Linux
380</pre> 380</pre>
381 381
382<p> 382<p>
383We need to make this partition bootable. Type <c>a</c> to toggle the bootable 383We need to make this partition bootable. Type <c>a</c> to toggle the bootable
384flag on a partition and select <c>1</c>. If you press <c>p</c> again, you will 384flag on a partition and select <c>1</c>. If you press <c>p</c> again, you will
392<body> 392<body>
393 393
394<p> 394<p>
395Let's now create the swap partition. To do this, type <c>n</c> to create a new 395Let's now create the swap partition. To do this, type <c>n</c> to create a new
396partition, then <c>p</c> to tell fdisk that you want a primary partition. Then 396partition, then <c>p</c> to tell fdisk that you want a primary partition. Then
397type <c>2</c> to create the second primary partition, <path>/dev/hda2</path> in 397type <c>2</c> to create the second primary partition, <path>/dev/sda2</path> in
398our case. When prompted for the first cylinder, hit enter. When prompted for 398our case. When prompted for the first cylinder, hit enter. When prompted for
399the last cylinder, type <c>+512M</c> to create a partition 512MB in size. After 399the last cylinder, type <c>+512M</c> to create a partition 512MB in size. After
400you've done this, type <c>t</c> to set the partition type, <c>2</c> to select 400you've done this, type <c>t</c> to set the partition type, <c>2</c> to select
401the partition you just created and then type in <c>82</c> to set the partition 401the partition you just created and then type in <c>82</c> to set the partition
402type to "Linux Swap". After completing these steps, typing <c>p</c> should 402type to "Linux Swap". After completing these steps, typing <c>p</c> should
404</p> 404</p>
405 405
406<pre caption="Partition listing after creating a swap partition"> 406<pre caption="Partition listing after creating a swap partition">
407Command (m for help): <i>p</i> 407Command (m for help): <i>p</i>
408 408
409Disk /dev/hda: 30.0 GB, 30005821440 bytes 409Disk /dev/sda: 30.0 GB, 30005821440 bytes
410240 heads, 63 sectors/track, 3876 cylinders 410240 heads, 63 sectors/track, 3876 cylinders
411Units = cylinders of 15120 * 512 = 7741440 bytes 411Units = cylinders of 15120 * 512 = 7741440 bytes
412 412
413Device Boot Start End Blocks Id System 413Device Boot Start End Blocks Id System
414/dev/hda1 * 1 14 105808+ 83 Linux 414/dev/sda1 * 1 14 105808+ 83 Linux
415/dev/hda2 15 81 506520 82 Linux swap 415/dev/sda2 15 81 506520 82 Linux swap
416</pre> 416</pre>
417 417
418</body> 418</body>
419</subsection> 419</subsection>
420<subsection> 420<subsection>
422<body> 422<body>
423 423
424<p> 424<p>
425Finally, let's create the root partition. To do this, type <c>n</c> to create a 425Finally, let's create the root partition. To do this, type <c>n</c> to create a
426new partition, then <c>p</c> to tell fdisk that you want a primary partition. 426new partition, then <c>p</c> to tell fdisk that you want a primary partition.
427Then type <c>3</c> to create the third primary partition, <path>/dev/hda3</path> 427Then type <c>3</c> to create the third primary partition, <path>/dev/sda3</path>
428in our case. When prompted for the first cylinder, hit enter. When prompted for 428in our case. When prompted for the first cylinder, hit enter. When prompted for
429the last cylinder, hit enter to create a partition that takes up the rest of the 429the last cylinder, hit enter to create a partition that takes up the rest of the
430remaining space on your disk. After completing these steps, typing <c>p</c> 430remaining space on your disk. After completing these steps, typing <c>p</c>
431should display a partition table that looks similar to this: 431should display a partition table that looks similar to this:
432</p> 432</p>
433 433
434<pre caption="Partition listing after creating the root partition"> 434<pre caption="Partition listing after creating the root partition">
435Command (m for help): <i>p</i> 435Command (m for help): <i>p</i>
436 436
437Disk /dev/hda: 30.0 GB, 30005821440 bytes 437Disk /dev/sda: 30.0 GB, 30005821440 bytes
438240 heads, 63 sectors/track, 3876 cylinders 438240 heads, 63 sectors/track, 3876 cylinders
439Units = cylinders of 15120 * 512 = 7741440 bytes 439Units = cylinders of 15120 * 512 = 7741440 bytes
440 440
441Device Boot Start End Blocks Id System 441Device Boot Start End Blocks Id System
442/dev/hda1 * 1 14 105808+ 83 Linux 442/dev/sda1 * 1 14 105808+ 83 Linux
443/dev/hda2 15 81 506520 82 Linux swap 443/dev/sda2 15 81 506520 82 Linux swap
444/dev/hda3 82 3876 28690200 83 Linux 444/dev/sda3 82 3876 28690200 83 Linux
445</pre> 445</pre>
446 446
447</body> 447</body>
448</subsection> 448</subsection>
449<subsection> 449<subsection>
522 <ti><c>mkfs.jfs</c></ti> 522 <ti><c>mkfs.jfs</c></ti>
523</tr> 523</tr>
524</table> 524</table>
525 525
526<p> 526<p>
527For instance, to have the boot partition (<path>/dev/hda1</path> in our 527For instance, to have the boot partition (<path>/dev/sda1</path> in our
528example) in ext2 and the root partition (<path>/dev/hda3</path> in our example) 528example) in ext2 and the root partition (<path>/dev/sda3</path> in our example)
529in ext3 (as in our example), you would use: 529in ext3 (as in our example), you would use:
530</p> 530</p>
531 531
532<pre caption="Applying a filesystem on a partition"> 532<pre caption="Applying a filesystem on a partition">
533# <i>mke2fs /dev/hda1</i> 533# <i>mke2fs /dev/sda1</i>
534# <i>mke2fs -j /dev/hda3</i> 534# <i>mke2fs -j /dev/sda3</i>
535</pre> 535</pre>
536 536
537<p> 537<p>
538Now create the filesystems on your newly created partitions (or logical 538Now create the filesystems on your newly created partitions (or logical
539volumes). 539volumes).
548<p> 548<p>
549<c>mkswap</c> is the command that is used to initialize swap partitions: 549<c>mkswap</c> is the command that is used to initialize swap partitions:
550</p> 550</p>
551 551
552<pre caption="Creating a Swap signature"> 552<pre caption="Creating a Swap signature">
553# <i>mkswap /dev/hda2</i> 553# <i>mkswap /dev/sda2</i>
554</pre> 554</pre>
555 555
556<p> 556<p>
557To activate the swap partition, use <c>swapon</c>: 557To activate the swap partition, use <c>swapon</c>:
558</p> 558</p>
559 559
560<pre caption="Activating the swap partition"> 560<pre caption="Activating the swap partition">
561# <i>swapon /dev/hda2</i> 561# <i>swapon /dev/sda2</i>
562</pre> 562</pre>
563 563
564<p> 564<p>
565Create and activate the swap with the commands mentioned above. 565Create and activate the swap with the commands mentioned above.
566</p> 566</p>
578create the necessary mount directories for every partition you created. As an 578create the necessary mount directories for every partition you created. As an
579example we mount the root and boot partition: 579example we mount the root and boot partition:
580</p> 580</p>
581 581
582<pre caption="Mounting partitions"> 582<pre caption="Mounting partitions">
583# <i>mount /dev/hda3 /mnt/gentoo</i> 583# <i>mount /dev/sda3 /mnt/gentoo</i>
584# <i>mkdir /mnt/gentoo/boot</i> 584# <i>mkdir /mnt/gentoo/boot</i>
585# <i>mount /dev/hda1 /mnt/gentoo/boot</i> 585# <i>mount /dev/sda1 /mnt/gentoo/boot</i>
586</pre> 586</pre>
587 587
588<note> 588<note>
589If you want your <path>/tmp</path> to reside on a separate partition, be sure to 589If you want your <path>/tmp</path> to reside on a separate partition, be sure to
590change its permissions after mounting: <c>chmod 1777 /mnt/gentoo/tmp</c>. This 590change its permissions after mounting: <c>chmod 1777 /mnt/gentoo/tmp</c>. This

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11

  ViewVC Help
Powered by ViewVC 1.1.20