| 1 |
vapier |
1.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 |
nightmorph |
1.7 |
<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-install-arm-disk.xml,v 1.6 2007/06/26 07:07:27 nightmorph Exp $ --> |
| 8 |
vapier |
1.1 |
|
| 9 |
|
|
<sections> |
| 10 |
|
|
|
| 11 |
nightmorph |
1.6 |
<version>5.1</version> |
| 12 |
|
|
<date>2007-06-26</date> |
| 13 |
vapier |
1.1 |
|
| 14 |
vapier |
1.2 |
<!-- TODO: Add section about MTD and such --> |
| 15 |
|
|
|
| 16 |
vapier |
1.1 |
<section> |
| 17 |
|
|
<title>Introduction to Block Devices</title> |
| 18 |
|
|
<subsection> |
| 19 |
|
|
<title>Block Devices</title> |
| 20 |
|
|
<body> |
| 21 |
|
|
|
| 22 |
|
|
<p> |
| 23 |
|
|
We'll take a good look at disk-oriented aspects of Gentoo Linux |
| 24 |
|
|
and Linux in general, including Linux filesystems, partitions and block devices. |
| 25 |
|
|
Then, once you're familiar with the ins and outs of disks and filesystems, |
| 26 |
|
|
you'll be guided through the process of setting up partitions and filesystems |
| 27 |
|
|
for your Gentoo Linux installation. |
| 28 |
|
|
</p> |
| 29 |
|
|
|
| 30 |
|
|
<p> |
| 31 |
|
|
To begin, we'll introduce <e>block devices</e>. The most famous block device is |
| 32 |
|
|
probably the one that represents the first IDE drive in a Linux system, namely |
| 33 |
|
|
<path>/dev/hda</path>. If your system uses SCSI or SATA drives, then your |
| 34 |
|
|
first hard drive would be <path>/dev/sda</path>. |
| 35 |
|
|
</p> |
| 36 |
|
|
|
| 37 |
|
|
<p> |
| 38 |
|
|
The block devices above represent an abstract interface to the disk. User |
| 39 |
|
|
programs can use these block devices to interact with your disk without worrying |
| 40 |
|
|
about whether your drives are IDE, SCSI or something else. The program can |
| 41 |
|
|
simply address the storage on the disk as a bunch of contiguous, |
| 42 |
|
|
randomly-accessible 512-byte blocks. |
| 43 |
|
|
</p> |
| 44 |
|
|
|
| 45 |
|
|
</body> |
| 46 |
|
|
</subsection> |
| 47 |
|
|
<subsection> |
| 48 |
|
|
<title>Partitions</title> |
| 49 |
|
|
<body> |
| 50 |
|
|
|
| 51 |
|
|
<p> |
| 52 |
|
|
Although it is theoretically possible to use a full disk to house your Linux |
| 53 |
|
|
system, this is almost never done in practice. Instead, full disk block devices |
| 54 |
|
|
are split up in smaller, more manageable block devices. On <keyval id="arch"/> |
| 55 |
|
|
systems, these are called <e>partitions</e>. |
| 56 |
|
|
</p> |
| 57 |
|
|
|
| 58 |
|
|
<p> |
| 59 |
|
|
Partitions are divided in three types: |
| 60 |
|
|
<e>primary</e>, <e>extended</e> and <e>logical</e>. |
| 61 |
|
|
</p> |
| 62 |
|
|
|
| 63 |
|
|
<p> |
| 64 |
|
|
A <e>primary</e> partition is a partition which has its information stored in |
| 65 |
|
|
the MBR (master boot record). As an MBR is very small (512 bytes) only four |
| 66 |
|
|
primary partitions can be defined (for instance, <path>/dev/hda1</path> to |
| 67 |
|
|
<path>/dev/hda4</path>). |
| 68 |
|
|
</p> |
| 69 |
|
|
|
| 70 |
|
|
<p> |
| 71 |
|
|
An <e>extended</e> partition is a special primary partition (meaning the |
| 72 |
|
|
extended partition must be one of the four possible primary partitions) which |
| 73 |
|
|
contains more partitions. Such a partition didn't exist originally, but as |
| 74 |
|
|
four partitions were too few, it was brought to life to extend the formatting |
| 75 |
|
|
scheme without losing backward compatibility. |
| 76 |
|
|
</p> |
| 77 |
|
|
|
| 78 |
|
|
<p> |
| 79 |
|
|
A <e>logical</e> partition is a partition inside the extended partition. Their |
| 80 |
|
|
definitions aren't placed inside the MBR, but are declared inside the extended |
| 81 |
|
|
partition. |
| 82 |
|
|
</p> |
| 83 |
|
|
|
| 84 |
|
|
</body> |
| 85 |
|
|
</subsection> |
| 86 |
|
|
</section> |
| 87 |
|
|
<section> |
| 88 |
|
|
<title>Designing a Partitioning Scheme</title> |
| 89 |
|
|
<subsection> |
| 90 |
|
|
<title>Default Partitioning Scheme</title> |
| 91 |
|
|
<body> |
| 92 |
|
|
|
| 93 |
|
|
<warn> |
| 94 |
|
|
The NetWinder firmware, NeTTrom, can only read ext2 partitions realiably so you |
| 95 |
|
|
must have a separate ext2 boot partition. |
| 96 |
|
|
</warn> |
| 97 |
|
|
|
| 98 |
|
|
<p> |
| 99 |
|
|
If you are not interested in drawing up a partitioning scheme for your system, |
| 100 |
|
|
you can use the partitioning scheme we use throughout this book: |
| 101 |
|
|
</p> |
| 102 |
|
|
|
| 103 |
|
|
<table> |
| 104 |
|
|
<tr> |
| 105 |
|
|
<th>Partition</th> |
| 106 |
|
|
<th>Filesystem</th> |
| 107 |
|
|
<th>Size</th> |
| 108 |
|
|
<th>Description</th> |
| 109 |
|
|
</tr> |
| 110 |
|
|
<tr> |
| 111 |
|
|
<ti><path>/dev/hda1</path></ti> |
| 112 |
|
|
<ti>ext2</ti> |
| 113 |
|
|
<ti>32M</ti> |
| 114 |
|
|
<ti>Boot partition</ti> |
| 115 |
|
|
</tr> |
| 116 |
|
|
<tr> |
| 117 |
|
|
<ti><path>/dev/hda2</path></ti> |
| 118 |
|
|
<ti>(swap)</ti> |
| 119 |
|
|
<ti>512M</ti> |
| 120 |
|
|
<ti>Swap partition</ti> |
| 121 |
|
|
</tr> |
| 122 |
|
|
<tr> |
| 123 |
|
|
<ti><path>/dev/hda3</path></ti> |
| 124 |
|
|
<ti>ext3</ti> |
| 125 |
|
|
<ti>Rest of the disk</ti> |
| 126 |
|
|
<ti>Root partition</ti> |
| 127 |
|
|
</tr> |
| 128 |
|
|
</table> |
| 129 |
|
|
|
| 130 |
|
|
<p> |
| 131 |
|
|
If you are interested in knowing how big a partition should be, or even how |
| 132 |
|
|
many partitions you need, read on. Otherwise continue now with partitioning |
| 133 |
|
|
your disk by reading <uri link="#fdisk">Using fdisk to Partition your |
| 134 |
|
|
Disk</uri>. |
| 135 |
|
|
</p> |
| 136 |
|
|
|
| 137 |
|
|
</body> |
| 138 |
|
|
</subsection> |
| 139 |
|
|
<subsection> |
| 140 |
|
|
<title>How Many and How Big?</title> |
| 141 |
|
|
<body> |
| 142 |
|
|
|
| 143 |
|
|
<p> |
| 144 |
|
|
The number of partitions is highly dependent on your environment. For instance, |
| 145 |
|
|
if you have lots of users, you will most likely want to have your |
| 146 |
|
|
<path>/home</path> separate as it increases security and makes backups easier. |
| 147 |
|
|
If you are installing Gentoo to perform as a mailserver, your |
| 148 |
|
|
<path>/var</path> should be separate as all mails are stored inside |
| 149 |
|
|
<path>/var</path>. A good choice of filesystem will then maximise your |
| 150 |
|
|
performance. Gameservers will have a separate <path>/opt</path> as most gaming |
| 151 |
|
|
servers are installed there. The reason is similar for <path>/home</path>: |
| 152 |
|
|
security and backups. You will definitely want to keep <path>/usr</path> big: |
| 153 |
|
|
not only will it contain the majority of applications, the Portage tree alone |
| 154 |
|
|
takes around 500 Mbyte excluding the various sources that are stored in it. |
| 155 |
|
|
</p> |
| 156 |
|
|
|
| 157 |
|
|
<p> |
| 158 |
|
|
As you can see, it very much depends on what you want to achieve. Separate |
| 159 |
|
|
partitions or volumes have the following advantages: |
| 160 |
|
|
</p> |
| 161 |
|
|
|
| 162 |
|
|
<ul> |
| 163 |
|
|
<li> |
| 164 |
|
|
You can choose the best performing filesystem for each partition or volume |
| 165 |
|
|
</li> |
| 166 |
|
|
<li> |
| 167 |
|
|
Your entire system cannot run out of free space if one defunct tool is |
| 168 |
|
|
continuously writing files to a partition or volume |
| 169 |
|
|
</li> |
| 170 |
|
|
<li> |
| 171 |
|
|
If necessary, file system checks are reduced in time, as multiple checks can |
| 172 |
|
|
be done in parallel (although this advantage is more with multiple disks than |
| 173 |
|
|
it is with multiple partitions) |
| 174 |
|
|
</li> |
| 175 |
|
|
<li> |
| 176 |
|
|
Security can be enhanced by mounting some partitions or volumes read-only, |
| 177 |
|
|
nosuid (setuid bits are ignored), noexec (executable bits are ignored) etc. |
| 178 |
|
|
</li> |
| 179 |
|
|
</ul> |
| 180 |
|
|
|
| 181 |
|
|
<p> |
| 182 |
|
|
However, multiple partitions have one big disadvantage: if not configured |
| 183 |
|
|
properly, you might result in having a system with lots of free space on one |
| 184 |
|
|
partition and none on another. There is also a 15-partition limit for SCSI and |
| 185 |
|
|
SATA. |
| 186 |
|
|
</p> |
| 187 |
|
|
|
| 188 |
|
|
<p> |
| 189 |
|
|
As an example partitioning, we show you one for a 20GB disk, used as a |
| 190 |
|
|
demonstration laptop (containing webserver, mailserver, gnome, ...): |
| 191 |
|
|
</p> |
| 192 |
|
|
|
| 193 |
|
|
<pre caption="Filesystem usage example"> |
| 194 |
|
|
$ <i>df -h</i> |
| 195 |
|
|
Filesystem Type Size Used Avail Use% Mounted on |
| 196 |
|
|
/dev/hda5 ext3 509M 132M 351M 28% / |
| 197 |
|
|
/dev/hda2 ext3 5.0G 3.0G 1.8G 63% /home |
| 198 |
|
|
/dev/hda7 ext3 7.9G 6.2G 1.3G 83% /usr |
| 199 |
|
|
/dev/hda8 ext3 1011M 483M 477M 51% /opt |
| 200 |
|
|
/dev/hda9 ext3 2.0G 607M 1.3G 32% /var |
| 201 |
|
|
/dev/hda1 ext2 51M 17M 31M 36% /boot |
| 202 |
|
|
/dev/hda6 swap 516M 12M 504M 2% <not mounted> |
| 203 |
|
|
<comment>(Unpartitioned space for future usage: 2 GB)</comment> |
| 204 |
|
|
</pre> |
| 205 |
|
|
|
| 206 |
|
|
<p> |
| 207 |
|
|
<path>/usr</path> is rather full (83% used) here, but once |
| 208 |
|
|
all software is installed, <path>/usr</path> doesn't tend to grow that much. |
| 209 |
|
|
Although allocating a few gigabytes of disk space for <path>/var</path> may |
| 210 |
|
|
seem excessive, remember that Portage uses this partition by default for |
| 211 |
|
|
compiling packages. If you want to keep <path>/var</path> at a more reasonable |
| 212 |
|
|
size, such as 1GB, you will need to alter your <c>PORTAGE_TMPDIR</c> variable |
| 213 |
|
|
in <path>/etc/make.conf</path> to point to the partition with enough free space |
| 214 |
|
|
for compiling extremely large packages such as OpenOffice. |
| 215 |
|
|
</p> |
| 216 |
|
|
|
| 217 |
|
|
</body> |
| 218 |
|
|
</subsection> |
| 219 |
|
|
</section> |
| 220 |
|
|
<section id="fdisk"> |
| 221 |
|
|
<title>Using fdisk to Partition your Disk</title> |
| 222 |
|
|
<subsection> |
| 223 |
|
|
<body> |
| 224 |
|
|
|
| 225 |
|
|
<p> |
| 226 |
|
|
The following parts explain how to create the example partition layout |
| 227 |
|
|
described previously, namely: |
| 228 |
|
|
</p> |
| 229 |
|
|
|
| 230 |
|
|
<table> |
| 231 |
|
|
<tr> |
| 232 |
|
|
<th>Partition</th> |
| 233 |
|
|
<th>Description</th> |
| 234 |
|
|
</tr> |
| 235 |
|
|
<tr> |
| 236 |
|
|
<ti><path>/dev/hda1</path></ti> |
| 237 |
|
|
<ti>Boot partition</ti> |
| 238 |
|
|
</tr> |
| 239 |
|
|
<tr> |
| 240 |
|
|
<ti><path>/dev/hda2</path></ti> |
| 241 |
|
|
<ti>Swap partition</ti> |
| 242 |
|
|
</tr> |
| 243 |
|
|
<tr> |
| 244 |
|
|
<ti><path>/dev/hda3</path></ti> |
| 245 |
|
|
<ti>Root partition</ti> |
| 246 |
|
|
</tr> |
| 247 |
|
|
</table> |
| 248 |
|
|
|
| 249 |
|
|
<p> |
| 250 |
|
|
Change your partition layout according to your own preference. |
| 251 |
|
|
</p> |
| 252 |
|
|
|
| 253 |
|
|
</body> |
| 254 |
|
|
</subsection> |
| 255 |
|
|
<subsection> |
| 256 |
|
|
<title>Viewing the Current Partition Layout</title> |
| 257 |
|
|
<body> |
| 258 |
|
|
|
| 259 |
|
|
<p> |
| 260 |
|
|
<c>fdisk</c> is a popular and powerful tool to split your disk into partitions. |
| 261 |
|
|
Fire up <c>fdisk</c> on your disk (in our example, we use |
| 262 |
|
|
<path>/dev/hda</path>): |
| 263 |
|
|
</p> |
| 264 |
|
|
|
| 265 |
|
|
<pre caption="Starting fdisk"> |
| 266 |
|
|
# <i>fdisk /dev/hda</i> |
| 267 |
|
|
</pre> |
| 268 |
|
|
|
| 269 |
|
|
<p> |
| 270 |
|
|
Once in <c>fdisk</c>, you'll be greeted with a prompt that looks like this: |
| 271 |
|
|
</p> |
| 272 |
|
|
|
| 273 |
|
|
<pre caption="fdisk prompt"> |
| 274 |
|
|
Command (m for help): |
| 275 |
|
|
</pre> |
| 276 |
|
|
|
| 277 |
|
|
<p> |
| 278 |
|
|
Type <c>p</c> to display your disk's current partition configuration: |
| 279 |
|
|
</p> |
| 280 |
|
|
|
| 281 |
|
|
<pre caption="An example partition configuration"> |
| 282 |
|
|
Command (m for help): <i>p</i> |
| 283 |
|
|
|
| 284 |
|
|
Disk /dev/hda: 240 heads, 63 sectors, 2184 cylinders |
| 285 |
|
|
Units = cylinders of 15120 * 512 bytes |
| 286 |
|
|
|
| 287 |
|
|
Device Boot Start End Blocks Id System |
| 288 |
|
|
/dev/hda1 1 14 105808+ 83 Linux |
| 289 |
|
|
/dev/hda2 15 49 264600 82 Linux swap |
| 290 |
|
|
/dev/hda3 50 70 158760 83 Linux |
| 291 |
|
|
/dev/hda4 71 2184 15981840 5 Extended |
| 292 |
|
|
/dev/hda5 71 209 1050808+ 83 Linux |
| 293 |
|
|
/dev/hda6 210 348 1050808+ 83 Linux |
| 294 |
|
|
/dev/hda7 349 626 2101648+ 83 Linux |
| 295 |
|
|
/dev/hda8 627 904 2101648+ 83 Linux |
| 296 |
|
|
/dev/hda9 905 2184 9676768+ 83 Linux |
| 297 |
|
|
|
| 298 |
|
|
Command (m for help): |
| 299 |
|
|
</pre> |
| 300 |
|
|
|
| 301 |
|
|
<p> |
| 302 |
|
|
This particular disk is configured to house seven Linux filesystems (each with |
| 303 |
|
|
a corresponding partition listed as "Linux") as well as a swap partition |
| 304 |
|
|
(listed as "Linux swap"). |
| 305 |
|
|
</p> |
| 306 |
|
|
|
| 307 |
|
|
</body> |
| 308 |
|
|
</subsection> |
| 309 |
|
|
<subsection> |
| 310 |
|
|
<title>Removing all Partitions</title> |
| 311 |
|
|
<body> |
| 312 |
|
|
|
| 313 |
|
|
<p> |
| 314 |
|
|
We will first remove all existing partitions from the disk. Type <c>d</c> to |
| 315 |
|
|
delete a partition. For instance, to delete an existing <path>/dev/hda1</path>: |
| 316 |
|
|
</p> |
| 317 |
|
|
|
| 318 |
|
|
<pre caption="Deleting a partition"> |
| 319 |
|
|
Command (m for help): <i>d</i> |
| 320 |
|
|
Partition number (1-4): <i>1</i> |
| 321 |
|
|
</pre> |
| 322 |
|
|
|
| 323 |
|
|
<p> |
| 324 |
|
|
The partition has been scheduled for deletion. It will no longer show up if you |
| 325 |
|
|
type <c>p</c>, but it will not be erased until your changes have been saved. If |
| 326 |
|
|
you made a mistake and want to abort without saving your changes, type <c>q</c> |
| 327 |
|
|
immediately and hit enter and your partition will not be deleted. |
| 328 |
|
|
</p> |
| 329 |
|
|
|
| 330 |
|
|
<p> |
| 331 |
|
|
Now, assuming that you do indeed want to wipe out all the partitions on your |
| 332 |
|
|
system, repeatedly type <c>p</c> to print out a partition listing and then type |
| 333 |
|
|
<c>d</c> and the number of the partition to delete it. Eventually, you'll end |
| 334 |
|
|
up with a partition table with nothing in it: |
| 335 |
|
|
</p> |
| 336 |
|
|
|
| 337 |
|
|
<pre caption="An empty partition table"> |
| 338 |
|
|
Disk /dev/hda: 30.0 GB, 30005821440 bytes |
| 339 |
|
|
240 heads, 63 sectors/track, 3876 cylinders |
| 340 |
|
|
Units = cylinders of 15120 * 512 = 7741440 bytes |
| 341 |
|
|
|
| 342 |
|
|
Device Boot Start End Blocks Id System |
| 343 |
|
|
|
| 344 |
|
|
Command (m for help): |
| 345 |
|
|
</pre> |
| 346 |
|
|
|
| 347 |
|
|
<p> |
| 348 |
|
|
Now that the in-memory partition table is empty, we're ready to create the |
| 349 |
|
|
partitions. We will use a default partitioning scheme as discussed previously. |
| 350 |
|
|
Of course, don't follow these instructions to the letter if you don't want the |
| 351 |
|
|
same partitioning scheme! |
| 352 |
|
|
</p> |
| 353 |
|
|
|
| 354 |
|
|
</body> |
| 355 |
|
|
</subsection> |
| 356 |
|
|
<subsection> |
| 357 |
|
|
<title>Creating the Boot Partition</title> |
| 358 |
|
|
<body> |
| 359 |
|
|
|
| 360 |
|
|
<p> |
| 361 |
|
|
We first create a small boot partition. Type <c>n</c> to create a new partition, |
| 362 |
|
|
then <c>p</c> to select a primary partition, followed by <c>1</c> to select the |
| 363 |
|
|
first primary partition. When prompted for the first cylinder, hit enter. When |
| 364 |
|
|
prompted for the last cylinder, type <c>+32M</c> to create a partition 32 Mbyte |
| 365 |
|
|
in size: |
| 366 |
|
|
</p> |
| 367 |
|
|
|
| 368 |
|
|
<pre caption="Creating the boot partition"> |
| 369 |
|
|
Command (m for help): <i>n</i> |
| 370 |
|
|
Command action |
| 371 |
|
|
e extended |
| 372 |
|
|
p primary partition (1-4) |
| 373 |
|
|
<i>p</i> |
| 374 |
|
|
Partition number (1-4): <i>1</i> |
| 375 |
|
|
First cylinder (1-3876, default 1): <comment>(Hit Enter)</comment> |
| 376 |
|
|
Using default value 1 |
| 377 |
|
|
Last cylinder or +size or +sizeM or +sizeK (1-3876, default 3876): <i>+32M</i> |
| 378 |
|
|
</pre> |
| 379 |
|
|
|
| 380 |
|
|
<p> |
| 381 |
|
|
Now, when you type <c>p</c>, you should see the following partition printout: |
| 382 |
|
|
</p> |
| 383 |
|
|
|
| 384 |
|
|
<pre caption="Created boot partition"> |
| 385 |
|
|
Command (m for help): <i>p</i> |
| 386 |
|
|
|
| 387 |
|
|
Disk /dev/hda: 30.0 GB, 30005821440 bytes |
| 388 |
|
|
240 heads, 63 sectors/track, 3876 cylinders |
| 389 |
|
|
Units = cylinders of 15120 * 512 = 7741440 bytes |
| 390 |
|
|
|
| 391 |
|
|
Device Boot Start End Blocks Id System |
| 392 |
|
|
/dev/hda1 1 14 105808+ 83 Linux |
| 393 |
|
|
</pre> |
| 394 |
|
|
|
| 395 |
|
|
<p> |
| 396 |
|
|
We need to make this partition bootable. Type <c>a</c> to toggle the bootable |
| 397 |
|
|
flag on a partition and select <c>1</c>. If you press <c>p</c> again, you will |
| 398 |
|
|
notice that an <path>*</path> is placed in the "Boot" column. |
| 399 |
|
|
</p> |
| 400 |
|
|
|
| 401 |
|
|
</body> |
| 402 |
|
|
</subsection> |
| 403 |
|
|
<subsection> |
| 404 |
|
|
<title>Creating the Swap Partition</title> |
| 405 |
|
|
<body> |
| 406 |
|
|
|
| 407 |
|
|
<p> |
| 408 |
|
|
Let's now create the swap partition. To do this, type <c>n</c> to create a new |
| 409 |
|
|
partition, then <c>p</c> to tell fdisk that you want a primary partition. Then |
| 410 |
|
|
type <c>2</c> to create the second primary partition, <path>/dev/hda2</path> in |
| 411 |
|
|
our case. When prompted for the first cylinder, hit enter. When prompted for |
| 412 |
|
|
the last cylinder, type <c>+512M</c> to create a partition 512MB in size. After |
| 413 |
|
|
you've done this, type <c>t</c> to set the partition type, <c>2</c> to select |
| 414 |
|
|
the partition you just created and then type in <c>82</c> to set the partition |
| 415 |
|
|
type to "Linux Swap". After completing these steps, typing <c>p</c> should |
| 416 |
|
|
display a partition table that looks similar to this: |
| 417 |
|
|
</p> |
| 418 |
|
|
|
| 419 |
|
|
<pre caption="Partition listing after creating a swap partition"> |
| 420 |
|
|
Command (m for help): <i>p</i> |
| 421 |
|
|
|
| 422 |
|
|
Disk /dev/hda: 30.0 GB, 30005821440 bytes |
| 423 |
|
|
240 heads, 63 sectors/track, 3876 cylinders |
| 424 |
|
|
Units = cylinders of 15120 * 512 = 7741440 bytes |
| 425 |
|
|
|
| 426 |
|
|
Device Boot Start End Blocks Id System |
| 427 |
|
|
/dev/hda1 * 1 14 105808+ 83 Linux |
| 428 |
|
|
/dev/hda2 15 81 506520 82 Linux swap |
| 429 |
|
|
</pre> |
| 430 |
|
|
|
| 431 |
|
|
</body> |
| 432 |
|
|
</subsection> |
| 433 |
|
|
<subsection> |
| 434 |
|
|
<title>Creating the Root Partition</title> |
| 435 |
|
|
<body> |
| 436 |
|
|
|
| 437 |
|
|
<p> |
| 438 |
|
|
Finally, let's create the root partition. To do this, type <c>n</c> to create a |
| 439 |
|
|
new partition, then <c>p</c> to tell fdisk that you want a primary partition. |
| 440 |
|
|
Then type <c>3</c> to create the third primary partition, <path>/dev/hda3</path> |
| 441 |
|
|
in our case. When prompted for the first cylinder, hit enter. When prompted for |
| 442 |
|
|
the last cylinder, hit enter to create a partition that takes up the rest of the |
| 443 |
|
|
remaining space on your disk. After completing these steps, typing <c>p</c> |
| 444 |
|
|
should display a partition table that looks similar to this: |
| 445 |
|
|
</p> |
| 446 |
|
|
|
| 447 |
|
|
<pre caption="Partition listing after creating the root partition"> |
| 448 |
|
|
Command (m for help): <i>p</i> |
| 449 |
|
|
|
| 450 |
|
|
Disk /dev/hda: 30.0 GB, 30005821440 bytes |
| 451 |
|
|
240 heads, 63 sectors/track, 3876 cylinders |
| 452 |
|
|
Units = cylinders of 15120 * 512 = 7741440 bytes |
| 453 |
|
|
|
| 454 |
|
|
Device Boot Start End Blocks Id System |
| 455 |
|
|
/dev/hda1 * 1 14 105808+ 83 Linux |
| 456 |
|
|
/dev/hda2 15 81 506520 82 Linux swap |
| 457 |
|
|
/dev/hda3 82 3876 28690200 83 Linux |
| 458 |
|
|
</pre> |
| 459 |
|
|
|
| 460 |
|
|
</body> |
| 461 |
|
|
</subsection> |
| 462 |
|
|
<subsection> |
| 463 |
|
|
<title>Saving the Partition Layout</title> |
| 464 |
|
|
<body> |
| 465 |
|
|
|
| 466 |
|
|
<p> |
| 467 |
|
|
To save the partition layout and exit <c>fdisk</c>, type <c>w</c>. |
| 468 |
|
|
</p> |
| 469 |
|
|
|
| 470 |
|
|
<pre caption="Save and exit fdisk"> |
| 471 |
|
|
Command (m for help): <i>w</i> |
| 472 |
|
|
</pre> |
| 473 |
|
|
|
| 474 |
|
|
<p> |
| 475 |
|
|
Now that your partitions are created, you can now continue with <uri |
| 476 |
|
|
link="#filesystems">Creating Filesystems</uri>. |
| 477 |
|
|
</p> |
| 478 |
|
|
|
| 479 |
|
|
</body> |
| 480 |
|
|
</subsection> |
| 481 |
|
|
</section> |
| 482 |
|
|
<section id="filesystems"> |
| 483 |
|
|
<title>Creating Filesystems</title> |
| 484 |
|
|
<subsection> |
| 485 |
|
|
<title>Introduction</title> |
| 486 |
|
|
<body> |
| 487 |
|
|
|
| 488 |
|
|
<p> |
| 489 |
|
|
Now that your partitions are created, it is time to place a filesystem on them. |
| 490 |
|
|
If you don't care about what filesystem to choose and are happy with what we use |
| 491 |
|
|
as default in this handbook, continue with <uri |
| 492 |
|
|
link="#filesystems-apply">Applying a Filesystem to a Partition</uri>. |
| 493 |
|
|
Otherwise read on to learn about the available filesystems... |
| 494 |
|
|
</p> |
| 495 |
|
|
|
| 496 |
|
|
</body> |
| 497 |
|
|
</subsection> |
| 498 |
|
|
<subsection> |
| 499 |
|
|
<title>Filesystems?</title> |
| 500 |
|
|
<body> |
| 501 |
|
|
|
| 502 |
|
|
<p> |
| 503 |
nightmorph |
1.7 |
Several filesystems are available. Some of them are found stable on the arm |
| 504 |
vapier |
1.1 |
architecture, others aren't. The following filesystems are found to be stable: |
| 505 |
|
|
ext2 and ext3. jfs and reiserfs may work but need more testing. If you're |
| 506 |
|
|
really adventurous you can try the unsupported filesystems. |
| 507 |
|
|
</p> |
| 508 |
|
|
|
| 509 |
|
|
<p> |
| 510 |
|
|
<b>ext2</b> is the tried and true Linux filesystem but doesn't have metadata |
| 511 |
|
|
journaling, which means that routine ext2 filesystem checks at startup time can |
| 512 |
|
|
be quite time-consuming. There is now quite a selection of newer-generation |
| 513 |
|
|
journaled filesystems that can be checked for consistency very quickly and are |
| 514 |
|
|
thus generally preferred over their non-journaled counterparts. Journaled |
| 515 |
|
|
filesystems prevent long delays when you boot your system and your filesystem |
| 516 |
|
|
happens to be in an inconsistent state. |
| 517 |
|
|
</p> |
| 518 |
|
|
|
| 519 |
|
|
<p> |
| 520 |
|
|
<b>ext3</b> is the journaled version of the ext2 filesystem, providing metadata |
| 521 |
nightmorph |
1.6 |
journaling for fast recovery in addition to other enhanced journaling modes like |
| 522 |
|
|
full data and ordered data journaling. It uses an HTree index that enables high |
| 523 |
|
|
performance in almost all situations. In short, ext3 is a very good and reliable |
| 524 |
|
|
filesystem. |
| 525 |
vapier |
1.1 |
</p> |
| 526 |
|
|
|
| 527 |
|
|
<p> |
| 528 |
nightmorph |
1.6 |
<b>ReiserFS</b> is a B+tree-based filesystem that has very good overall |
| 529 |
nightmorph |
1.3 |
performance and greatly outperforms both ext2 and ext3 when dealing with small |
| 530 |
|
|
files (files less than 4k), often by a factor of 10x-15x. ReiserFS also scales |
| 531 |
|
|
extremely well and has metadata journaling. ReiserFS is solid and usable as |
| 532 |
|
|
both general-purpose filesystem and for extreme cases such as the creation of |
| 533 |
|
|
large filesystems, very large files and directories containing tens of |
| 534 |
|
|
thousands of small files. |
| 535 |
vapier |
1.1 |
</p> |
| 536 |
|
|
|
| 537 |
|
|
<p> |
| 538 |
|
|
<b>XFS</b> is a filesystem with metadata journaling which comes with a robust |
| 539 |
|
|
feature-set and is optimized for scalability. We only recommend using this |
| 540 |
|
|
filesystem on Linux systems with high-end SCSI and/or fibre channel storage and |
| 541 |
|
|
an uninterruptible power supply. Because XFS aggressively caches in-transit data |
| 542 |
|
|
in RAM, improperly designed programs (those that don't take proper precautions |
| 543 |
|
|
when writing files to disk and there are quite a few of them) can lose a good |
| 544 |
|
|
deal of data if the system goes down unexpectedly. |
| 545 |
|
|
</p> |
| 546 |
|
|
|
| 547 |
|
|
<p> |
| 548 |
|
|
<b>JFS</b> is IBM's high-performance journaling filesystem. It has recently |
| 549 |
|
|
become production-ready and there hasn't been a sufficient track record to |
| 550 |
|
|
comment positively nor negatively on its general stability at this point. |
| 551 |
|
|
</p> |
| 552 |
|
|
|
| 553 |
|
|
</body> |
| 554 |
|
|
</subsection> |
| 555 |
|
|
<subsection id="filesystems-apply"> |
| 556 |
|
|
<title>Applying a Filesystem to a Partition</title> |
| 557 |
|
|
<body> |
| 558 |
|
|
|
| 559 |
|
|
<p> |
| 560 |
|
|
To create a filesystem on a partition or volume, there are tools available for |
| 561 |
|
|
each possible filesystem: |
| 562 |
|
|
</p> |
| 563 |
|
|
|
| 564 |
|
|
<table> |
| 565 |
|
|
<tr> |
| 566 |
|
|
<th>Filesystem</th> |
| 567 |
|
|
<th>Creation Command</th> |
| 568 |
|
|
</tr> |
| 569 |
|
|
<tr> |
| 570 |
|
|
<ti>ext2</ti> |
| 571 |
|
|
<ti><c>mke2fs</c></ti> |
| 572 |
|
|
</tr> |
| 573 |
|
|
<tr> |
| 574 |
|
|
<ti>ext3</ti> |
| 575 |
|
|
<ti><c>mke2fs -j</c></ti> |
| 576 |
|
|
</tr> |
| 577 |
|
|
<tr> |
| 578 |
|
|
<ti>reiserfs</ti> |
| 579 |
|
|
<ti><c>mkreiserfs</c></ti> |
| 580 |
|
|
</tr> |
| 581 |
|
|
<tr> |
| 582 |
|
|
<ti>xfs</ti> |
| 583 |
|
|
<ti><c>mkfs.xfs</c></ti> |
| 584 |
|
|
</tr> |
| 585 |
|
|
<tr> |
| 586 |
|
|
<ti>jfs</ti> |
| 587 |
|
|
<ti><c>mkfs.jfs</c></ti> |
| 588 |
|
|
</tr> |
| 589 |
|
|
</table> |
| 590 |
|
|
|
| 591 |
|
|
<p> |
| 592 |
|
|
For instance, to have the boot partition (<path>/dev/hda1</path> in our |
| 593 |
|
|
example) in ext2 and the root partition (<path>/dev/hda3</path> in our example) |
| 594 |
|
|
in ext3 (as in our example), you would use: |
| 595 |
|
|
</p> |
| 596 |
|
|
|
| 597 |
|
|
<pre caption="Applying a filesystem on a partition"> |
| 598 |
|
|
# <i>mke2fs /dev/hda1</i> |
| 599 |
nightmorph |
1.5 |
# <i>mke2fs -j /dev/hda3</i> |
| 600 |
vapier |
1.1 |
</pre> |
| 601 |
|
|
|
| 602 |
|
|
<p> |
| 603 |
|
|
Now create the filesystems on your newly created partitions (or logical |
| 604 |
|
|
volumes). |
| 605 |
|
|
</p> |
| 606 |
|
|
|
| 607 |
|
|
</body> |
| 608 |
|
|
</subsection> |
| 609 |
|
|
<subsection> |
| 610 |
|
|
<title>Activating the Swap Partition</title> |
| 611 |
|
|
<body> |
| 612 |
|
|
|
| 613 |
|
|
<p> |
| 614 |
|
|
<c>mkswap</c> is the command that is used to initialize swap partitions: |
| 615 |
|
|
</p> |
| 616 |
|
|
|
| 617 |
|
|
<pre caption="Creating a Swap signature"> |
| 618 |
|
|
# <i>mkswap /dev/hda2</i> |
| 619 |
|
|
</pre> |
| 620 |
|
|
|
| 621 |
|
|
<p> |
| 622 |
|
|
To activate the swap partition, use <c>swapon</c>: |
| 623 |
|
|
</p> |
| 624 |
|
|
|
| 625 |
|
|
<pre caption="Activating the swap partition"> |
| 626 |
|
|
# <i>swapon /dev/hda2</i> |
| 627 |
|
|
</pre> |
| 628 |
|
|
|
| 629 |
|
|
<p> |
| 630 |
|
|
Create and activate the swap with the commands mentioned above. |
| 631 |
|
|
</p> |
| 632 |
|
|
|
| 633 |
|
|
</body> |
| 634 |
|
|
</subsection> |
| 635 |
|
|
</section> |
| 636 |
|
|
<section> |
| 637 |
|
|
<title>Mounting</title> |
| 638 |
|
|
<body> |
| 639 |
|
|
|
| 640 |
|
|
<p> |
| 641 |
|
|
Now that your partitions are initialized and are housing a filesystem, it is |
| 642 |
|
|
time to mount those partitions. Use the <c>mount</c> command. Don't forget to |
| 643 |
|
|
create the necessary mount directories for every partition you created. As an |
| 644 |
|
|
example we mount the root and boot partition: |
| 645 |
|
|
</p> |
| 646 |
|
|
|
| 647 |
|
|
<pre caption="Mounting partitions"> |
| 648 |
|
|
# <i>mount /dev/hda3 /mnt/gentoo</i> |
| 649 |
|
|
# <i>mkdir /mnt/gentoo/boot</i> |
| 650 |
|
|
# <i>mount /dev/hda1 /mnt/gentoo/boot</i> |
| 651 |
|
|
</pre> |
| 652 |
|
|
|
| 653 |
|
|
<note> |
| 654 |
|
|
If you want your <path>/tmp</path> to reside on a separate partition, be sure to |
| 655 |
|
|
change its permissions after mounting: <c>chmod 1777 /mnt/gentoo/tmp</c>. This |
| 656 |
|
|
also holds for <path>/var/tmp</path>. |
| 657 |
|
|
</note> |
| 658 |
|
|
|
| 659 |
|
|
<p> |
| 660 |
|
|
We will also have to mount the proc filesystem (a virtual interface with the |
| 661 |
|
|
kernel) on <path>/proc</path>. But first we will need to place our files on the partitions. |
| 662 |
|
|
</p> |
| 663 |
|
|
|
| 664 |
|
|
<p> |
| 665 |
|
|
Continue with <uri link="?part=1&chap=5">Installing the Gentoo |
| 666 |
|
|
Installation Files</uri>. |
| 667 |
|
|
</p> |
| 668 |
|
|
|
| 669 |
|
|
</body> |
| 670 |
|
|
</section> |
| 671 |
|
|
</sections> |