| 1 |
<?xml version='1.0' encoding='UTF-8'?> |
| 2 |
<!DOCTYPE sections SYSTEM "/dtd/book.dtd"> |
| 3 |
|
| 4 |
<!-- The content of this document is licensed under the CC-BY-SA license --> |
| 5 |
<!-- See http://creativecommons.org/licenses/by-sa/1.0 --> |
| 6 |
|
| 7 |
<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-install-alpha-disk.xml,v 1.13 2004/12/31 02:42:21 vapier Exp $ --> |
| 8 |
|
| 9 |
<sections> |
| 10 |
|
| 11 |
<version>1.10</version> |
| 12 |
<date>2004-12-30</date> |
| 13 |
|
| 14 |
<section> |
| 15 |
<title>Introduction to Block Devices</title> |
| 16 |
<subsection> |
| 17 |
<title>Block Devices</title> |
| 18 |
<body> |
| 19 |
|
| 20 |
<p> |
| 21 |
We'll take a good look at disk-oriented aspects of Gentoo Linux |
| 22 |
and Linux in general, including Linux filesystems, partitions and block devices. |
| 23 |
Then, once you're familiar with the ins and outs of disks and filesystems, |
| 24 |
you'll be guided through the process of setting up partitions and filesystems |
| 25 |
for your Gentoo Linux installation. |
| 26 |
</p> |
| 27 |
|
| 28 |
<p> |
| 29 |
To begin, we'll introduce <e>block devices</e>. The most famous block device is |
| 30 |
probably the one that represents the first SCSI HD in a Linux system, namely |
| 31 |
<path>/dev/sda</path>. |
| 32 |
</p> |
| 33 |
|
| 34 |
<p> |
| 35 |
The block devices above represent an abstract interface to the disk. User |
| 36 |
programs can use these block devices to interact with your disk without worrying |
| 37 |
about whether your drives are IDE, SCSI or something else. The program can |
| 38 |
simply address the storage on the disk as a bunch of contiguous, |
| 39 |
randomly-accessible 512-byte blocks. |
| 40 |
</p> |
| 41 |
|
| 42 |
</body> |
| 43 |
</subsection> |
| 44 |
<subsection> |
| 45 |
<title>Slices</title> |
| 46 |
<body> |
| 47 |
|
| 48 |
<p> |
| 49 |
Although it is theoretically possible to use a full disk to house your Linux |
| 50 |
system, this is almost never done in practice. Instead, full disk block devices |
| 51 |
are split up in smaller, more manageable block devices. On Alpha systems, |
| 52 |
these are called <e>slices</e>. |
| 53 |
</p> |
| 54 |
|
| 55 |
</body> |
| 56 |
</subsection> |
| 57 |
</section> |
| 58 |
<section> |
| 59 |
<title>Designing a Partitioning Scheme</title> |
| 60 |
<subsection> |
| 61 |
<title>Default Partitioning Scheme</title> |
| 62 |
<body> |
| 63 |
|
| 64 |
<p> |
| 65 |
As an example we use the following slice layout: |
| 66 |
</p> |
| 67 |
|
| 68 |
<table> |
| 69 |
<tr> |
| 70 |
<th>Slice</th> |
| 71 |
<th>Description</th> |
| 72 |
</tr> |
| 73 |
<tr> |
| 74 |
<ti><path>/dev/sda1</path></ti> |
| 75 |
<ti>Swap slice</ti> |
| 76 |
</tr> |
| 77 |
<tr> |
| 78 |
<ti><path>/dev/sda2</path></ti> |
| 79 |
<ti>Root slice</ti> |
| 80 |
</tr> |
| 81 |
<tr> |
| 82 |
<ti><path>/dev/sda3</path></ti> |
| 83 |
<ti>Full disk (required)</ti> |
| 84 |
</tr> |
| 85 |
</table> |
| 86 |
|
| 87 |
|
| 88 |
<p> |
| 89 |
If you are interested in knowing how big a partition should be, or even how |
| 90 |
many partitions (or volumes) you need, read on. Otherwise continue now with |
| 91 |
<uri link="#fdisk">Using fdisk to Partition your Disk</uri>. |
| 92 |
</p> |
| 93 |
|
| 94 |
</body> |
| 95 |
</subsection> |
| 96 |
<subsection> |
| 97 |
<title>How Many and How Big?</title> |
| 98 |
<body> |
| 99 |
|
| 100 |
<p> |
| 101 |
The number of partitions is highly dependent on your environment. For instance, |
| 102 |
if you have lots of users, you will most likely want to have your |
| 103 |
<path>/home</path> separate as it increases security and makes backups easier. |
| 104 |
If you are installing Gentoo to perform as a mailserver, your |
| 105 |
<path>/var</path> should be separate as all mails are stored inside |
| 106 |
<path>/var</path>. A good choice of filesystem will then maximise your |
| 107 |
performance. Gameservers will have a separate <path>/opt</path> as most gaming |
| 108 |
servers are installed there. The reason is similar for <path>/home</path>: |
| 109 |
security and backups. |
| 110 |
</p> |
| 111 |
|
| 112 |
<p> |
| 113 |
As you can see, it very much depends on what you want to achieve. Separate |
| 114 |
partitions or volumes have the following advantages: |
| 115 |
</p> |
| 116 |
|
| 117 |
<ul> |
| 118 |
<li> |
| 119 |
You can choose the best performing filesystem for each partition or volume |
| 120 |
</li> |
| 121 |
<li> |
| 122 |
Your entire system cannot run out of free space if one defunct tool is |
| 123 |
continuously writing files to a partition or volume |
| 124 |
</li> |
| 125 |
<li> |
| 126 |
If necessary, file system checks are reduced in time, as multiple checks can |
| 127 |
be done in parallel (although this advantage is more with multiple disks than |
| 128 |
it is with multiple partitions) |
| 129 |
</li> |
| 130 |
<li> |
| 131 |
Security can be enhanced by mounting some partitions or volumes read-only, |
| 132 |
nosuid (setuid bits are ignored), noexec (executable bits are ignored) etc. |
| 133 |
</li> |
| 134 |
</ul> |
| 135 |
|
| 136 |
<p> |
| 137 |
However, multiple partitions have one big disadvantage: if not configured |
| 138 |
properly, you might result in having a system with lots |
| 139 |
of free space on one partition and none on another. |
| 140 |
</p> |
| 141 |
|
| 142 |
</body> |
| 143 |
</subsection> |
| 144 |
</section> |
| 145 |
<section id="fdisk"> |
| 146 |
<title>Using fdisk to Partition your Disk (SRM only)</title> |
| 147 |
<subsection> |
| 148 |
<body> |
| 149 |
|
| 150 |
<p> |
| 151 |
The following parts explain how to create the example slice layout described |
| 152 |
previously, namely: |
| 153 |
</p> |
| 154 |
|
| 155 |
<table> |
| 156 |
<tr> |
| 157 |
<th>Slice</th> |
| 158 |
<th>Description</th> |
| 159 |
</tr> |
| 160 |
<tr> |
| 161 |
<ti><path>/dev/sda1</path></ti> |
| 162 |
<ti>Swap slice</ti> |
| 163 |
</tr> |
| 164 |
<tr> |
| 165 |
<ti><path>/dev/sda2</path></ti> |
| 166 |
<ti>Root slice</ti> |
| 167 |
</tr> |
| 168 |
<tr> |
| 169 |
<ti><path>/dev/sda3</path></ti> |
| 170 |
<ti>Full disk (required)</ti> |
| 171 |
</tr> |
| 172 |
</table> |
| 173 |
|
| 174 |
<p> |
| 175 |
Change your slice layout according to your own preference. |
| 176 |
</p> |
| 177 |
|
| 178 |
|
| 179 |
</body> |
| 180 |
</subsection> |
| 181 |
<subsection> |
| 182 |
<title>Identifying Available Disks</title> |
| 183 |
<body> |
| 184 |
|
| 185 |
<p> |
| 186 |
To figure out what disks you have running, use the following commands: |
| 187 |
</p> |
| 188 |
|
| 189 |
<pre caption="Identifying available disks"> |
| 190 |
# <i>dmesg | grep 'drive$'</i> <comment>(For IDE disks)</comment> |
| 191 |
# <i>dmesg | grep 'scsi'</i> <comment>(For SCSI disks)</comment> |
| 192 |
</pre> |
| 193 |
|
| 194 |
<p> |
| 195 |
From this output you should be able to see what disks were detected and their |
| 196 |
respective <path>/dev</path> entry. In the following parts we assume that the |
| 197 |
disk is a SCSI disk on <path>/dev/sda</path>. |
| 198 |
</p> |
| 199 |
|
| 200 |
<p> |
| 201 |
Now fire up <c>fdisk</c>: |
| 202 |
</p> |
| 203 |
|
| 204 |
<pre caption="Starting fdisk"> |
| 205 |
# <i>fdisk /dev/sda</i> |
| 206 |
</pre> |
| 207 |
|
| 208 |
</body> |
| 209 |
</subsection> |
| 210 |
<subsection> |
| 211 |
<title>Deleting All Slices</title> |
| 212 |
<body> |
| 213 |
|
| 214 |
<p> |
| 215 |
If your hard drive is completely blank, then you'll have to first create |
| 216 |
a BSD disklabel. |
| 217 |
</p> |
| 218 |
|
| 219 |
<pre caption="Creating a BSD disklabel"> |
| 220 |
Command (m for help): <i>b</i> |
| 221 |
/dev/sda contains no disklabel. |
| 222 |
Do you want to create a disklabel? (y/n) <i>y</i> |
| 223 |
<comment>A bunch of drive-specific info will show here</comment> |
| 224 |
3 partitions: |
| 225 |
# start end size fstype [fsize bsize cpg] |
| 226 |
c: 1 5290* 5289* unused 0 0 |
| 227 |
</pre> |
| 228 |
|
| 229 |
<p> |
| 230 |
We start with deleting all slices <e>except</e> the 'c'-slice (a requirement |
| 231 |
for using BSD disklabels). The following shows how to delete a slice (in |
| 232 |
the example we use 'a'). Repeat the process to delete all other slices |
| 233 |
(again, except the 'c'-slice). |
| 234 |
</p> |
| 235 |
|
| 236 |
<p> |
| 237 |
Use <c>p</c> to view all existing slices. <c>d</c> is used to delete a slice. |
| 238 |
</p> |
| 239 |
|
| 240 |
<pre caption="Deleting a slice"> |
| 241 |
BSD disklabel command (m for help): <i>p</i> |
| 242 |
|
| 243 |
8 partitions: |
| 244 |
# start end size fstype [fsize bsize cpg] |
| 245 |
a: 1 235* 234* 4.2BSD 1024 8192 16 |
| 246 |
b: 235* 469* 234* swap |
| 247 |
c: 1 5290* 5289* unused 0 0 |
| 248 |
d: 469* 2076* 1607* unused 0 0 |
| 249 |
e: 2076* 3683* 1607* unused 0 0 |
| 250 |
f: 3683* 5290* 1607* unused 0 0 |
| 251 |
g: 469* 1749* 1280 4.2BSD 1024 8192 16 |
| 252 |
h: 1749* 5290* 3541* unused 0 0 |
| 253 |
|
| 254 |
BSD disklabel command (m for help): <i>d</i> |
| 255 |
Partition (a-h): <i>a</i> |
| 256 |
</pre> |
| 257 |
|
| 258 |
<p> |
| 259 |
After repeating this process for all slices, a listing should show you something |
| 260 |
similar to this: |
| 261 |
</p> |
| 262 |
|
| 263 |
<pre caption="Viewing an empty scheme"> |
| 264 |
BSD disklabel command (m for help): <i>p</i> |
| 265 |
|
| 266 |
3 partitions: |
| 267 |
# start end size fstype [fsize bsize cpg] |
| 268 |
c: 1 5290* 5289* unused 0 0 |
| 269 |
</pre> |
| 270 |
|
| 271 |
</body> |
| 272 |
</subsection> |
| 273 |
<subsection> |
| 274 |
<title>Creating the Swap Slice</title> |
| 275 |
<body> |
| 276 |
|
| 277 |
<p> |
| 278 |
On Alpha based systems you don't need a separate boot partition. However, the |
| 279 |
first cylinder cannot be used as the <c>aboot</c> image will be placed there. |
| 280 |
</p> |
| 281 |
|
| 282 |
<p> |
| 283 |
We will create a swap slice starting at the third cylinder, with a total |
| 284 |
size of 1 Gbyte. Use <c>n</c> to create a new slice. After creating the slice, |
| 285 |
we will change its type to <c>1</c> (one), meaning <e>swap</e>. |
| 286 |
</p> |
| 287 |
|
| 288 |
<pre caption="Creating the swap slice"> |
| 289 |
BSD disklabel command (m for help): <i>n</i> |
| 290 |
Partition (a-p): <i>a</i> |
| 291 |
First cylinder (1-5290, default 1): <i>3</i> |
| 292 |
Last cylinder or +size or +sizeM or +sizeK (3-5290, default 5290): <i>+1024M</i> |
| 293 |
|
| 294 |
BSD disklabel command (m for help): <i>t</i> |
| 295 |
Partition (a-c): <i>a</i> |
| 296 |
Hex code (type L to list codes): <i>1</i> |
| 297 |
</pre> |
| 298 |
|
| 299 |
<p> |
| 300 |
After these steps you should see a layout similar to the following: |
| 301 |
</p> |
| 302 |
|
| 303 |
<pre caption="Slice layout after creating the swap slice"> |
| 304 |
BSD disklabel command (m for help): <i>p</i> |
| 305 |
|
| 306 |
3 partitions: |
| 307 |
# start end size fstype [fsize bsize cpg] |
| 308 |
a: 3 1003 1001 swap |
| 309 |
c: 1 5290* 5289* unused 0 0 |
| 310 |
</pre> |
| 311 |
|
| 312 |
</body> |
| 313 |
</subsection> |
| 314 |
<subsection> |
| 315 |
<title>Create the Root Slice</title> |
| 316 |
<body> |
| 317 |
|
| 318 |
<p> |
| 319 |
We will now create the root slice, starting from the first cylinder <e>after</e> |
| 320 |
the swap slice. Use the <c>p</c> command to view where the swap slice ends. In |
| 321 |
our example, this is at 1003, making the root partition start at 1004. |
| 322 |
</p> |
| 323 |
|
| 324 |
<p> |
| 325 |
Another problem is that there is currently a bug in <c>fdisk</c> making it think |
| 326 |
the number of available cylinders is one above the real number of cylinders. In |
| 327 |
other words, when you are asked for the last cylinder, decrease the cylinder |
| 328 |
number (in this example: 5290) with one. |
| 329 |
</p> |
| 330 |
|
| 331 |
<p> |
| 332 |
When the partition is created, we change the type to <c>8</c>, for <e>ext2</e>. |
| 333 |
</p> |
| 334 |
|
| 335 |
<pre caption="Creating the root slice"> |
| 336 |
D disklabel command (m for help): <i>n</i> |
| 337 |
Partition (a-p): <i>b</i> |
| 338 |
First cylinder (1-5290, default 1): <i>1004</i> |
| 339 |
Last cylinder or +size or +sizeM or +sizeK (1004-5290, default 5290): <i>5289</i> |
| 340 |
|
| 341 |
BSD disklabel command (m for help): <i>t</i> |
| 342 |
Partition (a-c): <i>b</i> |
| 343 |
Hex code (type L to list codes): <i>8</i> |
| 344 |
</pre> |
| 345 |
|
| 346 |
<p> |
| 347 |
Your slice layout should now be similar to this: |
| 348 |
</p> |
| 349 |
|
| 350 |
<pre caption="Viewing the slice layout"> |
| 351 |
BSD disklabel command (m for help): <i>p</i> |
| 352 |
|
| 353 |
3 partitions: |
| 354 |
# start end size fstype [fsize bsize cpg] |
| 355 |
a: 3 1003 1001 swap |
| 356 |
b: 1004 5289 4286 ext2 |
| 357 |
c: 1 5290* 5289* unused 0 0 |
| 358 |
</pre> |
| 359 |
|
| 360 |
</body> |
| 361 |
</subsection> |
| 362 |
<subsection> |
| 363 |
<title>Save the Slice Layout and Exit</title> |
| 364 |
<body> |
| 365 |
|
| 366 |
<p> |
| 367 |
Save <c>fdisk</c> by typing <c>w</c>. This will also save your slice layout. |
| 368 |
</p> |
| 369 |
|
| 370 |
<pre caption="Save and exit fdisk"> |
| 371 |
Command (m for help): <i>w</i> |
| 372 |
</pre> |
| 373 |
|
| 374 |
<p> |
| 375 |
Now that your slices are created, you can now continue with <uri |
| 376 |
link="#filesystems">Creating Filesystems</uri>. |
| 377 |
</p> |
| 378 |
|
| 379 |
</body> |
| 380 |
</subsection> |
| 381 |
</section> |
| 382 |
<section id="fdisk"> |
| 383 |
<title>Using fdisk to Partition your Disk (ARC/AlphaBIOS only)</title> |
| 384 |
<subsection> |
| 385 |
<body> |
| 386 |
|
| 387 |
<p> |
| 388 |
The following parts explain how to partition the disk with a layout |
| 389 |
similar to the one described previously, namely: |
| 390 |
</p> |
| 391 |
|
| 392 |
<table> |
| 393 |
<tr> |
| 394 |
<th>Partition</th> |
| 395 |
<th>Description</th> |
| 396 |
</tr> |
| 397 |
<tr> |
| 398 |
<ti><path>/dev/sda1</path></ti> |
| 399 |
<ti>Boot partition</ti> |
| 400 |
</tr> |
| 401 |
<tr> |
| 402 |
<ti><path>/dev/sda2</path></ti> |
| 403 |
<ti>Swap partition</ti> |
| 404 |
</tr> |
| 405 |
<tr> |
| 406 |
<ti><path>/dev/sda3</path></ti> |
| 407 |
<ti>Root partition</ti> |
| 408 |
</tr> |
| 409 |
</table> |
| 410 |
|
| 411 |
<p> |
| 412 |
Change your partition layout according to your own preference. |
| 413 |
</p> |
| 414 |
|
| 415 |
</body> |
| 416 |
</subsection> |
| 417 |
<subsection> |
| 418 |
<title>Identifying Available Disks</title> |
| 419 |
<body> |
| 420 |
|
| 421 |
<p> |
| 422 |
To figure out what disks you have running, use the following commands: |
| 423 |
</p> |
| 424 |
|
| 425 |
<pre caption="Identifying available disks"> |
| 426 |
# <i>dmesg | grep 'drive$'</i> <comment>(For IDE disks)</comment> |
| 427 |
# <i>dmesg | grep 'scsi'</i> <comment>(For SCSI disks)</comment> |
| 428 |
</pre> |
| 429 |
|
| 430 |
<p> |
| 431 |
From this output you should be able to see what disks were detected and their |
| 432 |
respective <path>/dev</path> entry. In the following parts we assume that the |
| 433 |
disk is a SCSI disk on <path>/dev/sda</path>. |
| 434 |
</p> |
| 435 |
|
| 436 |
<p> |
| 437 |
Now fire up <c>fdisk</c>: |
| 438 |
</p> |
| 439 |
|
| 440 |
<pre caption="Starting fdisk"> |
| 441 |
# <i>fdisk /dev/sda</i> |
| 442 |
</pre> |
| 443 |
|
| 444 |
</body> |
| 445 |
</subsection> |
| 446 |
<subsection> |
| 447 |
<title>Deleting All Partitions</title> |
| 448 |
<body> |
| 449 |
|
| 450 |
<p> |
| 451 |
If your hard drive is completely blank, then you'll have to first create |
| 452 |
a DOS disklabel. |
| 453 |
</p> |
| 454 |
|
| 455 |
<pre caption="Creating a DOS disklabel"> |
| 456 |
Command (m for help): <i>o</i> |
| 457 |
Building a new DOS disklabel. |
| 458 |
</pre> |
| 459 |
|
| 460 |
<p> |
| 461 |
We start with deleting all partitions. The following shows how to delete |
| 462 |
a partition (in the example we use '1'). Repeat the process to delete all |
| 463 |
other partitions. |
| 464 |
</p> |
| 465 |
|
| 466 |
<p> |
| 467 |
Use <c>p</c> to view all existing partitions. <c>d</c> is used to delete a |
| 468 |
partition. |
| 469 |
</p> |
| 470 |
|
| 471 |
<pre caption="Deleting a partition"> |
| 472 |
command (m for help): <i>p</i> |
| 473 |
|
| 474 |
Disk /dev/sda: 9150 MB, 9150996480 bytes |
| 475 |
64 heads, 32 sectors/track, 8727 cylinders |
| 476 |
Units = cylinders of 2048 * 512 = 1048576 bytes |
| 477 |
|
| 478 |
Device Boot Start End Blocks Id System |
| 479 |
/dev/sda1 1 478 489456 83 Linux |
| 480 |
/dev/sda2 479 8727 8446976 5 Extended |
| 481 |
/dev/sda5 479 1433 977904 83 Linux Swap |
| 482 |
/dev/sda6 1434 8727 7469040 83 Linux |
| 483 |
|
| 484 |
command (m for help): <i>d</i> |
| 485 |
Partition number (1-6): <i>1</i> |
| 486 |
</pre> |
| 487 |
|
| 488 |
|
| 489 |
</body> |
| 490 |
</subsection> |
| 491 |
<subsection> |
| 492 |
<title>Creating the Boot Partition</title> |
| 493 |
<body> |
| 494 |
|
| 495 |
<p> |
| 496 |
On Alpha systems which use MILO to boot, we have to create a small vfat |
| 497 |
boot partition. |
| 498 |
</p> |
| 499 |
|
| 500 |
<pre caption="Creating the boot partition"> |
| 501 |
Command (m for help): <i>n</i> |
| 502 |
Command action |
| 503 |
e extended |
| 504 |
p primary partition (1-4) |
| 505 |
<i>p</i> |
| 506 |
Partition number (1-4): <i>1</i> |
| 507 |
First cylinder (1-8727, default 1): <i>1</i> |
| 508 |
Last cylinder or +size or +sizeM or +sizeK (1-8727, default 8727): <i>+16M</i> |
| 509 |
|
| 510 |
Command (m for help): <i>t</i> |
| 511 |
Selected partition 1 |
| 512 |
Hex code (type L to list codes): <i>6</i> |
| 513 |
Changed system type of partition 1 to 6 (FAT16) |
| 514 |
</pre> |
| 515 |
|
| 516 |
</body> |
| 517 |
</subsection> |
| 518 |
<subsection> |
| 519 |
<title>Creating the Swap Partition</title> |
| 520 |
<body> |
| 521 |
|
| 522 |
<p> |
| 523 |
We will create a swap partition starting at the third cylinder, with a total |
| 524 |
size of 1 Gbyte. Use <c>n</c> to create a new partition. |
| 525 |
</p> |
| 526 |
|
| 527 |
<pre caption="Creating the swap partition"> |
| 528 |
Command (m for help): <i>n</i> |
| 529 |
Command action |
| 530 |
e extended |
| 531 |
p primary partition (1-4) |
| 532 |
<i>p</i> |
| 533 |
Partition number (1-4): <i>2</i> |
| 534 |
First cylinder (17-8727, default 17): <i>17</i> |
| 535 |
Last cylinder or +size or +sizeM or +sizeK (17-8727, default 8727): <i>+1000M</i> |
| 536 |
|
| 537 |
Command (m for help): <i>t</i> |
| 538 |
Partition number (1-4): <i>1</i> |
| 539 |
Hex code (type L to list codes): <i>82</i> |
| 540 |
Changed system type of partition 2 to 82 (Linux swap) |
| 541 |
</pre> |
| 542 |
|
| 543 |
<p> |
| 544 |
After these steps you should see a layout similar to the following: |
| 545 |
</p> |
| 546 |
|
| 547 |
<pre caption="Partition listing after creating a swap partition"> |
| 548 |
Command (m for help): <i>p</i> |
| 549 |
|
| 550 |
Disk /dev/sda: 9150 MB, 9150996480 bytes |
| 551 |
64 heads, 32 sectors/track, 8727 cylinders |
| 552 |
Units = cylinders of 2048 * 512 = 1048576 bytes |
| 553 |
|
| 554 |
Device Boot Start End Blocks Id System |
| 555 |
/dev/sda1 1 16 16368 6 FAT16 |
| 556 |
/dev/sda2 17 971 977920 82 Linux swap |
| 557 |
</pre> |
| 558 |
|
| 559 |
</body> |
| 560 |
</subsection> |
| 561 |
<subsection> |
| 562 |
<title>Creating the Root Partition</title> |
| 563 |
<body> |
| 564 |
|
| 565 |
<p> |
| 566 |
We will now create the root partition. Again, just use the <c>n</c> command. |
| 567 |
</p> |
| 568 |
|
| 569 |
<pre caption="Creating the root partition"> |
| 570 |
Command (m for help): <i>n</i> |
| 571 |
Command action |
| 572 |
e extended |
| 573 |
p primary partition (1-4) |
| 574 |
<i>p</i> |
| 575 |
Partition number (1-4): <i>3</i> |
| 576 |
First cylinder (972-8727, default 972): <i>972</i> |
| 577 |
Last cylinder or +size or +sizeM or +sizeK (972-8727, default 8727): <i>8727</i> |
| 578 |
</pre> |
| 579 |
|
| 580 |
<p> |
| 581 |
After these steps you should see a layout similar to the following: |
| 582 |
</p> |
| 583 |
|
| 584 |
<pre caption="Partition listing after creating the root partition"> |
| 585 |
Command (m for help): <i>p</i> |
| 586 |
|
| 587 |
Disk /dev/sda: 9150 MB, 9150996480 bytes |
| 588 |
64 heads, 32 sectors/track, 8727 cylinders |
| 589 |
Units = cylinders of 2048 * 512 = 1048576 bytes |
| 590 |
|
| 591 |
Device Boot Start End Blocks Id System |
| 592 |
/dev/sda1 1 16 16368 6 FAT16 |
| 593 |
/dev/sda2 17 971 977920 82 Linux swap |
| 594 |
/dev/sda3 972 8727 7942144 83 Linux |
| 595 |
</pre> |
| 596 |
|
| 597 |
</body> |
| 598 |
</subsection> |
| 599 |
<subsection> |
| 600 |
<title>Save the Partition Layout and Exit</title> |
| 601 |
<body> |
| 602 |
|
| 603 |
<p> |
| 604 |
Save <c>fdisk</c> by typing <c>w</c>. This will also save your partition layout. |
| 605 |
</p> |
| 606 |
|
| 607 |
<pre caption="Save and exit fdisk"> |
| 608 |
Command (m for help): <i>w</i> |
| 609 |
</pre> |
| 610 |
|
| 611 |
<p> |
| 612 |
Now that your partitions are created, you can now continue with <uri |
| 613 |
link="#filesystems">Creating Filesystems</uri>. |
| 614 |
</p> |
| 615 |
|
| 616 |
</body> |
| 617 |
</subsection> |
| 618 |
</section> |
| 619 |
<section id="filesystems"> |
| 620 |
<title>Creating Filesystems</title> |
| 621 |
<subsection> |
| 622 |
<title>Introduction</title> |
| 623 |
<body> |
| 624 |
|
| 625 |
<p> |
| 626 |
Now that your partitions are created, it is time to place a filesystem on them. |
| 627 |
If you don't care about what filesystem to choose and are happy with what we use |
| 628 |
as default in this handbook, continue with <uri |
| 629 |
link="#filesystems-apply">Applying a Filesystem to a Partition</uri>. |
| 630 |
Otherwise read on to learn about the available filesystems... |
| 631 |
</p> |
| 632 |
|
| 633 |
</body> |
| 634 |
</subsection> |
| 635 |
<subsection> |
| 636 |
<title>Filesystems?</title> |
| 637 |
<body> |
| 638 |
|
| 639 |
<p> |
| 640 |
Several filesystems are available. Most of them are found stable on the |
| 641 |
Alpha architecture. |
| 642 |
</p> |
| 643 |
|
| 644 |
<p> |
| 645 |
<b>ext2</b> is the tried and true Linux filesystem but doesn't have metadata |
| 646 |
journaling, which means that routine ext2 filesystem checks at startup time can |
| 647 |
be quite time-consuming. There is now quite a selection of newer-generation |
| 648 |
journaled filesystems that can be checked for consistency very quickly and are |
| 649 |
thus generally preferred over their non-journaled counterparts. Journaled |
| 650 |
filesystems prevent long delays when you boot your system and your filesystem |
| 651 |
happens to be in an inconsistent state. |
| 652 |
</p> |
| 653 |
|
| 654 |
<p> |
| 655 |
<b>ext3</b> is the journaled version of the ext2 filesystem, providing metadata |
| 656 |
journaling for fast recovery in addition to other enhanced journaling modes like |
| 657 |
full data and ordered data journaling. ext3 is a very good and reliable |
| 658 |
filesystem. It has an additional hashed b-tree indexing option that enables |
| 659 |
high performance in almost all situations. In short, ext3 is an excellent |
| 660 |
filesystem. |
| 661 |
</p> |
| 662 |
|
| 663 |
<p> |
| 664 |
<b>ReiserFS</b> is a B*-tree based filesystem that has very good overall |
| 665 |
performance and greatly outperforms both ext2 and ext3 when dealing with small |
| 666 |
files (files less than 4k), often by a factor of 10x-15x. ReiserFS also scales |
| 667 |
extremely well and has metadata journaling. As of kernel 2.4.18+, ReiserFS is |
| 668 |
solid and usable as both general-purpose filesystem and for extreme cases such |
| 669 |
as the creation of large filesystems, the use of many small files, very large |
| 670 |
files and directories containing tens of thousands of files. |
| 671 |
</p> |
| 672 |
|
| 673 |
<p> |
| 674 |
<b>XFS</b> is a filesystem with metadata journaling which comes with a robust |
| 675 |
feature-set and is optimized for scalability. We only recommend using this |
| 676 |
filesystem on Linux systems with high-end SCSI and/or fibre channel storage and |
| 677 |
an uninterruptible power supply. Because XFS aggressively caches in-transit data |
| 678 |
in RAM, improperly designed programs (those that don't take proper precautions |
| 679 |
when writing files to disk and there are quite a few of them) can lose a good |
| 680 |
deal of data if the system goes down unexpectedly. |
| 681 |
</p> |
| 682 |
|
| 683 |
<p> |
| 684 |
<b>JFS</b> is IBM's high-performance journaling filesystem. It has recently |
| 685 |
become production-ready and there hasn't been a sufficient track record to |
| 686 |
comment positively nor negatively on its general stability at this point. |
| 687 |
</p> |
| 688 |
|
| 689 |
</body> |
| 690 |
</subsection> |
| 691 |
<subsection id="filesystems-apply"> |
| 692 |
<title>Applying a Filesystem to a Partition</title> |
| 693 |
<body> |
| 694 |
|
| 695 |
<p> |
| 696 |
To create a filesystem on a partition or volume, there are tools available for |
| 697 |
each possible filesystem: |
| 698 |
</p> |
| 699 |
|
| 700 |
<table> |
| 701 |
<tr> |
| 702 |
<th>Filesystem</th> |
| 703 |
<th>Creation Command</th> |
| 704 |
</tr> |
| 705 |
<tr> |
| 706 |
<ti>ext2</ti> |
| 707 |
<ti><c>mke2fs</c></ti> |
| 708 |
</tr> |
| 709 |
<tr> |
| 710 |
<ti>ext3</ti> |
| 711 |
<ti><c>mke2fs -j</c></ti> |
| 712 |
</tr> |
| 713 |
<tr> |
| 714 |
<ti>reiserfs</ti> |
| 715 |
<ti><c>mkreiserfs</c></ti> |
| 716 |
</tr> |
| 717 |
<tr> |
| 718 |
<ti>xfs</ti> |
| 719 |
<ti><c>mkfs.xfs</c></ti> |
| 720 |
</tr> |
| 721 |
<tr> |
| 722 |
<ti>jfs</ti> |
| 723 |
<ti><c>mkfs.jfs</c></ti> |
| 724 |
</tr> |
| 725 |
</table> |
| 726 |
|
| 727 |
<p> |
| 728 |
For instance, to have the root partition (<path>/dev/sda2</path> in our example) |
| 729 |
in ext3, you would use: |
| 730 |
</p> |
| 731 |
|
| 732 |
<pre caption="Applying a filesystem on a partition"> |
| 733 |
# <i>mke2fs -j /dev/sda2</i> |
| 734 |
</pre> |
| 735 |
|
| 736 |
<p> |
| 737 |
Now create the filesystems on your newly created partitions (or logical |
| 738 |
volumes). |
| 739 |
</p> |
| 740 |
|
| 741 |
</body> |
| 742 |
</subsection> |
| 743 |
<subsection> |
| 744 |
<title>Activating the Swap Partition</title> |
| 745 |
<body> |
| 746 |
|
| 747 |
<p> |
| 748 |
<c>mkswap</c> is the command that is used to initialize swap partitions: |
| 749 |
</p> |
| 750 |
|
| 751 |
<pre caption="Creating a Swap signature"> |
| 752 |
# <i>mkswap /dev/sda1</i> |
| 753 |
</pre> |
| 754 |
|
| 755 |
<p> |
| 756 |
To activate the swap partition, use <c>swapon</c>: |
| 757 |
</p> |
| 758 |
|
| 759 |
<pre caption="Activating the swap partition"> |
| 760 |
# <i>swapon /dev/sda1</i> |
| 761 |
</pre> |
| 762 |
|
| 763 |
<p> |
| 764 |
Create and activate the swap now. |
| 765 |
</p> |
| 766 |
|
| 767 |
</body> |
| 768 |
</subsection> |
| 769 |
</section> |
| 770 |
<section> |
| 771 |
<title>Mounting</title> |
| 772 |
<body> |
| 773 |
|
| 774 |
<p> |
| 775 |
Now that your partitions are initialized and are housing a filesystem, it is |
| 776 |
time to mount those partitions. Use the <c>mount</c> command. Don't forget to |
| 777 |
create the necessary mount directories for every partition you created. As an |
| 778 |
example we mount the root and boot partition: |
| 779 |
</p> |
| 780 |
|
| 781 |
<pre caption="Mounting partitions"> |
| 782 |
# <i>mount /dev/sda2 /mnt/gentoo</i> |
| 783 |
</pre> |
| 784 |
|
| 785 |
<note> |
| 786 |
If you want your <path>/tmp</path> to reside on a separate partition, be sure to |
| 787 |
change its permissions after mounting: <c>chmod 1777 /mnt/gentoo/tmp</c>. This |
| 788 |
also holds for <path>/var/tmp</path>. |
| 789 |
</note> |
| 790 |
|
| 791 |
<p> |
| 792 |
We will also have to mount the proc filesystem (a virtual interface with the |
| 793 |
kernel) on <path>/proc</path>. But first we will need to place our files on the partitions. |
| 794 |
</p> |
| 795 |
|
| 796 |
<p> |
| 797 |
Continue with <uri link="?part=1&chap=5">Installing the Gentoo |
| 798 |
Installation Files</uri>. |
| 799 |
</p> |
| 800 |
|
| 801 |
</body> |
| 802 |
</section> |
| 803 |
</sections> |