| 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/2.5 --> |
| 6 |
|
| 7 |
<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-install-mips-disk.xml,v 1.19 2006/06/12 10:18:17 neysx Exp $ --> |
| 8 |
|
| 9 |
<sections> |
| 10 |
|
| 11 |
<version>1.14</version> |
| 12 |
<date>2006-08-17</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 and Linux in |
| 22 |
general, including Linux filesystems, partitions and block devices. Then, once |
| 23 |
you're familiar with the ins and outs of disks and filesystems, you'll be |
| 24 |
guided through the process of setting up partitions and filesystems for your |
| 25 |
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 |
| 37 |
worrying about whether your drives are IDE, SCSI or something else. The program |
| 38 |
can 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>Partitions</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. These are called |
| 52 |
<e>partitions</e>. |
| 53 |
</p> |
| 54 |
|
| 55 |
</body> |
| 56 |
</subsection> |
| 57 |
</section> |
| 58 |
<section> |
| 59 |
<title>Designing a Partitioning Scheme</title> |
| 60 |
<subsection> |
| 61 |
<title>How Many and How Big?</title> |
| 62 |
<body> |
| 63 |
|
| 64 |
<p> |
| 65 |
The number of partitions is highly dependent on your environment. For instance, |
| 66 |
if you have lots of users, you will most likely want to have your |
| 67 |
<path>/home</path> separate as it increases security and makes backups easier. |
| 68 |
If you are installing Gentoo to perform as a mailserver, your <path>/var</path> |
| 69 |
should be separate as all mails are stored inside <path>/var</path>. A good |
| 70 |
choice of filesystem will then maximise your performance. Gameservers will have |
| 71 |
a separate <path>/opt</path> as most gaming servers are installed there. The |
| 72 |
reason is similar for <path>/home</path>: security and backups. You will |
| 73 |
definitely want to keep <path>/usr</path> big: not only will it contain the |
| 74 |
majority of applications, the Portage tree alone takes around 500 Mbyte |
| 75 |
excluding the various sources that are stored in it. |
| 76 |
</p> |
| 77 |
|
| 78 |
<p> |
| 79 |
As you can see, it very much depends on what you want to achieve. Separate |
| 80 |
partitions or volumes have the following advantages: |
| 81 |
</p> |
| 82 |
|
| 83 |
<ul> |
| 84 |
<li> |
| 85 |
You can choose the best performing filesystem for each partition or volume |
| 86 |
</li> |
| 87 |
<li> |
| 88 |
Your entire system cannot run out of free space if one defunct tool is |
| 89 |
continuously writing files to a partition or volume |
| 90 |
</li> |
| 91 |
<li> |
| 92 |
If necessary, file system checks are reduced in time, as multiple checks can |
| 93 |
be done in parallel (although this advantage is more with multiple disks than |
| 94 |
it is with multiple partitions) |
| 95 |
</li> |
| 96 |
<li> |
| 97 |
Security can be enhanced by mounting some partitions or volumes read-only, |
| 98 |
nosuid (setuid bits are ignored), noexec (executable bits are ignored) etc. |
| 99 |
</li> |
| 100 |
</ul> |
| 101 |
|
| 102 |
<p> |
| 103 |
However, multiple partitions have one big disadvantage: if not configured |
| 104 |
properly, you might result in having a system with lots of free space on one |
| 105 |
partition and none on another. There is also a 15-partition limit for SCSI and |
| 106 |
SATA. |
| 107 |
</p> |
| 108 |
|
| 109 |
</body> |
| 110 |
</subsection> |
| 111 |
</section> |
| 112 |
<section> |
| 113 |
<title>Using fdisk on MIPS to Partition your Disk</title> |
| 114 |
<subsection> |
| 115 |
<title>SGI Machines: Creating an SGI Disk Label</title> |
| 116 |
<body> |
| 117 |
|
| 118 |
<p> |
| 119 |
All disks in an SGI System require an <e>SGI Disk Label</e>, which serves a |
| 120 |
similar function as Sun & MS-DOS disklabels -- It stores information about |
| 121 |
the disk partitions. Creating a new SGI Disk Label will create two special |
| 122 |
partitions on the disk: |
| 123 |
</p> |
| 124 |
|
| 125 |
<ul> |
| 126 |
<li> |
| 127 |
<e>SGI Volume Header</e> (9th partition): This partition is important. It |
| 128 |
is where the bootloader will reside, and in some cases, it will also |
| 129 |
contain the kernel images. |
| 130 |
</li> |
| 131 |
<li> |
| 132 |
<e>SGI Volume</e> (11th partition): This partition is similar in purpose to |
| 133 |
the Sun Disklabel's third partition of "Whole Disk". This partition spans |
| 134 |
the entire disk, and should be left untouched. It serves no special purpose |
| 135 |
other than to assist the PROM in some undocumented fashion (or it is used |
| 136 |
by IRIX in some way). |
| 137 |
</li> |
| 138 |
</ul> |
| 139 |
|
| 140 |
<warn> |
| 141 |
The SGI Volume Header <e>must</e> begin at cylinder 0. Failure to do so means |
| 142 |
you won't be able to boot from the disk. |
| 143 |
</warn> |
| 144 |
|
| 145 |
<p> |
| 146 |
The following is an example excerpt from an <c>fdisk</c> session. Read and |
| 147 |
tailor it to your needs... |
| 148 |
</p> |
| 149 |
|
| 150 |
<pre caption="Creating an SGI Disklabel"> |
| 151 |
# <i>fdisk /dev/sda</i> |
| 152 |
|
| 153 |
Command (m for help): <i>x</i> |
| 154 |
|
| 155 |
Expert command (m for help): <i>m</i> |
| 156 |
Command action |
| 157 |
b move beginning of data in a partition |
| 158 |
c change number of cylinders |
| 159 |
d print the raw data in the partition table |
| 160 |
e list extended partitions |
| 161 |
f fix partition order |
| 162 |
g create an IRIX (SGI) partition table |
| 163 |
h change number of heads |
| 164 |
m print this menu |
| 165 |
p print the partition table |
| 166 |
q quit without saving changes |
| 167 |
r return to main menu |
| 168 |
s change number of sectors/track |
| 169 |
v verify the partition table |
| 170 |
w write table to disk and exit |
| 171 |
|
| 172 |
Expert command (m for help): <i>g</i> |
| 173 |
Building a new SGI disklabel. Changes will remain in memory only, |
| 174 |
until you decide to write them. After that, of course, the previous |
| 175 |
content will be irrecoverably lost. |
| 176 |
|
| 177 |
Expert command (m for help): <i>r</i> |
| 178 |
|
| 179 |
Command (m for help): <i>p</i> |
| 180 |
|
| 181 |
Disk /dev/sda (SGI disk label): 64 heads, 32 sectors, 17482 cylinders |
| 182 |
Units = cylinders of 2048 * 512 bytes |
| 183 |
|
| 184 |
----- partitions ----- |
| 185 |
Pt# Device Info Start End Sectors Id System |
| 186 |
9: /dev/sda1 0 4 10240 0 SGI volhdr |
| 187 |
11: /dev/sda2 0 17481 35803136 6 SGI volume |
| 188 |
----- Bootinfo ----- |
| 189 |
Bootfile: /unix |
| 190 |
----- Directory Entries ----- |
| 191 |
|
| 192 |
Command (m for help): |
| 193 |
</pre> |
| 194 |
|
| 195 |
<note> |
| 196 |
If your disk already has an existing SGI Disklabel, then fdisk will not allow |
| 197 |
the creation of a new label. There are two ways around this. One is to create a |
| 198 |
Sun or MS-DOS disklabel, write the changes to disk, and restart fdisk. The |
| 199 |
second is to overwrite the partition table with null data via the following |
| 200 |
command: <c>dd if=/dev/zero of=/dev/sda bs=512 count=1</c>. |
| 201 |
</note> |
| 202 |
</body> |
| 203 |
</subsection> |
| 204 |
|
| 205 |
<subsection> |
| 206 |
<title>Getting the SGI Volume Header to just the right size</title> |
| 207 |
<body> |
| 208 |
|
| 209 |
<impo> |
| 210 |
This step is often needed, due to a bug in <c>fdisk</c>. For some reason, the |
| 211 |
volume header isn't created correctly, the end result being it starts and ends |
| 212 |
on cylinder 0. This prevents multiple partitions from being created. To get |
| 213 |
around this issue... read on. |
| 214 |
</impo> |
| 215 |
|
| 216 |
<p> |
| 217 |
Now that an SGI Disklabel is created, partitions may now be defined. In the |
| 218 |
above example, there are already two partitions defined for you. These are the |
| 219 |
special partitions mentioned above and should not normally be altered. However, |
| 220 |
for installing Gentoo, we'll need to load a bootloader, and possibly multiple |
| 221 |
kernel images (depending on system type) directly into the volume header. The |
| 222 |
volume header itself can hold up to <e>eight</e> images of any size, with each |
| 223 |
image allowed eight-character names. |
| 224 |
</p> |
| 225 |
|
| 226 |
<note> |
| 227 |
On SGI systems, there are two bootloaders available: <c>arcboot</c> and |
| 228 |
<c>arcload</c>. Currently, only the Indy, Indigo2 (R4k variety), Challenge S |
| 229 |
and O2 are capable of using <c>arcboot</c> as a bootloader, whereas |
| 230 |
<c>arcload</c> runs on all the Linux-supported SGI machines. Unlike |
| 231 |
<c>arcboot</c> however, <c>arcload</c> cannot presently read EXT2/3 partitions, |
| 232 |
and thus, loads its kernels from the volume header. |
| 233 |
</note> |
| 234 |
|
| 235 |
<p> |
| 236 |
The process of making the volume header larger isn't exactly straight-forward; |
| 237 |
there's a bit of a trick to it. One cannot simply delete and re-add the volume |
| 238 |
header due to odd fdisk behavior. In the example provided below, we'll create a |
| 239 |
50MB Volume header in conjunction with a 50MB /boot partition. The actual |
| 240 |
layout of your disk may vary, but this is for illustrative purposes only. |
| 241 |
</p> |
| 242 |
|
| 243 |
<pre caption="Resizing the SGI Volume Header correctly"> |
| 244 |
Command (m for help): <i>n</i> |
| 245 |
Partition number (1-16): <i>1</i> |
| 246 |
First cylinder (5-8682, default 5): <i>51</i> |
| 247 |
Last cylinder (51-8682, default 8682): <i>101</i> |
| 248 |
|
| 249 |
<comment>(Notice how fdisk only allows Partition #1 to be re-created starting at a ) |
| 250 |
(minimum of cylinder 5? Had you attempted to delete & re-create the SGI ) |
| 251 |
(Volume Header this way, this is the same issue you would have encountered. ) |
| 252 |
(In our example, we want /boot to be 50MB, so we start it at cylinder 51 (the ) |
| 253 |
(Volume Header needs to start at cylinder 0, remember?), and set its ending ) |
| 254 |
(cylinder to 101, which will roughly be 50MB (+/- 1-5MB). )</comment> |
| 255 |
|
| 256 |
Command (m for help): <i>d</i> |
| 257 |
Partition number (1-16): <i>9</i> |
| 258 |
|
| 259 |
<comment>(Delete Partition #9 (SGI Volume Header))</comment> |
| 260 |
|
| 261 |
Command (m for help): <i>n</i> |
| 262 |
Partition number (1-16): <i>9</i> |
| 263 |
First cylinder (0-50, default 0): <i>0</i> |
| 264 |
Last cylinder (0-50, default 50): <i>50</i> |
| 265 |
|
| 266 |
<comment>(Re-Create Partition #9, ending just before Partition #1)</comment> |
| 267 |
</pre> |
| 268 |
|
| 269 |
<p> |
| 270 |
If you're unsure how to use <c>fdisk</c> have a look down further at the |
| 271 |
instructions for partitioning on Cobalts. The concepts are exactly the same -- |
| 272 |
just remember to leave the volume header and whole disk partitions alone. |
| 273 |
</p> |
| 274 |
|
| 275 |
<p> |
| 276 |
Once this is done, you are safe to create the rest of your partitions as you |
| 277 |
see fit. After all your partitions are laid out, make sure you set the |
| 278 |
partition ID of your swap partition to <c>82</c>, which is Linux Swap. By |
| 279 |
default, it will be <c>83</c>, Linux Native. |
| 280 |
</p> |
| 281 |
|
| 282 |
<p> |
| 283 |
Now that your partitions are created, you can now continue with <uri |
| 284 |
link="#filesystems">Creating Filesystems</uri>. |
| 285 |
</p> |
| 286 |
|
| 287 |
</body> |
| 288 |
</subsection> |
| 289 |
|
| 290 |
<subsection> |
| 291 |
<title>Cobalt Machines: Partitioning your drive</title> |
| 292 |
<body> |
| 293 |
|
| 294 |
<p> |
| 295 |
On Cobalt machines, the BOOTROM expects to see a MS-DOS MBR, so partitioning |
| 296 |
the drive is relatively straightforward -- in fact, it's done the same way as |
| 297 |
you'd do for an Intel x86 machine. <e>However</e> there are some things you |
| 298 |
need to bear in mind. |
| 299 |
</p> |
| 300 |
|
| 301 |
<ul> |
| 302 |
<li> |
| 303 |
Cobalt firmware will expect <path>/dev/hda1</path> to be a Linux partition |
| 304 |
formatted <e>EXT2 Revision 0</e>. <e>EXT2 Revision 1 partitions will NOT |
| 305 |
WORK!</e> (The Cobalt BOOTROM only understands EXT2r0) |
| 306 |
</li> |
| 307 |
<li> |
| 308 |
The above said partition must contain a gzipped ELF image, |
| 309 |
<path>vmlinux.gz</path> in the root of that partition, which it loads as |
| 310 |
the kernel |
| 311 |
</li> |
| 312 |
</ul> |
| 313 |
|
| 314 |
<p> |
| 315 |
For that reason, I recommend creating a ~20MB <path>/boot</path> partition |
| 316 |
formatted EXT2r0 upon which you can install CoLo & your kernels. This |
| 317 |
allows you to run a modern filesystem (EXT3 or ReiserFS) for your root |
| 318 |
filesystem. |
| 319 |
</p> |
| 320 |
|
| 321 |
<p> |
| 322 |
I will assume you have created <path>/dev/hda1</path> to mount later as a |
| 323 |
<path>/boot</path> partition. If you wish to make this <path>/</path>, you'll |
| 324 |
need to keep the PROM's expectations in mind. |
| 325 |
</p> |
| 326 |
|
| 327 |
<p> |
| 328 |
So, continuing on... To create the partitions you type <c>fdisk /dev/hda</c> at |
| 329 |
the prompt. The main commands you need to know are these: |
| 330 |
</p> |
| 331 |
|
| 332 |
<ul> |
| 333 |
<li> |
| 334 |
<c>o</c>: Wipe out old partition table, starting with an empty MS-DOS |
| 335 |
partition table |
| 336 |
</li> |
| 337 |
<li> |
| 338 |
<c>n</c>: New Partition |
| 339 |
</li> |
| 340 |
<li> |
| 341 |
<c>t</c>: Change Partition Type |
| 342 |
<ul> |
| 343 |
<li>Use type <c>82</c> for Linux Swap, <c>83</c> for Linux FS</li> |
| 344 |
</ul> |
| 345 |
</li> |
| 346 |
<li> |
| 347 |
<c>d</c>: Delete a partition |
| 348 |
</li> |
| 349 |
<li> |
| 350 |
<c>p</c>: Display (print) Partition Table |
| 351 |
</li> |
| 352 |
<li> |
| 353 |
<c>q</c>: Quit -- leaving old partition table as is. |
| 354 |
</li> |
| 355 |
<li> |
| 356 |
<c>w</c>: Quit -- writing partition table in the process. |
| 357 |
</li> |
| 358 |
</ul> |
| 359 |
|
| 360 |
<pre caption="Partitioning the disk"> |
| 361 |
# <i>fdisk /dev/hda</i> |
| 362 |
|
| 363 |
The number of cylinders for this disk is set to 19870. |
| 364 |
There is nothing wrong with that, but this is larger than 1024, |
| 365 |
and could in certain setups cause problems with: |
| 366 |
1) software that runs at boot time (e.g., old versions of LILO) |
| 367 |
2) booting and partitioning software from other OSs |
| 368 |
(e.g., DOS FDISK, OS/2 FDISK) |
| 369 |
|
| 370 |
<comment>(Start by clearing out any existing partitions)</comment> |
| 371 |
Command (m for help): <i>o</i> |
| 372 |
Building a new DOS disklabel. Changes will remain in memory only, |
| 373 |
until you decide to write them. After that, of course, the previous |
| 374 |
content won't be recoverable. |
| 375 |
|
| 376 |
|
| 377 |
The number of cylinders for this disk is set to 19870. |
| 378 |
There is nothing wrong with that, but this is larger than 1024, |
| 379 |
and could in certain setups cause problems with: |
| 380 |
1) software that runs at boot time (e.g., old versions of LILO) |
| 381 |
2) booting and partitioning software from other OSs |
| 382 |
(e.g., DOS FDISK, OS/2 FDISK) |
| 383 |
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite) |
| 384 |
|
| 385 |
<comment>(You can now verify the partition table is empty using the 'p' command)</comment> |
| 386 |
|
| 387 |
Command (m for help): <i>p</i> |
| 388 |
|
| 389 |
Disk /dev/hda: 10.2 GB, 10254827520 bytes |
| 390 |
16 heads, 63 sectors/track, 19870 cylinders |
| 391 |
Units = cylinders of 1008 * 512 = 516096 bytes |
| 392 |
|
| 393 |
Device Boot Start End Blocks Id System |
| 394 |
|
| 395 |
<comment>(Create the /boot partition)</comment> |
| 396 |
|
| 397 |
Command (m for help): <i>n</i> |
| 398 |
Command action |
| 399 |
e extended |
| 400 |
p primary partition (1-4) |
| 401 |
<i>p</i> |
| 402 |
Partition number (1-4): <i>1</i> |
| 403 |
|
| 404 |
<comment>(Just press ENTER here to accept the default)</comment> |
| 405 |
|
| 406 |
First cylinder (1-19870, default 1): |
| 407 |
Last cylinder or +size or +sizeM or +sizeK (1-19870, default 19870): <i>+20M</i> |
| 408 |
|
| 409 |
<comment>(and now if we type 'p' again, we should see the new partition)</comment> |
| 410 |
Command (m for help): <i>p</i> |
| 411 |
|
| 412 |
Disk /dev/hda: 10.2 GB, 10254827520 bytes |
| 413 |
16 heads, 63 sectors/track, 19870 cylinders |
| 414 |
Units = cylinders of 1008 * 512 = 516096 bytes |
| 415 |
|
| 416 |
Device Boot Start End Blocks Id System |
| 417 |
/dev/hda1 1 40 20128+ 83 Linux |
| 418 |
|
| 419 |
<comment>(The rest, I prefer to put in an extended partition, so I'll create that)</comment> |
| 420 |
|
| 421 |
Command (m for help): <i>n</i> |
| 422 |
Command action |
| 423 |
e extended |
| 424 |
p primary partition (1-4) |
| 425 |
<i>e</i> |
| 426 |
Partition number (1-4): <i>2</i> |
| 427 |
|
| 428 |
<comment>(Again, the default is fine, just press ENTER.)</comment> |
| 429 |
|
| 430 |
First cylinder (41-19870, default 41): |
| 431 |
Using default value 41 |
| 432 |
|
| 433 |
<comment>(We want to use the whole disk here, so just press ENTER again)</comment> |
| 434 |
Last cylinder or +size or +sizeM or +sizeK (41-19870, default 19870): |
| 435 |
Using default value 19870 |
| 436 |
|
| 437 |
<comment>(Now, the / partition -- I use separate partitions for /usr, /var, |
| 438 |
etc... so / can be small. Adjust as per your preference.)</comment> |
| 439 |
|
| 440 |
Command (m for help): <i>n</i> |
| 441 |
Command action |
| 442 |
l logical (5 or over) |
| 443 |
p primary partition (1-4) |
| 444 |
<i>l</i> |
| 445 |
First cylinder (41-19870, default 41):<i><Press ENTER></i> |
| 446 |
Using default value 41 |
| 447 |
Last cylinder or +size or +sizeM or +sizeK (41-19870, default 19870): <i>+500M</i> |
| 448 |
|
| 449 |
<comment>(... and similar for any other partitions ...)</comment> |
| 450 |
|
| 451 |
<comment>(Last but not least, the swap space. I recommend at least 250MB swap, |
| 452 |
preferrably 1GB)</comment> |
| 453 |
|
| 454 |
Command (m for help): <i>n</i> |
| 455 |
Command action |
| 456 |
l logical (5 or over) |
| 457 |
p primary partition (1-4) |
| 458 |
<i>l</i> |
| 459 |
First cylinder (17294-19870, default 17294): <i><Press ENTER></i> |
| 460 |
Using default value 17294 |
| 461 |
Last cylinder or +size or +sizeM or +sizeK (1011-19870, default 19870): <i><Press ENTER></i> |
| 462 |
Using default value 19870 |
| 463 |
|
| 464 |
<comment>(Now, if we check our partition table, everything should mostly be ship |
| 465 |
shape except for one thing...)</comment> |
| 466 |
|
| 467 |
Command (m for help): <i>p</i> |
| 468 |
|
| 469 |
Disk /dev/hda: 10.2 GB, 10254827520 bytes |
| 470 |
16 heads, 63 sectors/track, 19870 cylinders |
| 471 |
Units = cylinders of 1008 * 512 = 516096 bytes |
| 472 |
|
| 473 |
Device Boot Start End Blocks ID System |
| 474 |
/dev/hda1 1 21 10552+ 83 Linux |
| 475 |
/dev/hda2 22 19870 10003896 5 Extended |
| 476 |
/dev/hda5 22 1037 512032+ 83 Linux |
| 477 |
/dev/hda6 1038 5101 2048224+ 83 Linux |
| 478 |
/dev/hda7 5102 9165 2048224+ 83 Linux |
| 479 |
/dev/hda8 9166 13229 2048224+ 83 Linux |
| 480 |
/dev/hda9 13230 17293 2048224+ 83 Linux |
| 481 |
/dev/hda10 17294 19870 1298776+ 83 Linux |
| 482 |
|
| 483 |
<comment>(Notice how #10, our swap partition is still type 83?)</comment> |
| 484 |
|
| 485 |
Command (m for help): <i>t</i> |
| 486 |
Partition number (1-10): <i>10</i> |
| 487 |
Hex code (type L to list codes): <i>82</i> |
| 488 |
Changed system type of partition 10 to 82 (Linux swap) |
| 489 |
|
| 490 |
<comment>(That should fix it... just to verify...)</comment> |
| 491 |
|
| 492 |
Command (m for help): <i>p</i> |
| 493 |
|
| 494 |
Disk /dev/hda: 10.2 GB, 10254827520 bytes |
| 495 |
16 heads, 63 sectors/track, 19870 cylinders |
| 496 |
Units = cylinders of 1008 * 512 = 516096 bytes |
| 497 |
|
| 498 |
Device Boot Start End Blocks ID System |
| 499 |
/dev/hda1 1 21 10552+ 83 Linux |
| 500 |
/dev/hda2 22 19870 10003896 5 Extended |
| 501 |
/dev/hda5 22 1037 512032+ 83 Linux |
| 502 |
/dev/hda6 1038 5101 2048224+ 83 Linux |
| 503 |
/dev/hda7 5102 9165 2048224+ 83 Linux |
| 504 |
/dev/hda8 9166 13229 2048224+ 83 Linux |
| 505 |
/dev/hda9 13230 17293 2048224+ 83 Linux |
| 506 |
/dev/hda10 17294 19870 1298776+ 82 Linux Swap |
| 507 |
|
| 508 |
<comment>(Now, we write out the new partition table.)</comment> |
| 509 |
|
| 510 |
Command (m for help): <i>w</i> |
| 511 |
The partition table has been altered! |
| 512 |
|
| 513 |
Calling ioctl() to re-read partition table. |
| 514 |
Syncing disks. |
| 515 |
|
| 516 |
# |
| 517 |
</pre> |
| 518 |
|
| 519 |
<p> |
| 520 |
And that's all there is to it. You should now be right to proceed onto the next |
| 521 |
stage: <uri link="#filesystems">Creating Filesystems</uri>. |
| 522 |
</p> |
| 523 |
|
| 524 |
</body> |
| 525 |
</subsection> |
| 526 |
</section> |
| 527 |
|
| 528 |
<section id="filesystems"> |
| 529 |
<title>Creating Filesystems</title> |
| 530 |
<subsection> |
| 531 |
<title>Introduction</title> |
| 532 |
<body> |
| 533 |
|
| 534 |
<p> |
| 535 |
Now that your partitions are created, it is time to place a filesystem on them. |
| 536 |
If you don't care about what filesystem to choose and are happy with what we |
| 537 |
use as default in this handbook, continue with <uri |
| 538 |
link="#filesystems-apply">Applying a Filesystem to a Partition</uri>. Otherwise |
| 539 |
read on to learn about the available filesystems... |
| 540 |
</p> |
| 541 |
|
| 542 |
</body> |
| 543 |
</subsection> |
| 544 |
<subsection> |
| 545 |
<title>Filesystems?</title> |
| 546 |
<body> |
| 547 |
|
| 548 |
<p> |
| 549 |
Several filesystems are available. ReiserFS, EXT2 and EXT3 are found stable on |
| 550 |
the MIPS architectures, others are experimental. |
| 551 |
</p> |
| 552 |
|
| 553 |
<p> |
| 554 |
<b>ext2</b> is the tried and true Linux filesystem but doesn't have metadata |
| 555 |
journaling, which means that routine ext2 filesystem checks at startup time can |
| 556 |
be quite time-consuming. There is now quite a selection of newer-generation |
| 557 |
journaled filesystems that can be checked for consistency very quickly and are |
| 558 |
thus generally preferred over their non-journaled counterparts. Journaled |
| 559 |
filesystems prevent long delays when you boot your system and your filesystem |
| 560 |
happens to be in an inconsistent state. |
| 561 |
</p> |
| 562 |
|
| 563 |
<p> |
| 564 |
<b>ext3</b> is the journaled version of the ext2 filesystem, providing metadata |
| 565 |
journaling for fast recovery in addition to other enhanced journaling modes |
| 566 |
like full data and ordered data journaling. ext3 is a very good and reliable |
| 567 |
filesystem.<!-- It has an additional hashed b-tree indexing option that enables |
| 568 |
high performance in almost all situations. You can enable this indexing by |
| 569 |
adding <c>-O dir_index</c> to the <c>mke2fs</c> command. In short, ext3 is an |
| 570 |
excellent filesystem.--> |
| 571 |
</p> |
| 572 |
|
| 573 |
<p> |
| 574 |
<b>ReiserFS</b> is a B*-tree based filesystem that has very good overall |
| 575 |
performance and greatly outperforms both ext2 and ext3 when dealing with small |
| 576 |
files (files less than 4k), often by a factor of 10x-15x. ReiserFS also scales |
| 577 |
extremely well and has metadata journaling. As of kernel 2.4.18+, ReiserFS is |
| 578 |
solid and usable as both general-purpose filesystem and for extreme cases such |
| 579 |
as the creation of large filesystems, the use of many small files, very large |
| 580 |
files and directories containing tens of thousands of files. |
| 581 |
</p> |
| 582 |
|
| 583 |
<p> |
| 584 |
<b>XFS</b> is a filesystem with metadata journaling which comes with a robust |
| 585 |
feature-set and is optimized for scalability. We only recommend using this |
| 586 |
filesystem on Linux systems with high-end SCSI and/or fibre channel storage and |
| 587 |
an uninterruptible power supply. Because XFS aggressively caches in-transit |
| 588 |
data in RAM, improperly designed programs (those that don't take proper |
| 589 |
precautions when writing files to disk and there are quite a few of them) can |
| 590 |
lose a good deal of data if the system goes down unexpectedly. |
| 591 |
</p> |
| 592 |
|
| 593 |
<p> |
| 594 |
<b>JFS</b> is IBM's high-performance journaling filesystem. It has recently |
| 595 |
become production-ready and there hasn't been a sufficient track record to |
| 596 |
comment positively nor negatively on its general stability at this point. |
| 597 |
</p> |
| 598 |
|
| 599 |
</body> |
| 600 |
</subsection> |
| 601 |
<subsection id="filesystems-apply"> |
| 602 |
<title>Applying a Filesystem to a Partition</title> |
| 603 |
<body> |
| 604 |
|
| 605 |
<p> |
| 606 |
To create a filesystem on a partition or volume, there are tools available for |
| 607 |
each possible filesystem: |
| 608 |
</p> |
| 609 |
|
| 610 |
<table> |
| 611 |
<tr> |
| 612 |
<th>Filesystem</th> |
| 613 |
<th>Creation Command</th> |
| 614 |
</tr> |
| 615 |
<tr> |
| 616 |
<ti>ext2</ti> |
| 617 |
<ti><c>mke2fs</c></ti> |
| 618 |
</tr> |
| 619 |
<tr> |
| 620 |
<ti>ext3</ti> |
| 621 |
<ti><c>mke2fs -j</c></ti> |
| 622 |
</tr> |
| 623 |
<tr> |
| 624 |
<ti>reiserfs</ti> |
| 625 |
<ti><c>mkreiserfs</c></ti> |
| 626 |
</tr> |
| 627 |
<tr> |
| 628 |
<ti>xfs</ti> |
| 629 |
<ti><c>mkfs.xfs</c></ti> |
| 630 |
</tr> |
| 631 |
<tr> |
| 632 |
<ti>jfs</ti> |
| 633 |
<ti><c>mkfs.jfs</c></ti> |
| 634 |
</tr> |
| 635 |
</table> |
| 636 |
|
| 637 |
<p> |
| 638 |
For instance, to have the boot partition (<path>/dev/sda1</path> in our |
| 639 |
example) in ext2 and the root partition (<path>/dev/sda3</path> in our example) |
| 640 |
in ext3, you would use: |
| 641 |
</p> |
| 642 |
|
| 643 |
<pre caption="Applying a filesystem on a partition"> |
| 644 |
# <i>mke2fs /dev/sda1</i> |
| 645 |
# <i>mke2fs -j /dev/sda3</i> |
| 646 |
</pre> |
| 647 |
|
| 648 |
<p> |
| 649 |
Now create the filesystems on your newly created partitions (or logical |
| 650 |
volumes). |
| 651 |
</p> |
| 652 |
|
| 653 |
<warn> |
| 654 |
If you're installing on a Cobalt server, remember <path>/dev/hda1</path> MUST |
| 655 |
be of type <e>EXT2 revision 0</e>; Anything else (e.g. EXT2 revision 1, EXT3, |
| 656 |
ReiserFS, XFS, JFS and others) <e>WILL NOT WORK!</e> You can format the |
| 657 |
partition using the command: <c>mke2fs -r 0 /dev/hda1</c>. |
| 658 |
</warn> |
| 659 |
|
| 660 |
<warn> |
| 661 |
Also, be aware that arcboot currently is not able to read any filesystem other |
| 662 |
than EXT2, EXT3 and ISO9660 (recent versions). For that reason, |
| 663 |
<path>/boot</path> on SGI machines must also reside on an EXT2 or EXT3 |
| 664 |
partition. |
| 665 |
</warn> |
| 666 |
|
| 667 |
</body> |
| 668 |
</subsection> |
| 669 |
<subsection> |
| 670 |
<title>Activating the Swap Partition</title> |
| 671 |
<body> |
| 672 |
|
| 673 |
<p> |
| 674 |
<c>mkswap</c> is the command that is used to create and initialize swap |
| 675 |
partitions: |
| 676 |
</p> |
| 677 |
|
| 678 |
<pre caption="Creating a Swap signature"> |
| 679 |
# <i>mkswap /dev/sda2</i> |
| 680 |
</pre> |
| 681 |
|
| 682 |
<p> |
| 683 |
To activate the swap partition, use <c>swapon</c>: |
| 684 |
</p> |
| 685 |
|
| 686 |
<pre caption="Activating the swap partition"> |
| 687 |
# <i>swapon /dev/sda2</i> |
| 688 |
</pre> |
| 689 |
|
| 690 |
<p> |
| 691 |
Create and activate the swap with the commands mentioned above. |
| 692 |
</p> |
| 693 |
|
| 694 |
</body> |
| 695 |
</subsection> |
| 696 |
</section> |
| 697 |
<section> |
| 698 |
<title>Mounting</title> |
| 699 |
<body> |
| 700 |
|
| 701 |
<p> |
| 702 |
Now that your partitions are initialized and are housing a filesystem, it is |
| 703 |
time to mount those partitions. Use the <c>mount</c> command. Don't forget to |
| 704 |
create the necessary mount directories for every partition you created. As an |
| 705 |
example we mount the root and boot partition: |
| 706 |
</p> |
| 707 |
|
| 708 |
<pre caption="Mounting partitions"> |
| 709 |
# <i>mount /dev/sda3 /mnt/gentoo</i> |
| 710 |
# <i>mkdir /mnt/gentoo/boot</i> |
| 711 |
# <i>mount /dev/sda1 /mnt/gentoo/boot</i> |
| 712 |
</pre> |
| 713 |
|
| 714 |
<note> |
| 715 |
If you want your <path>/tmp</path> to reside on a separate partition, be sure |
| 716 |
to change its permissions after mounting: <c>chmod 1777 /mnt/gentoo/tmp</c>. |
| 717 |
This also holds for <path>/var/tmp</path>. |
| 718 |
</note> |
| 719 |
|
| 720 |
<p> |
| 721 |
We will also have to mount the proc filesystem (a virtual interface with the |
| 722 |
kernel) on <path>/proc</path>. But first we will need to place our files on the |
| 723 |
partitions. |
| 724 |
</p> |
| 725 |
|
| 726 |
<p> |
| 727 |
Continue with <uri link="?part=1&chap=5">Installing the Gentoo Installation |
| 728 |
Files</uri>. |
| 729 |
</p> |
| 730 |
|
| 731 |
</body> |
| 732 |
</section> |
| 733 |
</sections> |