/[gentoo]/xml/htdocs/doc/en/handbook/hb-install-alpha-disk.xml
Gentoo

Contents of /xml/htdocs/doc/en/handbook/hb-install-alpha-disk.xml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.11 - (hide annotations) (download) (as text)
Mon Nov 15 12:47:47 2004 UTC (9 years, 5 months ago) by swift
Branch: MAIN
Changes since 1.10: +1 -1 lines
File MIME type: application/xml
Moving 2004.3 documentation

1 swift 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/1.0 -->
6    
7 swift 1.11 <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/draft/hb-install-alpha-disk.xml,v 1.7 2004/11/09 13:05:40 swift Exp $ -->
8 swift 1.1
9     <sections>
10 swift 1.10
11     <version>1.9</version>
12     <date>August 30, 2004</date>
13    
14 swift 1.1 <section>
15     <title>Introduction to Block Devices</title>
16     <subsection>
17     <title>Block Devices</title>
18     <body>
19    
20     <p>
21     We'll take a good look at disk-oriented aspects of Gentoo Linux
22     and Linux in general, including Linux filesystems, partitions and block devices.
23     Then, once you're familiar with the ins and outs of disks and filesystems,
24     you'll be guided through the process of setting up partitions and filesystems
25     for your Gentoo Linux installation.
26     </p>
27    
28     <p>
29     To begin, we'll introduce <e>block devices</e>. The most famous block device is
30     probably the one that represents the first SCSI HD in a Linux system, namely
31     <path>/dev/sda</path>.
32     </p>
33    
34     <p>
35     The block devices above represent an abstract interface to the disk. User
36     programs can use these block devices to interact with your disk without worrying
37     about whether your drives are IDE, SCSI or something else. The program can
38     simply address the storage on the disk as a bunch of contiguous,
39     randomly-accessible 512-byte blocks.
40     </p>
41    
42     </body>
43     </subsection>
44     <subsection>
45     <title>Slices</title>
46     <body>
47    
48     <p>
49     Although it is theoretically possible to use a full disk to house your Linux
50     system, this is almost never done in practice. Instead, full disk block devices
51     are split up in smaller, more manageable block devices. On Alpha systems,
52     these are called <e>slices</e>.
53     </p>
54    
55     </body>
56     </subsection>
57     </section>
58     <section>
59     <title>Designing a Partitioning Scheme</title>
60     <subsection>
61     <title>Default Partitioning Scheme</title>
62     <body>
63    
64     <p>
65     As an example we use the following slice layout:
66     </p>
67    
68     <table>
69     <tr>
70     <th>Slice</th>
71     <th>Description</th>
72     </tr>
73     <tr>
74 swift 1.5 <ti><path>/dev/sda1</path></ti>
75 swift 1.1 <ti>Swap slice</ti>
76     </tr>
77     <tr>
78 swift 1.5 <ti><path>/dev/sda2</path></ti>
79 swift 1.1 <ti>Root slice</ti>
80     </tr>
81     <tr>
82 swift 1.5 <ti><path>/dev/sda3</path></ti>
83 swift 1.1 <ti>Full disk (required)</ti>
84     </tr>
85     </table>
86    
87    
88     <p>
89     If you are interested in knowing how big a partition should be, or even how
90     many partitions (or volumes) you need, read on. Otherwise continue now with
91     <uri link="#fdisk">Using fdisk to Partition your Disk</uri>.
92     </p>
93    
94     </body>
95     </subsection>
96     <subsection>
97     <title>How Many and How Big?</title>
98     <body>
99    
100     <p>
101     The number of partitions is highly dependent on your environment. For instance,
102     if you have lots of users, you will most likely want to have your
103     <path>/home</path> separate as it increases security and makes backups easier.
104     If you are installing Gentoo to perform as a mailserver, your
105     <path>/var</path> should be separate as all mails are stored inside
106     <path>/var</path>. A good choice of filesystem will then maximise your
107     performance. Gameservers will have a separate <path>/opt</path> as most gaming
108     servers are installed there. The reason is similar for <path>/home</path>:
109     security and backups.
110     </p>
111    
112     <p>
113     As you can see, it very much depends on what you want to achieve. Separate
114     partitions or volumes have the following advantages:
115     </p>
116    
117     <ul>
118     <li>
119 neysx 1.3 You can choose the best performing filesystem for each partition or volume
120 swift 1.1 </li>
121     <li>
122     Your entire system cannot run out of free space if one defunct tool is
123     continuously writing files to a partition or volume
124     </li>
125     <li>
126     If necessary, file system checks are reduced in time, as multiple checks can
127     be done in parallel (although this advantage is more with multiple disks than
128     it is with multiple partitions)
129     </li>
130     <li>
131     Security can be enhanced by mounting some partitions or volumes read-only,
132     nosuid (setuid bits are ignored), noexec (executable bits are ignored) etc.
133     </li>
134     </ul>
135    
136     <p>
137     However, multiple partitions have one big disadvantage: if not configured
138     properly, you might result in having a system with lots
139     of free space on one partition and none on another.
140     </p>
141    
142     </body>
143     </subsection>
144     </section>
145 neysx 1.2 <section id="fdisk">
146 swift 1.1 <title>Using fdisk on Alpha to Partition your Disk</title>
147     <subsection>
148     <body>
149    
150     <p>
151     The following parts explain how to create the example slice layout described
152     previously, namely:
153     </p>
154    
155     <table>
156     <tr>
157     <th>Slice</th>
158     <th>Description</th>
159     </tr>
160     <tr>
161 swift 1.5 <ti><path>/dev/sda1</path></ti>
162 swift 1.1 <ti>Swap slice</ti>
163     </tr>
164     <tr>
165 swift 1.5 <ti><path>/dev/sda2</path></ti>
166 swift 1.1 <ti>Root slice</ti>
167     </tr>
168     <tr>
169 swift 1.5 <ti><path>/dev/sda3</path></ti>
170 swift 1.1 <ti>Full disk (required)</ti>
171     </tr>
172     </table>
173    
174     <p>
175 neysx 1.9 Change your slice layout according to your own preference.
176 swift 1.1 </p>
177    
178    
179     </body>
180     </subsection>
181     <subsection>
182     <title>Identifying Available Disks</title>
183     <body>
184    
185     <p>
186     To figure out what disks you have running, use the following commands:
187     </p>
188    
189     <pre caption="Identifying available disks">
190 vapier 1.7 # <i>dmesg | grep 'drive$'</i> <comment>(For IDE disks)</comment>
191     # <i>dmesg | grep 'scsi'</i> <comment>(For SCSI disks)</comment>
192 swift 1.1 </pre>
193    
194     <p>
195     From this output you should be able to see what disks were detected and their
196     respective <path>/dev</path> entry. In the following parts we assume that the
197     disk is a SCSI disk on <path>/dev/sda</path>.
198     </p>
199    
200     <p>
201     Now fire up <c>fdisk</c>:
202     </p>
203    
204     <pre caption="Starting fdisk">
205     # <i>fdisk /dev/sda</i>
206     </pre>
207    
208     </body>
209     </subsection>
210     <subsection>
211     <title>Deleting All Slices</title>
212     <body>
213    
214     <p>
215 vapier 1.7 If your hard drive is completely blank, then you'll have to first create
216     a BSD disklabel.
217     </p>
218    
219     <pre caption="Creating BSD disklabel">
220     Command (m for help): <i>b</i>
221     /dev/sda contains no disklabel.
222     Do you want to create a disklabel? (y/n) <i>y</i>
223     <comment>A bunch of drive-specific info will show here</comment>
224     3 partitions:
225     # start end size fstype [fsize bsize cpg]
226     c: 1 5290* 5289* unused 0 0
227     </pre>
228    
229     <p>
230 swift 1.1 We start with deleting all slices <e>except</e> the 'c'-slice. The following
231     shows how to delete a slice (in the example we use 'a'). Repeat the process to
232     delete all other slices (again, except the 'c'-slice).
233     </p>
234    
235     <p>
236     Use <c>p</c> to view all existing slices. <c>d</c> is used to delete a slice.
237     </p>
238    
239     <pre caption="Deleting a slice">
240     BSD disklabel command (m for help): <i>p</i>
241    
242     8 partitions:
243     # start end size fstype [fsize bsize cpg]
244     a: 1 235* 234* 4.2BSD 1024 8192 16
245     b: 235* 469* 234* swap
246     c: 1 5290* 5289* unused 0 0
247     d: 469* 2076* 1607* unused 0 0
248     e: 2076* 3683* 1607* unused 0 0
249     f: 3683* 5290* 1607* unused 0 0
250     g: 469* 1749* 1280 4.2BSD 1024 8192 16
251     h: 1749* 5290* 3541* unused 0 0
252    
253     BSD disklabel command (m for help): <i>d</i>
254     Partition (a-h): <i>a</i>
255     </pre>
256    
257     <p>
258     After repeating this process for all slices, a listing should show you something
259     similar to this:
260     </p>
261    
262     <pre caption="Viewing an empty scheme">
263     BSD disklabel command (m for help): <i>p</i>
264    
265     3 partitions:
266     # start end size fstype [fsize bsize cpg]
267     c: 1 5290* 5289* unused 0 0
268     </pre>
269    
270     </body>
271     </subsection>
272     <subsection>
273     <title>Creating the Swap Slice</title>
274     <body>
275    
276     <p>
277     On Alpha based systems you don't need a separate boot partition. However, the
278     first cylinder cannot be used as the <c>aboot</c> image will be placed there.
279     </p>
280    
281     <p>
282     We will create a swap slice starting at the third cylinder, with a total
283     size of 1 Gbyte. Use <c>n</c> to create a new slice. After creating the slice,
284 vapier 1.8 we will change its type to <c>1</c> (one), meaning <e>swap</e>.
285 swift 1.1 </p>
286    
287     <pre caption="Creating the swap slice">
288     BSD disklabel command (m for help): <i>n</i>
289     Partition (a-p): <i>a</i>
290     First cylinder (1-5290, default 1): <i>3</i>
291     Last cylinder or +size or +sizeM or +sizeK (3-5290, default 5290): <i>+1024M</i>
292    
293     BSD disklabel command (m for help): <i>t</i>
294     Partition (a-c): <i>a</i>
295     Hex code (type L to list codes): <i>1</i>
296     </pre>
297    
298     <p>
299     After these steps you should see a layout similar to the following:
300     </p>
301    
302     <pre caption="Slice layout after creating the swap slice">
303     BSD disklabel command (m for help): <i>p</i>
304    
305     3 partitions:
306     # start end size fstype [fsize bsize cpg]
307     a: 3 1003 1001 swap
308     c: 1 5290* 5289* unused 0 0
309     </pre>
310    
311     </body>
312     </subsection>
313     <subsection>
314     <title>Create the Root Slice</title>
315     <body>
316    
317     <p>
318     We will now create the root slice, starting from the first cylinder <e>after</e>
319     the swap slice. Use the <c>p</c> command to view where the swap slice ends. In
320     our example, this is at 1003, making the root partition start at 1004.
321     </p>
322    
323     <p>
324     Another problem is that there is currently a bug in <c>fdisk</c> making it think
325     the number of available cylinders is one above the real number of cylinders. In
326     other words, when you are asked for the last cylinder, decrease the cylinder
327     number (in this example: 5290) with one.
328     </p>
329    
330     <p>
331     When the partition is created, we change the type to <c>8</c>, for <e>ext2</e>.
332     </p>
333    
334     <pre caption="Creating the root slice">
335     D disklabel command (m for help): <i>n</i>
336     Partition (a-p): <i>b</i>
337     First cylinder (1-5290, default 1): <i>1004</i>
338     Last cylinder or +size or +sizeM or +sizeK (1004-5290, default 5290): <i>5289</i>
339    
340     BSD disklabel command (m for help): <i>t</i>
341     Partition (a-c): <i>b</i>
342     Hex code (type L to list codes): <i>8</i>
343     </pre>
344    
345     <p>
346     Your slice layout should now be similar to this:
347     </p>
348    
349     <pre caption="Viewing the slice layout">
350     BSD disklabel command (m for help): <i>p</i>
351    
352     3 partitions:
353     # start end size fstype [fsize bsize cpg]
354     a: 3 1003 1001 swap
355     b: 1004 5289 4286 ext2
356     c: 1 5290* 5289* unused 0 0
357     </pre>
358    
359     </body>
360     </subsection>
361     <subsection>
362     <title>Save the Slice Layout and Exit</title>
363     <body>
364    
365     <p>
366     Save <c>fdisk</c> by typing <c>w</c>. This will also save your slice layout.
367     </p>
368    
369     <pre caption="Save and exit fdisk">
370     Command (m for help): <i>w</i>
371     </pre>
372    
373     <p>
374     Now that your slices are created, you can now continue with <uri
375     link="#filesystems">Creating Filesystems</uri>.
376     </p>
377    
378     </body>
379     </subsection>
380     </section>
381     <section id="filesystems">
382     <title>Creating Filesystems</title>
383     <subsection>
384     <title>Introduction</title>
385     <body>
386    
387     <p>
388     Now that your partitions are created, it is time to place a filesystem on them.
389     If you don't care about what filesystem to choose and are happy with what we use
390     as default in this handbook, continue with <uri
391     link="#filesystems-apply">Applying a Filesystem to a Partition</uri>.
392     Otherwise read on to learn about the available filesystems...
393     </p>
394    
395     </body>
396     </subsection>
397     <subsection>
398     <title>Filesystems?</title>
399     <body>
400    
401     <p>
402     Several filesystems are available. Most of them are found stable on the
403     Alpha architecture.
404     </p>
405    
406     <p>
407     <b>ext2</b> is the tried and true Linux filesystem but doesn't have metadata
408     journaling, which means that routine ext2 filesystem checks at startup time can
409     be quite time-consuming. There is now quite a selection of newer-generation
410     journaled filesystems that can be checked for consistency very quickly and are
411     thus generally preferred over their non-journaled counterparts. Journaled
412     filesystems prevent long delays when you boot your system and your filesystem
413     happens to be in an inconsistent state.
414     </p>
415    
416     <p>
417     <b>ext3</b> is the journaled version of the ext2 filesystem, providing metadata
418     journaling for fast recovery in addition to other enhanced journaling modes like
419     full data and ordered data journaling. ext3 is a very good and reliable
420     filesystem. It has an additional hashed b-tree indexing option that enables
421     high performance in almost all situations. In short, ext3 is an excellent
422     filesystem.
423     </p>
424    
425     <p>
426     <b>ReiserFS</b> is a B*-tree based filesystem that has very good overall
427     performance and greatly outperforms both ext2 and ext3 when dealing with small
428     files (files less than 4k), often by a factor of 10x-15x. ReiserFS also scales
429     extremely well and has metadata journaling. As of kernel 2.4.18+, ReiserFS is
430     solid and usable as both general-purpose filesystem and for extreme cases such
431     as the creation of large filesystems, the use of many small files, very large
432     files and directories containing tens of thousands of files.
433     </p>
434    
435     <p>
436 neysx 1.4 <b>XFS</b> is a filesystem with metadata journaling which comes with a robust
437     feature-set and is optimized for scalability. We only recommend using this
438     filesystem on Linux systems with high-end SCSI and/or fibre channel storage and
439     an uninterruptible power supply. Because XFS aggressively caches in-transit data
440     in RAM, improperly designed programs (those that don't take proper precautions
441     when writing files to disk and there are quite a few of them) can lose a good
442     deal of data if the system goes down unexpectedly.
443 swift 1.1 </p>
444    
445     <p>
446     <b>JFS</b> is IBM's high-performance journaling filesystem. It has recently
447     become production-ready and there hasn't been a sufficient track record to
448     comment positively nor negatively on its general stability at this point.
449     </p>
450    
451     </body>
452     </subsection>
453     <subsection id="filesystems-apply">
454     <title>Applying a Filesystem to a Partition</title>
455     <body>
456    
457     <p>
458     To create a filesystem on a partition or volume, there are tools available for
459     each possible filesystem:
460     </p>
461    
462     <table>
463     <tr>
464     <th>Filesystem</th>
465     <th>Creation Command</th>
466     </tr>
467     <tr>
468     <ti>ext2</ti>
469     <ti><c>mke2fs</c></ti>
470     </tr>
471     <tr>
472     <ti>ext3</ti>
473     <ti><c>mke2fs -j</c></ti>
474     </tr>
475     <tr>
476     <ti>reiserfs</ti>
477     <ti><c>mkreiserfs</c></ti>
478     </tr>
479     <tr>
480     <ti>xfs</ti>
481     <ti><c>mkfs.xfs</c></ti>
482     </tr>
483     <tr>
484     <ti>jfs</ti>
485     <ti><c>mkfs.jfs</c></ti>
486     </tr>
487     </table>
488    
489     <p>
490 swift 1.5 For instance, to have the root partition (<path>/dev/sda2</path> in our example)
491 swift 1.1 in ext3, you would use:
492     </p>
493    
494     <pre caption="Applying a filesystem on a partition">
495 swift 1.5 # <i>mke2fs -j /dev/sda2</i>
496 swift 1.1 </pre>
497    
498     <p>
499     Now create the filesystems on your newly created partitions (or logical
500     volumes).
501     </p>
502    
503     </body>
504     </subsection>
505     <subsection>
506     <title>Activating the Swap Partition</title>
507     <body>
508    
509     <p>
510     <c>mkswap</c> is the command that is used to initialize swap partitions:
511     </p>
512    
513     <pre caption="Creating a Swap signature">
514 swift 1.5 # <i>mkswap /dev/sda1</i>
515 swift 1.1 </pre>
516    
517     <p>
518     To activate the swap partition, use <c>swapon</c>:
519     </p>
520    
521     <pre caption="Activating the swap partition">
522 swift 1.5 # <i>swapon /dev/sda1</i>
523 swift 1.1 </pre>
524    
525     <p>
526     Create and activate the swap now.
527     </p>
528    
529     </body>
530     </subsection>
531     </section>
532     <section>
533     <title>Mounting</title>
534     <body>
535    
536     <p>
537     Now that your partitions are initialized and are housing a filesystem, it is
538     time to mount those partitions. Use the <c>mount</c> command. Don't forget to
539     create the necessary mount directories for every partition you created. As an
540     example we mount the root and boot partition:
541     </p>
542    
543     <pre caption="Mounting partitions">
544 swift 1.5 # <i>mount /dev/sda2 /mnt/gentoo</i>
545 swift 1.1 </pre>
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 swift 1.6 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 swift 1.1 </p>
557    
558     <p>
559 swift 1.6 Continue with <uri link="?part=1&amp;chap=5">Installing the Gentoo
560 swift 1.1 Installation Files</uri>.
561     </p>
562    
563     </body>
564     </section>
565     </sections>

  ViewVC Help
Powered by ViewVC 1.1.20