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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.21 - (show annotations) (download) (as text)
Tue Aug 2 08:03:53 2005 UTC (9 years, 3 months ago) by swift
Branch: MAIN
Changes since 1.20: +5 -4 lines
File MIME type: application/xml
#101034 - Adding "-O dir_index" information to the guide

Leaving it out of the real example mke2fs command to "stage" it. When we know
more about this b-tree stability and architectural support we can follow the
SPARC handbook and use it by default.

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-sparc-disk.xml,v 1.20 2005/06/10 18:15:33 swift Exp $ -->
8
9 <sections>
10
11 <version>2.3</version>
12 <date>2005-08-02</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 some of the disk-oriented aspects of Gentoo Linux
22 and Linux in general, including Linux filesystems, partitions, and block
23 devices. Then, once you're familiar with the ins and outs of disks and
24 filesystems, you'll be guided through the process of setting up partitions
25 and filesystems for your Gentoo Linux installation.
26 </p>
27
28 <p>
29 To begin, we introduce <e>block devices</e>. The most typical block device is
30 probably the one that represents the first SCSI hard disk in a Linux system,
31 namely <path>/dev/sda</path>.
32 </p>
33
34 <p>
35 Block devices represent an abstract interface to the disk. User programs can
36 use these block devices to interact with your disk without worrying about
37 whether your drives are IDE, SCSI, or something else. The program can simply
38 address the storage on the disk as a bunch of contiguous, randomly-accessible
39 512-byte blocks.
40 </p>
41
42 <p>
43 Block devices show up as entries in <path>/dev/</path>. Typically, the first
44 SCSI drive is named <path>/dev/sda</path>, the second <path>/dev/sdb</path>,
45 and so on. IDE drives are named similarly, however, they are prefixed by hd-
46 instead of sd-. If you are using IDE drives, the first one will be named
47 <path>/dev/hda</path>, the second <path>/dev/hdb</path>, and so on.
48 </p>
49
50 </body>
51 </subsection>
52 <subsection>
53 <title>Partitions</title>
54 <body>
55
56 <p>
57 Although it is theoretically possible to use the entire disk to house your Linux
58 system, this is almost never done in practice. Instead, full disk block devices
59 are split up in smaller, more manageable block devices. These are known as
60 <e>partitions</e> or <e>slices</e>.
61 </p>
62
63 <p>
64 The first partition on the first SCSI disk is <path>/dev/sda1</path>, the second
65 <path>/dev/sda2</path> and so on. Similarly, the first two partitions on the
66 first IDE disk are <path>/dev/hda1</path> and <path>/dev/hda2</path>.
67 </p>
68
69 <p>
70 The third partition on Sun systems is set aside as a special "whole disk"
71 slice. This partition must not contain a file system.
72 </p>
73
74 <p>
75 Users who are used to the DOS partitioning scheme should note that Sun
76 disklabels do not have "primary" and "extended" partitions. Instead, up to
77 eight partitions are available per drive, with the third of these being
78 reserved.
79 </p>
80
81 </body>
82 </subsection>
83 </section>
84 <section>
85 <title>Designing a Partitioning Scheme</title>
86 <subsection>
87 <title>Default Partitioning Scheme</title>
88 <body>
89
90 <p>
91 If you are not interested in drawing up a partitioning scheme,
92 the table below suggests a suitable starting point for most systems. For
93 IDE-based systems, substitute <c>hda</c> for <c>sda</c> in the following.
94 </p>
95
96 <p>
97 Note that a separate <path>/boot</path> partition is generally <e>not</e>
98 recommended on SPARC, as it complicates the bootloader configuration.
99 </p>
100
101 <table>
102 <tr>
103 <th>Partition</th>
104 <th>Filesystem</th>
105 <th>Size</th>
106 <th>Mount Point</th>
107 <th>Description</th>
108 </tr>
109 <tr>
110 <ti>/dev/sda1</ti>
111 <ti>ext3</ti>
112 <ti>&lt;2 GByte</ti>
113 <ti>/</ti>
114 <ti>
115 Root partition. For all sparc32 systems, and sparc64 systems with older
116 OBP versions, this <e>must</e> be less than 2 GBytes in size, and the first
117 partition on the disk.
118 </ti>
119 </tr>
120 <tr>
121 <ti>/dev/sda2</ti>
122 <ti>swap</ti>
123 <ti>512 MBytes</ti>
124 <ti>none</ti>
125 <ti>
126 Swap partition. For bootstrap and certain larger compiles, at least 512
127 MBytes of RAM (including swap) is required.
128 </ti>
129 </tr>
130 <tr>
131 <ti>/dev/sda3</ti>
132 <ti>none</ti>
133 <ti>Whole disk</ti>
134 <ti>none</ti>
135 <ti>Whole disk partition. This is required on SPARC systems.</ti>
136 </tr>
137 <tr>
138 <ti>/dev/sda4</ti>
139 <ti>ext3</ti>
140 <ti>at least 2 GBytes</ti>
141 <ti>/usr</ti>
142 <ti>
143 /usr partition. Applications are installed here. By default this partition
144 is also used for Portage data (which takes around 500 Mbyte excluding
145 source code).
146 </ti>
147 </tr>
148 <tr>
149 <ti>/dev/sda5</ti>
150 <ti>ext3</ti>
151 <ti>at least 1GByte</ti>
152 <ti>/var</ti>
153 <ti>
154 /var partition. Used for program-generated data. By default Portage uses
155 this partition for temporary space whilst compiling. Certain larger
156 applications such as Mozilla and OpenOffice.org can require over 1 GByte
157 of temporary space here when building.
158 </ti>
159 </tr>
160 <tr>
161 <ti>/dev/sda6</ti>
162 <ti>ext3</ti>
163 <ti>remaining space</ti>
164 <ti>/home</ti>
165 <ti>/home partition. Used for users' home directories.</ti>
166 </tr>
167 </table>
168
169 </body>
170 </subsection>
171 </section>
172
173 <section id="fdisk">
174 <title>Using fdisk to Partition your Disk</title>
175 <subsection>
176 <body>
177
178 <p>
179 The following parts explain how to create the example partition layout described
180 previously, namely:
181 </p>
182
183 <table>
184 <tr>
185 <th>Partition</th>
186 <th>Description</th>
187 </tr>
188 <tr>
189 <ti>/dev/sda1</ti>
190 <ti>/</ti>
191 </tr>
192 <tr>
193 <ti>/dev/sda2</ti>
194 <ti>swap</ti>
195 </tr>
196 <tr>
197 <ti>/dev/sda3</ti>
198 <ti>whole disk slice</ti>
199 </tr>
200 <tr>
201 <ti>/dev/sda4</ti>
202 <ti>/usr</ti>
203 </tr>
204 <tr>
205 <ti>/dev/sda5</ti>
206 <ti>/var</ti>
207 </tr>
208 <tr>
209 <ti>/dev/sda6</ti>
210 <ti>/home</ti>
211 </tr>
212 </table>
213
214 <p>
215 Change the partition layout as required. Remember to keep the root partition
216 entirely within the first 2 GBytes of the disk for older systems. There is also
217 a 15-partition limit for SCSI and SATA.
218 </p>
219
220 </body>
221 </subsection>
222 <subsection>
223 <title>Firing up fdisk</title>
224 <body>
225
226 <p>
227 Start <c>fdisk</c> with your disk as argument:
228 </p>
229
230 <pre caption="Starting fdisk">
231 # <i>fdisk /dev/sda</i>
232 </pre>
233
234 <p>
235 You should be greeted with the fdisk prompt:
236 </p>
237
238 <pre caption="The fdisk prompt">
239 Command (m for help):
240 </pre>
241
242 <p>
243 To view the available partitions, type in <c>p</c>:
244 </p>
245
246 <pre caption="Listing available partitions">
247 Command (m for help): <i>p</i>
248
249 Disk /dev/sda (Sun disk label): 64 heads, 32 sectors, 8635 cylinders
250 Units = cylinders of 2048 * 512 bytes
251
252 Device Flag Start End Blocks Id System
253 /dev/sda1 0 488 499712 83 Linux native
254 /dev/sda2 488 976 499712 82 Linux swap
255 /dev/sda3 0 8635 8842240 5 Whole disk
256 /dev/sda4 976 1953 1000448 83 Linux native
257 /dev/sda5 1953 2144 195584 83 Linux native
258 /dev/sda6 2144 8635 6646784 83 Linux native
259 </pre>
260
261 <p>
262 Note the <c>Sun disk label</c> in the output. If this is missing, the disk is
263 using the DOS-partitioning, not the Sun partitioning. In this case, use <c>s</c>
264 to ensure that the disk has a sun partition table:
265 </p>
266
267 <pre caption="Creating a Sun Disklabel">
268 Command (m for help): s
269 Building a new sun disklabel. Changes will remain in memory only,
270 until you decide to write them. After that, of course, the previous
271 content won't be recoverable.
272
273 Drive type
274 ? auto configure
275 0 custom (with hardware detected defaults)
276 a Quantum ProDrive 80S
277 b Quantum ProDrive 105S
278 c CDC Wren IV 94171-344
279 d IBM DPES-31080
280 e IBM DORS-32160
281 f IBM DNES-318350
282 g SEAGATE ST34371
283 h SUN0104
284 i SUN0207
285 j SUN0327
286 k SUN0340
287 l SUN0424
288 m SUN0535
289 n SUN0669
290 o SUN1.0G
291 p SUN1.05
292 q SUN1.3G
293 r SUN2.1G
294 s IOMEGA Jaz
295 Select type (? for auto, 0 for custom): <i>0</i>
296 Heads (1-1024, default 64):
297 Using default value 64
298 Sectors/track (1-1024, default 32):
299 Using default value 32
300 Cylinders (1-65535, default 8635):
301 Using default value 8635
302 Alternate cylinders (0-65535, default 2):
303 Using default value 2
304 Physical cylinders (0-65535, default 8637):
305 Using default value 8637
306 Rotation speed (rpm) (1-100000, default 5400): <i>10000</i>
307 Interleave factor (1-32, default 1):
308 Using default value 1
309 Extra sectors per cylinder (0-32, default 0):
310 Using default value 0
311 </pre>
312
313 <p>
314 You can find the correct values in your disk's documentation. The
315 'auto configure' option does not usually work.
316 </p>
317
318 </body>
319 </subsection>
320 <subsection>
321 <title>Deleting Existing Partitions</title>
322 <body>
323
324 <p>
325 It's time to delete any existing partitions. To do this, type <c>d</c> and hit
326 Enter. You will then be prompted for the partition number you would like to
327 delete. To delete a pre-existing <path>/dev/sda1</path>, you would type:
328 </p>
329
330 <pre caption="Deleting a partition">
331 Command (m for help): <i>d</i>
332 Partition number (1-4): <i>1</i>
333 </pre>
334
335 <p>
336 <e>You should not delete partition 3 (whole disk).</e> This is required. If
337 this partition does not exist, follow the "Creating a Sun Disklabel"
338 instructions above.
339 </p>
340
341 <p>
342 After deleting all partitions except the Whole disk slice, you should have a
343 partition layout similar to the following:
344 </p>
345
346 <pre caption="View an empty partition scheme">
347 Command (m for help): <i>p</i>
348
349 Disk /dev/sda (Sun disk label): 64 heads, 32 sectors, 8635 cylinders
350 Units = cylinders of 2048 * 512 bytes
351
352 Device Flag Start End Blocks Id System
353 /dev/sda3 0 8635 8842240 5 Whole disk
354 </pre>
355
356
357 </body>
358 </subsection>
359
360 <subsection>
361 <title>Creating the Root Partition</title>
362 <body>
363
364 <p>
365 We're ready to create the root partition. To do this, type <c>n</c> to create a
366 new partition, then type <c>1</c> to create the partition. When prompted for the
367 first cylinder, hit enter. When prompted for the last cylinder, type <c>+512M</c>
368 to create a partition <c>512MBytes</c> in size. Make sure that the entire root
369 partition must be contained entirely within the first 2GBytes of the disk.
370 You can see output from these steps below:
371 </p>
372
373 <pre caption="Creating a root partition">
374 Command (m for help): <i>n</i>
375 Partition number (1-8): <i>1</i>
376 First cylinder (0-8635): <i>(press Enter)</i>
377 Last cylinder or +size or +sizeM or +sizeK (0-8635, default 8635): <i>+512M</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="Listing the partition layout">
385 Command (m for help): <i>p</i>
386
387 Disk /dev/sda (Sun disk label): 64 heads, 32 sectors, 8635 cylinders
388 Units = cylinders of 2048 * 512 bytes
389
390 Device Flag Start End Blocks Id System
391 /dev/sda1 0 488 499712 83 Linux native
392 /dev/sda3 0 8635 8842240 5 Whole disk
393 </pre>
394
395 </body>
396 </subsection>
397 <subsection>
398 <title>Creating a swap partition</title>
399 <body>
400
401 <p>
402 Next, let's create the swap partition. To do this, type <c>n</c> to create a new
403 partition, then <c>2</c> to create the second partition, <path>/dev/sda2</path>
404 in our case. When prompted for the first cylinder, hit enter. When prompted for
405 the last cylinder, type <c>+512M</c> to create a partition 512MB in size. After
406 you've done this, type <c>t</c> to set the partition type, and then type in
407 <c>82</c> to set the partition type to "Linux Swap". After completing these
408 steps, typing <c>p</c> should display a partition table that looks similar to
409 this:
410 </p>
411
412 <pre caption="Listing of available partitions">
413 Command (m for help): <i>p</i>
414
415 Disk /dev/sda (Sun disk label): 64 heads, 32 sectors, 8635 cylinders
416 Units = cylinders of 2048 * 512 bytes
417
418 Device Flag Start End Blocks Id System
419 /dev/sda1 0 488 499712 83 Linux native
420 /dev/sda2 488 976 499712 82 Linux swap
421 /dev/sda3 0 8635 8842240 5 Whole disk
422 </pre>
423
424 </body>
425 </subsection>
426 <subsection>
427 <title>Creating the /usr, /var and /home partitions</title>
428 <body>
429
430 <p>
431 Finally, let's create the /usr, /var and /home partitions. As before,
432 type <c>n</c> to create a new partition, then type <c>4</c> to create the
433 third partition, <path>/dev/sda4</path> in our case. When prompted for the
434 first cylinder, hit enter. When prompted for the last cylinder, enter
435 <c>+2048M</c> to create a partition 2 GBytes in size. Repeat this process
436 for <path>sda5</path> and <path>sda6</path>, using the desired sizes. Once
437 you're done, you should see something like this:
438 </p>
439
440 <pre caption="Listing complete partition table">
441 Command (m for help): <i>p</i>
442
443 Disk /dev/sda (Sun disk label): 64 heads, 32 sectors, 8635 cylinders
444 Units = cylinders of 2048 * 512 bytes
445
446 Device Flag Start End Blocks Id System
447 /dev/sda1 0 488 499712 83 Linux native
448 /dev/sda2 488 976 499712 82 Linux swap
449 /dev/sda3 0 8635 8842240 5 Whole disk
450 /dev/sda4 976 1953 1000448 83 Linux native
451 /dev/sda5 1953 2144 195584 83 Linux native
452 /dev/sda6 2144 8635 6646784 83 Linux native
453 </pre>
454
455 </body>
456 </subsection>
457 <subsection>
458 <title>Save and Exit</title>
459 <body>
460
461 <p>
462 To save your partition layout and exit <c>fdisk</c>, type <c>w</c>:
463 </p>
464
465 <pre caption="Save and exit fdisk">
466 Command (m for help): <i>w</i>
467 </pre>
468
469 <p>
470 Now that your partitions are created, you can now continue with <uri
471 link="#filesystems">Creating Filesystems</uri>.
472 </p>
473
474 </body>
475 </subsection>
476 </section>
477 <section id="filesystems">
478 <title>Creating Filesystems</title>
479 <subsection>
480 <title>Introduction</title>
481 <body>
482
483 <p>
484 Now that your partitions are created, it is time to place a filesystem on them.
485 If you don't care about what filesystem to choose and are happy with what is
486 used as default in this handbook, continue with <uri
487 link="#filesystems-apply">Applying a Filesystem to a Partition</uri>.
488 Otherwise, read on to learn about the available filesystems...
489 </p>
490
491 </body>
492 </subsection>
493 <subsection>
494 <title>Filesystems?</title>
495 <body>
496
497 <p>
498 Several filesystems are available, some are known to be stable on the
499 SPARC architecture. Ext2 and ext3, for example, are known to work well.
500 Alternate filesystems may not function correctly.
501 </p>
502
503 <p>
504 <b>ext2</b> is the tried-and-true Linux filesystem. It does not support
505 journaling, which means that periodic checks of ext2 filesystems at startup
506 can be quite time-consuming. There is quite a selection of newer-generation
507 journaled filesystems that can be checked for consistency very quickly at
508 startup, and are therefore generally preferred over their non-journaled
509 counterparts. In general, journaled filesystems prevent long delays when a
510 system is booted and the filesystem is in an inconsistent state.
511 </p>
512
513 <p>
514 <b>ext3</b> is the journaled version of the ext2 filesystem. It provides
515 metadata journaling for fast recovery as well as other enhanced journaling
516 modes like full-data and ordered-data journaling. Ext3 has an additional hashed
517 b-tree indexing option that enables high performance in almost all situations.
518 You can enable this indexing by adding <c>-O dir_index</c> to the <c>mke2fs</c>
519 command. Ext3 makes an excellent and reliable alternative to ext2.
520 </p>
521
522 </body>
523 </subsection>
524 <subsection id="filesystems-apply">
525 <title>Applying a Filesystem to a Partition</title>
526 <body>
527
528 <p>
529 To create a filesystem on a partition or volume, tools specific to the chosen
530 filesystem are available:
531 </p>
532
533 <table>
534 <tr>
535 <th>Filesystem</th>
536 <th>Creation Command</th>
537 </tr>
538 <tr>
539 <ti>ext2</ti>
540 <ti><c>mke2fs</c></ti>
541 </tr>
542 <tr>
543 <ti>ext3</ti>
544 <ti><c>mke2fs -j</c></ti>
545 </tr>
546 <tr>
547 <ti>ext3 with hashed b-tree indexing (2.6 kernels only)</ti>
548 <ti><c>mke2fs -j -O dir_index</c></ti>
549 </tr>
550 </table>
551
552 <p>
553 For instance, to create the root partition (<path>/dev/sda1</path> in our
554 example) as ext2, and the <path>/usr</path>, <path>/var</path>, and
555 <path>/home</path> partitions (<path>/dev/sda4</path>, <path>5</path>
556 and <path>6</path> in our example, respectively) as ext3, you would use:
557 </p>
558
559 <pre caption="Applying a filesystem on a partition">
560 # <i>mke2fs /dev/sda1</i>
561 # <i>mke2fs -j /dev/sda4</i>
562 # <i>mke2fs -j /dev/sda5</i>
563 # <i>mke2fs -j /dev/sda6</i>
564 </pre>
565
566 </body>
567 </subsection>
568 <subsection>
569 <title>Activating the Swap Partition</title>
570 <body>
571
572 <p>
573 <c>mkswap</c> is the command used to initialize swap partitions:
574 </p>
575
576 <pre caption="Creating a Swap signature">
577 # <i>mkswap /dev/sda2</i>
578 </pre>
579
580 <p>
581 To activate the swap partition, use <c>swapon</c>:
582 </p>
583
584 <pre caption="Activating the swap partition">
585 # <i>swapon /dev/sda2</i>
586 </pre>
587
588 <p>
589 Create and activate the swap with the commands mentioned above.
590 </p>
591
592 </body>
593 </subsection>
594 </section>
595 <section>
596 <title>Mounting</title>
597 <body>
598
599 <p>
600 Now that your partitions are initialized and are housing a filesystem, it is
601 time to mount them using the <c>mount</c> command. Don't forget to first
602 create the necessary mount directories for every partition you created. For
603 example:
604 </p>
605
606 <warn>
607 Due to a bug in the e2fsprogs package, you need to explicitly use
608 the <c>mount -t ext3</c> option if you are using an ext3 filesystem.
609 </warn>
610
611 <pre caption="Mounting partitions">
612 # <i>mount /dev/sda1 /mnt/gentoo</i>
613 # <i>mkdir /mnt/gentoo/usr</i>
614 # <i>mount /dev/sda4 /mnt/gentoo/usr</i>
615 # <i>mkdir /mnt/gentoo/var</i>
616 # <i>mount /dev/sda5 /mnt/gentoo/var</i>
617 # <i>mkdir /mnt/gentoo/home</i>
618 # <i>mount /dev/sda6 /mnt/gentoo/home</i>
619 </pre>
620
621 <note>
622 If you want your <path>/tmp</path> to reside on a separate partition, be sure
623 to change its permissions after mounting: <c>chmod 1777 /mnt/gentoo/tmp</c>.
624 This also holds for <path>/var/tmp</path>.
625 </note>
626
627 <p>
628 We will also have to mount the proc filesystem (a virtual interface with the
629 kernel) on <path>/proc</path>. But first we will need to place our files on the partitions.
630 </p>
631
632 <p>
633 Continue with <uri link="?part=1&amp;chap=5">Installing the Gentoo
634 Installation Files</uri>.
635 </p>
636
637 </body>
638 </section>
639 </sections>

  ViewVC Help
Powered by ViewVC 1.1.20