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-ia64-disk.xml,v 1.15 2013/02/23 18:38:22 swift Exp $ --> |
8 |
|
9 |
<sections> |
10 |
|
11 |
<version>11</version> |
12 |
<date>2013-12-17</date> |
13 |
|
14 |
<section> |
15 |
<title>Introduction to Block Devices</title> |
16 |
|
17 |
<subsection> |
18 |
<include href="hb-install-blockdevices.xml"/> |
19 |
</subsection> |
20 |
|
21 |
<subsection> |
22 |
<title>Partitions</title> |
23 |
<body> |
24 |
|
25 |
<p> |
26 |
Although it is theoretically possible to use a full disk to house your Linux |
27 |
system, this is almost never done in practice. Instead, full disk block devices |
28 |
are split up in smaller, more manageable block devices. On <keyval id="arch"/> |
29 |
systems, these are called <e>partitions</e>. |
30 |
</p> |
31 |
|
32 |
<p> |
33 |
Itanium systems use EFI, the Extensible Firmware Interface, for booting. The |
34 |
partition table format that EFI understands is called GPT, or GUID Partition |
35 |
Table. The partitioning program that understands GPT is called "parted", so |
36 |
that is the tool we will use below. Additionally, EFI can only read FAT |
37 |
filesystems, so that is the format to use for the EFI boot partition, where the |
38 |
kernel will be installed by "elilo". |
39 |
</p> |
40 |
|
41 |
</body> |
42 |
</subsection> |
43 |
<subsection> |
44 |
<title>Advanced Storage</title> |
45 |
<body> |
46 |
|
47 |
<p> |
48 |
The <keyval id="arch"/> Installation CDs provide support for LVM2. |
49 |
LVM2 increases the flexibility offered by your partitioning setup. |
50 |
During the installation instructions, we will focus on "regular" partitions, |
51 |
but it is still good to know LVM2 is supported as well. |
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>vfat</ti> |
78 |
<ti>32M</ti> |
79 |
<ti>EFI Boot partition</ti> |
80 |
</tr> |
81 |
<tr> |
82 |
<ti><path>/dev/sda2</path></ti> |
83 |
<ti>(swap)</ti> |
84 |
<ti>512M</ti> |
85 |
<ti>Swap partition</ti> |
86 |
</tr> |
87 |
<tr> |
88 |
<ti><path>/dev/sda3</path></ti> |
89 |
<ti>ext4</ti> |
90 |
<ti>Rest of the disk</ti> |
91 |
<ti>Root partition</ti> |
92 |
</tr> |
93 |
</table> |
94 |
|
95 |
<p> |
96 |
If you are interested in knowing how big a partition should be, or even how |
97 |
many partitions you need, read on. Otherwise continue now with partitioning |
98 |
your disk by reading <uri link="#parted">Using parted to Partition your |
99 |
Disk</uri>. |
100 |
</p> |
101 |
|
102 |
</body> |
103 |
</subsection> |
104 |
<subsection> |
105 |
<title>How Many and How Big?</title> |
106 |
<body> |
107 |
|
108 |
<p> |
109 |
The number of partitions is highly dependent on your environment. For instance, |
110 |
if you have lots of users, you will most likely want to have your |
111 |
<path>/home</path> separate as it increases security and makes backups easier. |
112 |
If you are installing Gentoo to perform as a mailserver, your |
113 |
<path>/var</path> should be separate as all mails are stored inside |
114 |
<path>/var</path>. A good choice of filesystem will then maximise your |
115 |
performance. Gameservers will have a separate <path>/opt</path> as most gaming |
116 |
servers are installed there. The reason is similar for <path>/home</path>: |
117 |
security and backups. You will definitely want to keep <path>/usr</path> big: |
118 |
not only will it contain the majority of applications, the Portage tree alone |
119 |
takes around 500 Mbyte excluding the various sources that are stored in it. |
120 |
</p> |
121 |
|
122 |
<p> |
123 |
As you can see, it very much depends on what you want to achieve. Separate |
124 |
partitions or volumes have the following advantages: |
125 |
</p> |
126 |
|
127 |
<ul> |
128 |
<li> |
129 |
You can choose the best performing filesystem for each partition or volume |
130 |
</li> |
131 |
<li> |
132 |
Your entire system cannot run out of free space if one defunct tool is |
133 |
continuously writing files to a partition or volume |
134 |
</li> |
135 |
<li> |
136 |
If necessary, file system checks are reduced in time, as multiple checks can |
137 |
be done in parallel (although this advantage is more with multiple disks than |
138 |
it is with multiple partitions) |
139 |
</li> |
140 |
<li> |
141 |
Security can be enhanced by mounting some partitions or volumes read-only, |
142 |
nosuid (setuid bits are ignored), noexec (executable bits are ignored) etc. |
143 |
</li> |
144 |
</ul> |
145 |
|
146 |
<p> |
147 |
However, multiple partitions have disadvantages as well. If not configured |
148 |
properly, you will have a system with lots of free space on one partition and |
149 |
none on another. Another nuisance is that separate partitions - especially |
150 |
for important mountpoints like <path>/usr</path> or <path>/var</path> - often |
151 |
require the administrator to boot with an initramfs to mount the partition |
152 |
before other boot scripts start. This isn't always the case though, so your |
153 |
results may vary. |
154 |
</p> |
155 |
|
156 |
<p> |
157 |
There is also a 15-partition limit for SCSI and SATA, unless you use GPT |
158 |
labels. |
159 |
</p> |
160 |
|
161 |
<p> |
162 |
As an example partitioning, we show you one for a 20GB disk, used as a |
163 |
demonstration laptop (containing webserver, mailserver, gnome, ...): |
164 |
</p> |
165 |
|
166 |
<pre caption="Filesystem usage example"> |
167 |
$ <i>df -h</i> |
168 |
Filesystem Type Size Used Avail Use% Mounted on |
169 |
/dev/sda5 ext4 509M 132M 351M 28% / |
170 |
/dev/sda2 ext4 5.0G 3.0G 1.8G 63% /home |
171 |
/dev/sda7 ext4 7.9G 6.2G 1.3G 83% /usr |
172 |
/dev/sda8 ext4 1011M 483M 477M 51% /opt |
173 |
/dev/sda9 ext4 2.0G 607M 1.3G 32% /var |
174 |
/dev/sda1 ext2 51M 17M 31M 36% /boot |
175 |
/dev/sda6 swap 516M 12M 504M 2% <not mounted> |
176 |
<comment>(Unpartitioned space for future usage: 2 GB)</comment> |
177 |
</pre> |
178 |
|
179 |
<p> |
180 |
<path>/usr</path> is rather full (83% used) here, but once |
181 |
all software is installed, <path>/usr</path> doesn't tend to grow that much. |
182 |
Although allocating a few gigabytes of disk space for <path>/var</path> may |
183 |
seem excessive, remember that Portage uses this partition by default for |
184 |
compiling packages. If you want to keep <path>/var</path> at a more reasonable |
185 |
size, such as 1GB, you will need to alter your <c>PORTAGE_TMPDIR</c> variable |
186 |
in <path>/etc/portage/make.conf</path> to point to the partition with enough |
187 |
free space for compiling extremely large packages such as LibreOffice. |
188 |
</p> |
189 |
|
190 |
</body> |
191 |
</subsection> |
192 |
</section> |
193 |
<section id="parted"> |
194 |
<title>Using parted to Partition your Disk</title> |
195 |
<subsection> |
196 |
<body> |
197 |
|
198 |
<p> |
199 |
The following parts explain how to create the example partition layout |
200 |
described previously, namely: |
201 |
</p> |
202 |
|
203 |
<table> |
204 |
<tr> |
205 |
<th>Partition</th> |
206 |
<th>Description</th> |
207 |
</tr> |
208 |
<tr> |
209 |
<ti><path>/dev/sda1</path></ti> |
210 |
<ti>EFI Boot partition</ti> |
211 |
</tr> |
212 |
<tr> |
213 |
<ti><path>/dev/sda2</path></ti> |
214 |
<ti>Swap partition</ti> |
215 |
</tr> |
216 |
<tr> |
217 |
<ti><path>/dev/sda3</path></ti> |
218 |
<ti>Root partition</ti> |
219 |
</tr> |
220 |
</table> |
221 |
|
222 |
<p> |
223 |
Change your partition layout according to your own preference. |
224 |
</p> |
225 |
|
226 |
</body> |
227 |
</subsection> |
228 |
<subsection> |
229 |
<title>Viewing the Current Partition Layout</title> |
230 |
<body> |
231 |
|
232 |
<p> |
233 |
<c>parted</c> is the GNU partition editor. |
234 |
Fire up <c>parted</c> on your disk (in our example, we use |
235 |
<path>/dev/sda</path>): |
236 |
</p> |
237 |
|
238 |
<pre caption="Starting parted"> |
239 |
# <i>parted /dev/sda</i> |
240 |
</pre> |
241 |
|
242 |
<p> |
243 |
Once in <c>parted</c>, you'll be greeted with a prompt that looks like this: |
244 |
</p> |
245 |
|
246 |
<pre caption="parted prompt"> |
247 |
GNU Parted 1.6.22 |
248 |
Copyright (C) 1998 - 2005 Free Software Foundation, Inc. |
249 |
This program is free software, covered by the GNU General Public License. |
250 |
|
251 |
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without |
252 |
even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
253 |
General Public License for more details. |
254 |
|
255 |
Using /dev/sda |
256 |
(parted) |
257 |
</pre> |
258 |
|
259 |
<p> |
260 |
At this point one of the available commands is <c>help</c>, which you should use |
261 |
if you want to see the other available commands. Another command is |
262 |
<c>print</c> which you should type next to display your disk's current partition |
263 |
configuration: |
264 |
</p> |
265 |
|
266 |
<pre caption="An example partition configuration"> |
267 |
(parted) <i>print</i> |
268 |
Disk geometry for /dev/sda: 0.000-34732.890 megabytes |
269 |
Disk label type: gpt |
270 |
Minor Start End Filesystem Name Flags |
271 |
1 0.017 203.938 fat32 boot |
272 |
2 203.938 4243.468 linux-swap |
273 |
3 4243.469 34724.281 ext4 |
274 |
</pre> |
275 |
|
276 |
<p> |
277 |
This particular configuration is very similar to the one that we recommend |
278 |
above. Note on the second line that the partition table is type is GPT. If it |
279 |
is different, then the ia64 system will not be able to boot from this disk. |
280 |
For the sake of this guide we'll remove the partitions and create them anew. |
281 |
</p> |
282 |
|
283 |
</body> |
284 |
</subsection> |
285 |
<subsection> |
286 |
<title>Removing all Partitions</title> |
287 |
<body> |
288 |
|
289 |
<note> |
290 |
Unlike fdisk and some other partitioning programs which postpone committing |
291 |
changes until you give the write instruction, parted commands take effect |
292 |
immediately. So once you start adding and removing partitions, you can't |
293 |
simply quit without writing them... they've already been written. |
294 |
</note> |
295 |
|
296 |
<p> |
297 |
The easy way to remove all partitions and start fresh, which guarantees that we |
298 |
are using the correct partition type, is to make a new partition table using the |
299 |
<c>mklabel</c> command. After you do this, you will have an empty GPT partition |
300 |
table. |
301 |
</p> |
302 |
|
303 |
<pre caption="Creating a new partition table"> |
304 |
(parted) <i>mklabel gpt</i> |
305 |
(parted) <i>print</i> |
306 |
Disk geometry for /dev/sda: 0.000-34732.890 megabytes |
307 |
Disk label type: gpt |
308 |
Minor Start End Filesystem Name Flags |
309 |
</pre> |
310 |
|
311 |
<p> |
312 |
Now that the partition table is empty, we're ready to create the |
313 |
partitions. We will use a default partitioning scheme as discussed previously. |
314 |
Of course, don't follow these instructions to the letter if you don't want the |
315 |
same partitioning scheme! |
316 |
</p> |
317 |
|
318 |
</body> |
319 |
</subsection> |
320 |
<subsection> |
321 |
<title>Creating the EFI Boot Partition</title> |
322 |
<body> |
323 |
|
324 |
<p> |
325 |
We first create a small EFI boot partition. This is required to be a FAT |
326 |
filesystem in order for the <keyval id="arch"/> firmware to read it. Our |
327 |
example makes this 32 MB, which is appropriate for storing kernels and |
328 |
<c>elilo</c> configuration. You can expect each <keyval id="arch"/> kernel to |
329 |
be around 5 MB, so this configuration leaves you some room to grow and |
330 |
experiment. |
331 |
</p> |
332 |
|
333 |
<pre caption="Creating the boot partition"> |
334 |
(parted) <i>mkpart primary fat32 0 32</i> |
335 |
(parted) <i>print</i> |
336 |
Disk geometry for /dev/sda: 0.000-34732.890 megabytes |
337 |
Disk label type: gpt |
338 |
Minor Start End Filesystem Name Flags |
339 |
1 0.017 32.000 fat32 |
340 |
</pre> |
341 |
|
342 |
</body> |
343 |
</subsection> |
344 |
<subsection> |
345 |
<title>Creating the Swap Partition</title> |
346 |
<body> |
347 |
|
348 |
<p> |
349 |
Let's now create the swap partition. The classic size to make the swap |
350 |
partition was twice the amount of RAM in the system. In modern systems with |
351 |
lots of RAM, this is no longer necessary. For most desktop systems, a 512 |
352 |
megabyte swap partition is sufficient. For a server, you should consider |
353 |
something larger to reflect the anticipated needs of the server. |
354 |
</p> |
355 |
|
356 |
<pre caption="Creating the swap partition"> |
357 |
(parted) <i>mkpart primary linux-swap 32 544</i> |
358 |
(parted) <i>print</i> |
359 |
Disk geometry for /dev/sda: 0.000-34732.890 megabytes |
360 |
Disk label type: gpt |
361 |
Minor Start End Filesystem Name Flags |
362 |
1 0.017 32.000 fat32 |
363 |
2 32.000 544.000 |
364 |
</pre> |
365 |
|
366 |
</body> |
367 |
</subsection> |
368 |
<subsection> |
369 |
<title>Creating the Root Partition</title> |
370 |
<body> |
371 |
|
372 |
<p> |
373 |
Finally, let's create the root partition. Our configuration will make the root |
374 |
partition to occupy the rest of the disk. We default to ext4, but you can use |
375 |
ext2, jfs, reiserfs or xfs if you prefer. The actual filesystem is not created |
376 |
in this step, but the partition table contains an indication of what kind of |
377 |
filesystem is stored on each partition, and it's a good idea to make the table |
378 |
match your intentions. |
379 |
</p> |
380 |
|
381 |
<pre caption="Creating the root partition"> |
382 |
(parted) <i>mkpart primary ext4 544 34732.890</i> |
383 |
(parted) <i>print</i> |
384 |
Disk geometry for /dev/sda: 0.000-34732.890 megabytes |
385 |
Disk label type: gpt |
386 |
Minor Start End Filesystem Name Flags |
387 |
1 0.017 32.000 fat32 |
388 |
2 32.000 544.000 |
389 |
3 544.000 34732.874 |
390 |
</pre> |
391 |
|
392 |
</body> |
393 |
</subsection> |
394 |
<subsection> |
395 |
<title>Exiting parted</title> |
396 |
<body> |
397 |
|
398 |
<p> |
399 |
To quit from parted, type <c>quit</c>. There's no need to take a separate step |
400 |
to save your partition layout since parted has been saving it all along. As you |
401 |
leave, parted gives you reminder to update your <c>/etc/fstab</c>, which we'll |
402 |
do later in this guide. |
403 |
</p> |
404 |
|
405 |
<pre caption="Quit from parted"> |
406 |
(parted) <i>quit</i> |
407 |
Information: Don't forget to update /etc/fstab, if necessary. |
408 |
</pre> |
409 |
|
410 |
<p> |
411 |
Now that your partitions are created, you can continue with <uri |
412 |
link="#filesystems">Creating Filesystems</uri>. |
413 |
</p> |
414 |
|
415 |
</body> |
416 |
</subsection> |
417 |
</section> |
418 |
<section id="filesystems"> |
419 |
<title>Creating Filesystems</title> |
420 |
<subsection> |
421 |
<title>Introduction</title> |
422 |
<body> |
423 |
|
424 |
<p> |
425 |
Now that your partitions are created, it is time to place a filesystem on them. |
426 |
If you don't care about what filesystem to choose and are happy with what we use |
427 |
as default in this handbook, continue with <uri |
428 |
link="#filesystems-apply">Applying a Filesystem to a Partition</uri>. |
429 |
Otherwise read on to learn about the available filesystems... |
430 |
</p> |
431 |
|
432 |
</body> |
433 |
</subsection> |
434 |
|
435 |
<subsection> |
436 |
<include href="hb-install-filesystems.xml"/> |
437 |
</subsection> |
438 |
|
439 |
<subsection id="filesystems-apply"> |
440 |
<title>Applying a Filesystem to a Partition</title> |
441 |
<body> |
442 |
|
443 |
<p> |
444 |
To create a filesystem on a partition or volume, there are tools available for |
445 |
each possible filesystem: |
446 |
</p> |
447 |
|
448 |
<table> |
449 |
<tr> |
450 |
<th>Filesystem</th> |
451 |
<th>Creation Command</th> |
452 |
</tr> |
453 |
<tr> |
454 |
<ti>vfat</ti> |
455 |
<ti><c>mkdosfs</c></ti> |
456 |
</tr> |
457 |
<tr> |
458 |
<ti>ext2</ti> |
459 |
<ti><c>mkfs.ext2</c></ti> |
460 |
</tr> |
461 |
<tr> |
462 |
<ti>ext3</ti> |
463 |
<ti><c>mkfs.ext3</c></ti> |
464 |
</tr> |
465 |
<tr> |
466 |
<ti>ext4</ti> |
467 |
<ti><c>mkfs.ext4</c></ti> |
468 |
</tr> |
469 |
<tr> |
470 |
<ti>reiserfs</ti> |
471 |
<ti><c>mkreiserfs</c></ti> |
472 |
</tr> |
473 |
<tr> |
474 |
<ti>xfs</ti> |
475 |
<ti><c>mkfs.xfs</c></ti> |
476 |
</tr> |
477 |
<tr> |
478 |
<ti>jfs</ti> |
479 |
<ti><c>mkfs.jfs</c></ti> |
480 |
</tr> |
481 |
</table> |
482 |
|
483 |
<p> |
484 |
For instance, to have the boot partition (<path>/dev/sda1</path> in our |
485 |
example) as vfat and the root partition (<path>/dev/sda3</path> in our example) |
486 |
as ext4, you would run the following commands: |
487 |
</p> |
488 |
|
489 |
<pre caption="Applying a filesystem on a partition"> |
490 |
# <i>mkdosfs /dev/sda1</i> |
491 |
# <i>mkfs.ext4 /dev/sda3</i> |
492 |
</pre> |
493 |
|
494 |
</body> |
495 |
</subsection> |
496 |
<subsection> |
497 |
<title>Activating the Swap Partition</title> |
498 |
<body> |
499 |
|
500 |
<p> |
501 |
<c>mkswap</c> is the command that is used to initialize swap partitions: |
502 |
</p> |
503 |
|
504 |
<pre caption="Creating a Swap signature"> |
505 |
# <i>mkswap /dev/sda2</i> |
506 |
</pre> |
507 |
|
508 |
<p> |
509 |
To activate the swap partition, use <c>swapon</c>: |
510 |
</p> |
511 |
|
512 |
<pre caption="Activating the swap partition"> |
513 |
# <i>swapon /dev/sda2</i> |
514 |
</pre> |
515 |
|
516 |
<p> |
517 |
Create and activate the swap with the commands mentioned above. |
518 |
</p> |
519 |
|
520 |
</body> |
521 |
</subsection> |
522 |
</section> |
523 |
<section> |
524 |
<title>Mounting</title> |
525 |
<body> |
526 |
|
527 |
<p> |
528 |
Now that your partitions are initialized and are housing a filesystem, it is |
529 |
time to mount those partitions. Use the <c>mount</c> command. Don't forget to |
530 |
create the necessary mount directories for every partition you created. As an |
531 |
example we mount the root and boot partition: |
532 |
</p> |
533 |
|
534 |
<pre caption="Mounting the root partition"> |
535 |
# <i>mount /dev/sda3 /mnt/gentoo</i> |
536 |
</pre> |
537 |
|
538 |
<note> |
539 |
Unlike some of the other architectures supported by Gentoo, <path>/boot</path> |
540 |
is not mounted on ia64. The reason for this is that the EFI boot partition will |
541 |
be automatically mounted and written by the <c>elilo</c> command each time that |
542 |
you run it. Because of this, <path>/boot</path> resides on the root filesystem |
543 |
and is the storage place for the kernels referenced by your <c>elilo</c> |
544 |
configuration. |
545 |
</note> |
546 |
|
547 |
<note> |
548 |
If you want your <path>/tmp</path> to reside on a separate partition, be sure to |
549 |
change its permissions after mounting: <c>chmod 1777 /mnt/gentoo/tmp</c>. This |
550 |
also holds for <path>/var/tmp</path>. |
551 |
</note> |
552 |
|
553 |
<p> |
554 |
We will also have to mount the proc filesystem (a virtual interface with the |
555 |
kernel) on <path>/proc</path>. But first we will need to place our files on the partitions. |
556 |
</p> |
557 |
|
558 |
<p> |
559 |
Continue with <uri link="?part=1&chap=5">Installing the Gentoo |
560 |
Installation Files</uri>. |
561 |
</p> |
562 |
|
563 |
</body> |
564 |
</section> |
565 |
</sections> |