| 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-ppc64-disk.xml,v 1.6 2004/09/14 11:55:12 swift Exp $ --> |
| 8 |
|
| 9 |
<sections> |
| 10 |
<section> |
| 11 |
<title>Introduction to Block Devices</title> |
| 12 |
<subsection> |
| 13 |
<title>Block Devices</title> |
| 14 |
<body> |
| 15 |
|
| 16 |
<p> |
| 17 |
We'll take a good look at disk-oriented aspects of Gentoo Linux |
| 18 |
and Linux in general, including Linux filesystems, partitions and block devices. |
| 19 |
Then, once you're familiar with the ins and outs of disks and filesystems, |
| 20 |
you'll be guided through the process of setting up partitions and filesystems |
| 21 |
for your Gentoo Linux installation. |
| 22 |
</p> |
| 23 |
|
| 24 |
<p> |
| 25 |
To begin, we'll introduce <e>block devices</e>. The most famous block device is |
| 26 |
probably the one that represents the first IDE drive in a Linux system, namely |
| 27 |
<path>/dev/hda</path>. If your system uses SCSI drives, then your first hard |
| 28 |
drive would be <path>/dev/sda</path>. Serial ATA drives are also |
| 29 |
<path>/dev/sda</path> even if they are IDE drives. |
| 30 |
</p> |
| 31 |
|
| 32 |
<p> |
| 33 |
The block devices above represent an abstract interface to the disk. User |
| 34 |
programs can use these block devices to interact with your disk without worrying |
| 35 |
about whether your drives are IDE, SCSI or something else. The program can |
| 36 |
simply address the storage on the disk as a bunch of contiguous, |
| 37 |
randomly-accessible 512-byte blocks. |
| 38 |
</p> |
| 39 |
|
| 40 |
</body> |
| 41 |
</subsection> |
| 42 |
<subsection> |
| 43 |
<title>Partitions and Slices</title> |
| 44 |
<body> |
| 45 |
|
| 46 |
<p> |
| 47 |
Although it is theoretically possible to use a full disk to house your Linux |
| 48 |
system, this is almost never done in practice. Instead, full disk block devices |
| 49 |
are split up in smaller, more manageable block devices. On most systems, |
| 50 |
these are called <e>partitions</e>. Other architectures use a similar technique, |
| 51 |
called <e>slices</e>. |
| 52 |
</p> |
| 53 |
|
| 54 |
</body> |
| 55 |
</subsection> |
| 56 |
</section> |
| 57 |
<section> |
| 58 |
<title>Designing a Partitioning Scheme</title> |
| 59 |
<subsection> |
| 60 |
<title>Default Partitioning Scheme</title> |
| 61 |
<body> |
| 62 |
|
| 63 |
<p> |
| 64 |
If you are not interested in drawing up a partitioning scheme for your system, |
| 65 |
you can use the partitioning scheme we use throughout this book: |
| 66 |
</p> |
| 67 |
|
| 68 |
<table> |
| 69 |
<tr> |
| 70 |
<th>Partition</th> |
| 71 |
<th>Filesystem</th> |
| 72 |
<th>Size</th> |
| 73 |
<th>Description</th> |
| 74 |
</tr> |
| 75 |
<tr> |
| 76 |
<ti><path>/dev/sda1</path></ti> |
| 77 |
<ti>Partition map</ti> |
| 78 |
<ti>31.5k</ti> |
| 79 |
<ti>Partition map</ti> |
| 80 |
</tr> |
| 81 |
<tr> |
| 82 |
<ti><path>/dev/sda2</path></ti> |
| 83 |
<ti>(bootstrap)</ti> |
| 84 |
<ti>800k</ti> |
| 85 |
<ti>Apple_Bootstrap</ti> |
| 86 |
</tr> |
| 87 |
<tr> |
| 88 |
<ti><path>/dev/sda3</path></ti> |
| 89 |
<ti>(swap)</ti> |
| 90 |
<ti>512M</ti> |
| 91 |
<ti>Swap partition</ti> |
| 92 |
</tr> |
| 93 |
<tr> |
| 94 |
<ti><path>/dev/sda4</path></ti> |
| 95 |
<ti>ext3</ti> |
| 96 |
<ti>Rest of the disk</ti> |
| 97 |
<ti>Root partition</ti> |
| 98 |
</tr> |
| 99 |
</table> |
| 100 |
|
| 101 |
<note> |
| 102 |
There are some partitions named like this: <path>Apple_Driver43, |
| 103 |
Apple_Driver_ATA, Apple_FWDriver, Apple_Driver_IOKit, |
| 104 |
Apple_Patches</path>. If you are not planning to use MacOS 9 you can |
| 105 |
delete them, because MacOS X and Linux don't need them. |
| 106 |
You might have to use parted in order to delete them, as mac-fdisk can't delete them yet. |
| 107 |
</note> |
| 108 |
|
| 109 |
<p> |
| 110 |
If you are interested in knowing how big a partition should be, or even how |
| 111 |
many partitions you need, read on. Otherwise continue now with |
| 112 |
<uri link="#mac-fdisk">Apple G5: Using mac-fdisk to Partition your |
| 113 |
Disk</uri> or <uri link="#fdisk">IBM pSeries: using fdisk to Partition |
| 114 |
your Disk</uri> |
| 115 |
</p> |
| 116 |
|
| 117 |
</body> |
| 118 |
</subsection> |
| 119 |
<subsection> |
| 120 |
<title>How Many and How Big?</title> |
| 121 |
<body> |
| 122 |
|
| 123 |
<p> |
| 124 |
The number of partitions is highly dependent on your environment. For instance, |
| 125 |
if you have lots of users, you will most likely want to have your |
| 126 |
<path>/home</path> separate as it increases security and makes backups easier. |
| 127 |
If you are installing Gentoo to perform as a mailserver, your |
| 128 |
<path>/var</path> should be separate as all mails are stored inside |
| 129 |
<path>/var</path>. A good choice of filesystem will then maximise your |
| 130 |
performance. Gameservers will have a separate <path>/opt</path> as most gaming |
| 131 |
servers are installed there. The reason is similar for <path>/home</path>: |
| 132 |
security and backups. |
| 133 |
</p> |
| 134 |
|
| 135 |
<p> |
| 136 |
As you can see, it very much depends on what you want to achieve. Separate |
| 137 |
partitions or volumes have the following advantages: |
| 138 |
</p> |
| 139 |
|
| 140 |
<ul> |
| 141 |
<li> |
| 142 |
You can choose the best performing filesystem for each partition or volume |
| 143 |
</li> |
| 144 |
<li> |
| 145 |
Your entire system cannot run out of free space if one defunct tool is |
| 146 |
continuously writing files to a partition or volume |
| 147 |
</li> |
| 148 |
<li> |
| 149 |
If necessary, file system checks are reduced in time, as multiple checks can |
| 150 |
be done in parallel (although this advantage is more with multiple disks than |
| 151 |
it is with multiple partitions) |
| 152 |
</li> |
| 153 |
<li> |
| 154 |
Security can be enhanced by mounting some partitions or volumes read-only, |
| 155 |
nosuid (setuid bits are ignored), noexec (executable bits are ignored) etc. |
| 156 |
</li> |
| 157 |
</ul> |
| 158 |
|
| 159 |
<p> |
| 160 |
However, multiple partitions have one big disadvantage: if not configured |
| 161 |
properly, you might result in having a system with lots |
| 162 |
of free space on one partition and none on another. There is also a 15-partition |
| 163 |
limit for SCSI and SATA. |
| 164 |
</p> |
| 165 |
|
| 166 |
</body> |
| 167 |
</subsection> |
| 168 |
</section> |
| 169 |
<section id="mac-fdisk"> |
| 170 |
<title>Default: Using mac-fdisk (Apple G5) Partition your Disk</title> |
| 171 |
<body> |
| 172 |
|
| 173 |
<p> |
| 174 |
At this point, create your partitions using <c>mac-fdisk</c>: |
| 175 |
</p> |
| 176 |
|
| 177 |
<pre caption="Starting mac-fdisk"> |
| 178 |
# <i>mac-fdisk /dev/sda</i> |
| 179 |
</pre> |
| 180 |
|
| 181 |
<p> |
| 182 |
First delete the partitions you have cleared previously to make room for your |
| 183 |
Linux partitions. Use <c>d</c> in <c>mac-fdisk</c> to delete those partition(s). |
| 184 |
It will ask for the partition number to delete. |
| 185 |
</p> |
| 186 |
|
| 187 |
<p> |
| 188 |
Second, create an <e>Apple_Bootstrap</e> partition by using <c>b</c>. It will |
| 189 |
ask for what block you want to start. Enter the number of your first free |
| 190 |
partition, followed by a <c>p</c>. For instance this is <c>1p</c>. |
| 191 |
</p> |
| 192 |
|
| 193 |
<note> |
| 194 |
This partition is <e>not</e> a "boot" partition. It is not used by Linux at all; |
| 195 |
you don't have to place any filesystem on it and you should never mount it. PPC |
| 196 |
users don't need a an extra partition for <path>/boot</path>. |
| 197 |
</note> |
| 198 |
|
| 199 |
<p> |
| 200 |
Now create a swap partition by pressing <c>c</c>. Again <c>mac-fdisk</c> will |
| 201 |
ask for what block you want to start this partition from. As we used <c>1</c> |
| 202 |
before to create the Apple_Bootstrap partition, you now have to enter |
| 203 |
<c>2p</c>. When you're asked for the size, enter <c>512M</c> (or whatever size |
| 204 |
you want -- 512MB is recommended though). When asked for a name, enter <c>swap</c> |
| 205 |
(mandatory). |
| 206 |
</p> |
| 207 |
|
| 208 |
<p> |
| 209 |
To create the root partition, enter <c>c</c>, followed by <c>3p</c> to select |
| 210 |
from what block the root partition should start. When asked for the size, enter |
| 211 |
<c>3p</c> again. <c>mac-fdisk</c> will interpret this as "Use all available |
| 212 |
space". When asked for the name, enter <c>root</c> (mandatory). |
| 213 |
</p> |
| 214 |
|
| 215 |
<p> |
| 216 |
To finish up, write the partition to the disk using <c>w</c> and <c>q</c> to |
| 217 |
quit <c>mac-fdisk</c>. |
| 218 |
</p> |
| 219 |
|
| 220 |
<note> |
| 221 |
To make sure everything is ok, you should run mac-fdisk once more and check whether all the partitions are there. |
| 222 |
If you don't see any of the partitions you created, or the changes you made, you should reinitialize your partitions by pressing "i" in mac-fdisk. |
| 223 |
Note that this will recreate the partition map and thus remove all your partitions. |
| 224 |
</note> |
| 225 |
|
| 226 |
<p> |
| 227 |
Now that your partitions are created, you can now continue with <uri |
| 228 |
link="#filesystems">Creating Filesystems</uri>. |
| 229 |
</p> |
| 230 |
|
| 231 |
</body> |
| 232 |
</section> |
| 233 |
<section id="fdisk"> |
| 234 |
<title>IBM pSeries: using fdisk to Partition your Disk</title> |
| 235 |
<subsection> |
| 236 |
<body> |
| 237 |
|
| 238 |
<p> |
| 239 |
The following parts explain how to create the example partition layout |
| 240 |
described previously, namely: |
| 241 |
</p> |
| 242 |
|
| 243 |
<table> |
| 244 |
<tr> |
| 245 |
<th>Partition</th> |
| 246 |
<th>Description</th> |
| 247 |
</tr> |
| 248 |
<tr> |
| 249 |
<ti><path>/dev/sda1</path></ti> |
| 250 |
<ti>PPC PReP Boot partition</ti> |
| 251 |
</tr> |
| 252 |
<tr> |
| 253 |
<ti><path>/dev/sda2</path></ti> |
| 254 |
<ti>Swap partition</ti> |
| 255 |
</tr> |
| 256 |
<tr> |
| 257 |
<ti><path>/dev/sda3</path></ti> |
| 258 |
<ti>Root partition</ti> |
| 259 |
</tr> |
| 260 |
</table> |
| 261 |
|
| 262 |
<p> |
| 263 |
Change your partition layout according to your own preference. |
| 264 |
</p> |
| 265 |
|
| 266 |
</body> |
| 267 |
</subsection> |
| 268 |
<subsection> |
| 269 |
<title>Viewing the Current Partition Layout</title> |
| 270 |
<body> |
| 271 |
|
| 272 |
<p> |
| 273 |
<c>fdisk</c> is a popular and powerful tool to split your disk into |
| 274 |
partitions. Fire up <c>fdisk</c> on your disk (in our example, we |
| 275 |
use <path>/dev/sda</path>): |
| 276 |
</p> |
| 277 |
|
| 278 |
<pre caption="Starting fdisk"> |
| 279 |
# <i>fdisk /dev/sda</i> |
| 280 |
</pre> |
| 281 |
|
| 282 |
<p> |
| 283 |
Once in <c>fdisk</c>, you'll be greeted with a prompt that looks like |
| 284 |
this: |
| 285 |
</p> |
| 286 |
|
| 287 |
<pre caption="fdisk prompt"> |
| 288 |
Command (m for help): |
| 289 |
</pre> |
| 290 |
|
| 291 |
<p> |
| 292 |
Type <c>p</c> to display your disk's current partition configuration: |
| 293 |
</p> |
| 294 |
|
| 295 |
<pre caption="An example partition configuration"> |
| 296 |
Command (m for help): p |
| 297 |
|
| 298 |
Disk /dev/sda: 30.7 GB, 30750031872 bytes |
| 299 |
141 heads, 63 sectors/track, 6761 cylinders |
| 300 |
Units = cylinders of 8883 * 512 = 4548096 bytes |
| 301 |
|
| 302 |
Device Boot Start End Blocks Id System |
| 303 |
/dev/hdb1 1 12 53266+ 83 Linux |
| 304 |
/dev/hdb2 13 233 981571+ 82 Linux swap |
| 305 |
/dev/hdb3 234 674 1958701+ 83 Linux |
| 306 |
/dev/hdb4 675 6761 27035410+ 5 Extended |
| 307 |
/dev/hdb5 675 2874 9771268+ 83 Linux |
| 308 |
/dev/hdb6 2875 2919 199836 83 Linux |
| 309 |
/dev/hdb7 2920 3008 395262 83 Linux |
| 310 |
/dev/hdb8 3009 6761 16668918 83 Linux |
| 311 |
|
| 312 |
Command (m for help): |
| 313 |
</pre> |
| 314 |
|
| 315 |
<p> |
| 316 |
This particular disk is configured to house seven Linux filesystems |
| 317 |
(each with a corresponding partition listed as "Linux") as well as a |
| 318 |
swap partition (listed as "Linux swap"). |
| 319 |
</p> |
| 320 |
|
| 321 |
</body> |
| 322 |
</subsection> |
| 323 |
<subsection> |
| 324 |
<title>Removing all Partitions</title> |
| 325 |
<body> |
| 326 |
|
| 327 |
<p> |
| 328 |
We will first remove all existing partitions from the disk. Type |
| 329 |
<c>d</c> to delete a partition. For instance, to delete an existing |
| 330 |
<path>/dev/sda1</path>: |
| 331 |
</p> |
| 332 |
|
| 333 |
<note>If you don't want to delete all partitions just delete those you |
| 334 |
want to delete. At this point the author recommends a backup of your |
| 335 |
data to avoid the lose of it. |
| 336 |
</note> |
| 337 |
|
| 338 |
<pre caption="Deleting a partition"> |
| 339 |
Command (m for help): <i>d</i> |
| 340 |
Partition number (1-4): <i>1</i> |
| 341 |
</pre> |
| 342 |
|
| 343 |
<p> |
| 344 |
The partition has been scheduled for deletion. It will no longer show up |
| 345 |
if you type <c>p</c>, but it will not be erased until your changes have |
| 346 |
been saved. If you made a mistake and want to abort without saving your |
| 347 |
changes, type <c>q</c> immediately and hit enter and your partition will |
| 348 |
not be deleted. |
| 349 |
</p> |
| 350 |
|
| 351 |
<p> |
| 352 |
Now, assuming that you do indeed want to wipe out all the partitions on |
| 353 |
your system, repeatedly type <c>p</c> to print out a partition listing |
| 354 |
and then type <c>d</c> and the number of the partition to delete it. |
| 355 |
Eventually, you'll end up with a partition table with nothing in it: |
| 356 |
</p> |
| 357 |
|
| 358 |
<pre caption="An empty partition table"> |
| 359 |
Disk /dev/sda: 30.7 GB, 30750031872 bytes |
| 360 |
141 heads, 63 sectors/track, 6761 cylinders |
| 361 |
Units = cylinders of 8883 * 512 = 4548096 bytes |
| 362 |
|
| 363 |
Device Boot Start End Blocks Id System |
| 364 |
|
| 365 |
Command (m for help): |
| 366 |
</pre> |
| 367 |
|
| 368 |
<p> |
| 369 |
Now that the in-memory partition table is empty, we're ready to create |
| 370 |
the partitions. We will use a default partitioning scheme as discussed |
| 371 |
previously. Of course, don't follow these instructions to the letter if |
| 372 |
you don't want the same partitioning scheme! |
| 373 |
</p> |
| 374 |
|
| 375 |
</body> |
| 376 |
</subsection> |
| 377 |
<subsection> |
| 378 |
<title>Creating the PPC PReP boot partition</title> |
| 379 |
<body> |
| 380 |
|
| 381 |
<p> |
| 382 |
We first create a small PReP boot partition. Type <c>n</c> to create a new |
| 383 |
partition, then <c>p</c> to select a primary partition, followed by |
| 384 |
<c>1</c> to select the first primary partition. When prompted for the |
| 385 |
first cylinder, hit enter. When prompted for the last cylinder, type |
| 386 |
<c>+7M</c> to create a partition 7 Mbyte in size. After you've done |
| 387 |
this, type <c>t</c> to set the partition type, <c>1</c> to select the |
| 388 |
partition you just created and then type in <c>41</c> to set the |
| 389 |
partition type to "PPC PReP Boot". |
| 390 |
</p> |
| 391 |
|
| 392 |
<note> |
| 393 |
The PReP partition has to be smaller than 8 MByte! |
| 394 |
</note> |
| 395 |
|
| 396 |
<pre caption="Crating to PReP boot partition"> |
| 397 |
Command (m for help): <i>p</i> |
| 398 |
|
| 399 |
Disk /dev/sda: 30.7 GB, 30750031872 bytes |
| 400 |
141 heads, 63 sectors/track, 6761 cylinders |
| 401 |
Units = cylinders of 8883 * 512 = 4548096 bytes |
| 402 |
|
| 403 |
Device Boot Start End Blocks Id System |
| 404 |
|
| 405 |
Command (m for help): <i>n</i> |
| 406 |
Command action |
| 407 |
e extended |
| 408 |
p primary partition (1-4) |
| 409 |
<i>p</i> |
| 410 |
Partition number (1-4): <i>1</i> |
| 411 |
First cylinder (1-6761, default 1): |
| 412 |
Using default value 1 |
| 413 |
Last cylinder or +size or +sizeM or +sizeK (1-6761, default |
| 414 |
6761): <i>+8M</i> |
| 415 |
|
| 416 |
Command (m for help): <i>t</i> |
| 417 |
Selected partition 1 |
| 418 |
Hex code (type L to list codes): <i>41</i> |
| 419 |
Changed system type of partition 1 to 41 (PPC PReP Boot) |
| 420 |
|
| 421 |
Command (m for help): |
| 422 |
</pre> |
| 423 |
|
| 424 |
<p> |
| 425 |
Now, when you type <c>p</c>, you should see the following partition |
| 426 |
printout: |
| 427 |
</p> |
| 428 |
|
| 429 |
<pre caption="Created boot partition"> |
| 430 |
Command (m for help): <i>p</i> |
| 431 |
|
| 432 |
Disk /dev/sda: 30.7 GB, 30750031872 bytes |
| 433 |
141 heads, 63 sectors/track, 6761 cylinders |
| 434 |
Units = cylinders of 8883 * 512 = 4548096 bytes |
| 435 |
|
| 436 |
Device Boot Start End Blocks Id System |
| 437 |
/dev/hdb1 1 3 13293 41 PPC PReP Boot |
| 438 |
|
| 439 |
Command (m for help): |
| 440 |
</pre> |
| 441 |
</body> |
| 442 |
</subsection> |
| 443 |
<subsection> |
| 444 |
<title>Creating the Swap Partition</title> |
| 445 |
<body> |
| 446 |
|
| 447 |
<p> |
| 448 |
Let's now create the swap partition. To do this, type <c>n</c> to create |
| 449 |
a new partition, then <c>p</c> to tell fdisk that you want a primary |
| 450 |
partition. Then type <c>2</c> to create the second primary partition, |
| 451 |
<path>/dev/sda2</path> in our case. When prompted for the first |
| 452 |
cylinder, hit enter. When prompted for the last cylinder, type |
| 453 |
<c>+512M</c> to create a partition 512MB in size. After you've done |
| 454 |
this, type <c>t</c> to set the partition type, <c>2</c> to select the |
| 455 |
partition you just created and then type in <c>82</c> to set the |
| 456 |
partition type to "Linux Swap". After completing these steps, typing |
| 457 |
<c>p</c> should display a partition table that looks similar to this: |
| 458 |
</p> |
| 459 |
|
| 460 |
<pre caption="Partition listing after creating a swap partition"> |
| 461 |
Command (m for help): <i>p</i> |
| 462 |
|
| 463 |
Disk /dev/sda: 30.7 GB, 30750031872 bytes |
| 464 |
141 heads, 63 sectors/track, 6761 cylinders |
| 465 |
Units = cylinders of 8883 * 512 = 4548096 bytes |
| 466 |
|
| 467 |
Device Boot Start End Blocks Id System |
| 468 |
/dev/hdb1 1 3 13293 41 PPC PReP Boot |
| 469 |
/dev/hdb2 4 117 506331 82 Linux swap |
| 470 |
|
| 471 |
Command (m for help): |
| 472 |
</pre> |
| 473 |
|
| 474 |
</body> |
| 475 |
</subsection> |
| 476 |
<subsection> |
| 477 |
<title>Creating the Root Partition</title> |
| 478 |
<body> |
| 479 |
|
| 480 |
<p> |
| 481 |
Finally, let's create the root partition. To do this, type <c>n</c> to |
| 482 |
create a new partition, then <c>p</c> to tell fdisk that you want a |
| 483 |
primary partition. Then type <c>3</c> to create the third primary |
| 484 |
partition, <path>/dev/sda3</path> in our case. When prompted for the |
| 485 |
first cylinder, hit enter. When prompted for the last cylinder, hit |
| 486 |
enter to create a partition that takes up the rest of the remaining |
| 487 |
space on your disk. After completing these steps, typing <c>p</c> should |
| 488 |
display a partition table that looks similar to this: |
| 489 |
</p> |
| 490 |
|
| 491 |
<pre caption="Partition listing after creating the root partition"> |
| 492 |
Command (m for help): p |
| 493 |
|
| 494 |
Disk /dev/sda: 30.7 GB, 30750031872 bytes |
| 495 |
141 heads, 63 sectors/track, 6761 cylinders |
| 496 |
Units = cylinders of 8883 * 512 = 4548096 bytes |
| 497 |
|
| 498 |
Device Boot Start End Blocks Id System |
| 499 |
/dev/hdb1 1 3 13293 41 PPC PReP Boot |
| 500 |
/dev/hdb2 4 117 506331 82 Linux swap |
| 501 |
/dev/hdb3 118 6761 29509326 83 Linux |
| 502 |
|
| 503 |
Command (m for help): |
| 504 |
</pre> |
| 505 |
</body> |
| 506 |
</subsection> |
| 507 |
<subsection> |
| 508 |
<title>Saving the Partition Layout</title> |
| 509 |
<body> |
| 510 |
|
| 511 |
<p> |
| 512 |
To save the partition layout and exit <c>fdisk</c>, type <c>w</c>. |
| 513 |
</p> |
| 514 |
|
| 515 |
<pre caption="Save and exit fdisk"> |
| 516 |
Command (m for help): <i>w</i> |
| 517 |
</pre> |
| 518 |
|
| 519 |
<p> |
| 520 |
Now that your partitions are created, you can now continue with <uri |
| 521 |
link="#filesystems">Creating Filesystems</uri>. |
| 522 |
</p> |
| 523 |
|
| 524 |
</body> |
| 525 |
</subsection> |
| 526 |
<subsection> |
| 527 |
<title>Filesystems?</title> |
| 528 |
<body> |
| 529 |
|
| 530 |
<note> |
| 531 |
Several filesystems are available. Ext2 and ext3 are found stable on the |
| 532 |
PPC64 architecture, reiserfs and xfs are in experimental stage. jfs is |
| 533 |
unsupported. |
| 534 |
</note> |
| 535 |
|
| 536 |
<p> |
| 537 |
<b>ext2</b> is the tried and true Linux filesystem but doesn't have metadata |
| 538 |
journaling, which means that routine ext2 filesystem checks at startup time can |
| 539 |
be quite time-consuming. There is now quite a selection of newer-generation |
| 540 |
journaled filesystems that can be checked for consistency very quickly and are |
| 541 |
thus generally preferred over their non-journaled counterparts. Journaled |
| 542 |
filesystems prevent long delays when you boot your system and your filesystem |
| 543 |
happens to be in an inconsistent state. |
| 544 |
</p> |
| 545 |
|
| 546 |
<p> |
| 547 |
<b>ext3</b> is the journaled version of the ext2 filesystem, providing metadata |
| 548 |
journaling for fast recovery in addition to other enhanced journaling modes like |
| 549 |
full data and ordered data journaling. ext3 is a very good and reliable |
| 550 |
filesystem. It has an additional hashed b-tree indexing option that enables |
| 551 |
high performance in almost all situations. In short, ext3 is an excellent |
| 552 |
filesystem. |
| 553 |
</p> |
| 554 |
|
| 555 |
<p> |
| 556 |
<b>ReiserFS</b> is a B*-tree based filesystem that has very good overall |
| 557 |
performance and greatly outperforms both ext2 and ext3 when dealing with small |
| 558 |
files (files less than 4k), often by a factor of 10x-15x. ReiserFS also scales |
| 559 |
extremely well and has metadata journaling. As of kernel 2.4.18+, ReiserFS is |
| 560 |
solid and usable as both general-purpose filesystem and for extreme cases such |
| 561 |
as the creation of large filesystems, the use of many small files, very large |
| 562 |
files and directories containing tens of thousands of files. |
| 563 |
</p> |
| 564 |
|
| 565 |
<p> |
| 566 |
<b>XFS</b> is a filesystem with metadata journaling that is fully supported |
| 567 |
under Gentoo Linux's xfs-sources kernel. It comes with a robust feature-set and |
| 568 |
is optimized for scalability. We only recommend using this filesystem on Linux |
| 569 |
systems with high-end SCSI and/or fibre channel storage and a uninterruptible |
| 570 |
power supply. Because XFS aggressively caches in-transit data in RAM, improperly |
| 571 |
designed programs (those that don't take proper precautions when writing files |
| 572 |
to disk and there are quite a few of them) can lose a good deal of data if the |
| 573 |
system goes down unexpectedly. |
| 574 |
</p> |
| 575 |
|
| 576 |
<p> |
| 577 |
<b>JFS</b> is IBM's high-performance journaling filesystem. It has recently |
| 578 |
become production-ready and there hasn't been a sufficient track record to |
| 579 |
comment positively nor negatively on its general stability at this point. |
| 580 |
</p> |
| 581 |
|
| 582 |
</body> |
| 583 |
</subsection> |
| 584 |
<subsection id="filesystems-apply"> |
| 585 |
<title>Applying a Filesystem to a Partition</title> |
| 586 |
<body> |
| 587 |
|
| 588 |
<p> |
| 589 |
To create a filesystem on a partition or volume, there are tools available for |
| 590 |
each possible filesystem: |
| 591 |
</p> |
| 592 |
|
| 593 |
<table> |
| 594 |
<tr> |
| 595 |
<th>Filesystem</th> |
| 596 |
<th>Creation Command</th> |
| 597 |
</tr> |
| 598 |
<tr> |
| 599 |
<ti>ext2</ti> |
| 600 |
<ti><c>mke2fs</c></ti> |
| 601 |
</tr> |
| 602 |
<tr> |
| 603 |
<ti>ext3</ti> |
| 604 |
<ti><c>mke2fs -j</c></ti> |
| 605 |
</tr> |
| 606 |
<tr> |
| 607 |
<ti>reiserfs</ti> |
| 608 |
<ti><c>mkreiserfs</c></ti> |
| 609 |
</tr> |
| 610 |
<tr> |
| 611 |
<ti>xfs</ti> |
| 612 |
<ti><c>mkfs.xfs</c></ti> |
| 613 |
</tr> |
| 614 |
<tr> |
| 615 |
<ti>jfs</ti> |
| 616 |
<ti><c>mkfs.jfs</c></ti> |
| 617 |
</tr> |
| 618 |
</table> |
| 619 |
|
| 620 |
<p> |
| 621 |
For instance, to have the root partition (<path>/dev/sda4</path> in our example) |
| 622 |
in ext3 (as in our example), you would use: |
| 623 |
</p> |
| 624 |
|
| 625 |
<pre caption="Applying a filesystem on a partition"> |
| 626 |
# <i>mke2fs -j /dev/sda4</i> |
| 627 |
</pre> |
| 628 |
|
| 629 |
<p> |
| 630 |
Now create the filesystems on your newly created partitions (or logical |
| 631 |
volumes). |
| 632 |
</p> |
| 633 |
|
| 634 |
</body> |
| 635 |
</subsection> |
| 636 |
<subsection> |
| 637 |
<title>Activating the Swap Partition</title> |
| 638 |
<body> |
| 639 |
|
| 640 |
<p> |
| 641 |
<c>mkswap</c> is the command that is used to initialize swap partitions: |
| 642 |
</p> |
| 643 |
|
| 644 |
<pre caption="Creating a Swap signature"> |
| 645 |
# <i>mkswap /dev/sda3</i> |
| 646 |
</pre> |
| 647 |
|
| 648 |
<p> |
| 649 |
To activate the swap partition, use <c>swapon</c>: |
| 650 |
</p> |
| 651 |
|
| 652 |
<pre caption="Activating the swap partition"> |
| 653 |
# <i>swapon /dev/sda3</i> |
| 654 |
</pre> |
| 655 |
|
| 656 |
<p> |
| 657 |
Create and activate the swap now. |
| 658 |
</p> |
| 659 |
|
| 660 |
</body> |
| 661 |
</subsection> |
| 662 |
</section> |
| 663 |
<section> |
| 664 |
<title>Mounting</title> |
| 665 |
<body> |
| 666 |
|
| 667 |
<p> |
| 668 |
Now that your partitions are initialized and are housing a filesystem, it is |
| 669 |
time to mount those partitions. Use the <c>mount</c> command. Don't forget to |
| 670 |
create the necessary mount directories for every partition you created. As an |
| 671 |
example we create a mount-point and mount the root and boot partition: |
| 672 |
</p> |
| 673 |
|
| 674 |
<pre caption="Mounting partitions"> |
| 675 |
# <i>mkdir /mnt/gentoo</i> |
| 676 |
# <i>mount /dev/sda4 /mnt/gentoo</i> |
| 677 |
</pre> |
| 678 |
|
| 679 |
<note> |
| 680 |
If you want your <path>/tmp</path> to reside on a separate partition, be sure to |
| 681 |
change its permissions after mounting: <c>chmod 1777 /mnt/gentoo/tmp</c>. This |
| 682 |
also holds for <path>/var/tmp</path>. |
| 683 |
</note> |
| 684 |
|
| 685 |
<p> |
| 686 |
Finally we have to create the <path>/dev</path> files in our new home, which is |
| 687 |
needed during the bootloader installation. This could be done by "bind"-mapping |
| 688 |
the <path>/dev</path>-filesystem from the LiveCD: |
| 689 |
</p> |
| 690 |
|
| 691 |
<pre caption="Bind-mounting the /dev-filesystem"> |
| 692 |
# <i>mkdir /mnt/gentoo/dev</i> |
| 693 |
# <i>mount -o bind /dev /mnt/gentoo/dev</i> |
| 694 |
</pre> |
| 695 |
|
| 696 |
<p> |
| 697 |
We will also have to mount the proc filesystem (a virtual interface with the |
| 698 |
kernel) on <path>/proc</path>. But first we will need to place our files on the partitions. |
| 699 |
</p> |
| 700 |
|
| 701 |
<p> |
| 702 |
Continue with <uri link="?part=1&chap=5">Installing the Gentoo |
| 703 |
Installation Files</uri>. |
| 704 |
</p> |
| 705 |
|
| 706 |
</body> |
| 707 |
</section> |
| 708 |
</sections> |