| 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-hppa-disk.xml,v 1.28 2011/09/17 12:16:09 swift Exp $ --> |
| 8 |
|
| 9 |
<sections> |
| 10 |
|
| 11 |
<version>12</version> |
| 12 |
<date>2011-10-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 and Slices</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 most systems, these |
| 29 |
are called <e>partitions</e>. Other architectures use a similar technique, |
| 30 |
called <e>slices</e>. |
| 31 |
</p> |
| 32 |
|
| 33 |
</body> |
| 34 |
</subsection> |
| 35 |
</section> |
| 36 |
<section> |
| 37 |
<title>Designing a Partitioning Scheme</title> |
| 38 |
<subsection> |
| 39 |
<title>How Many and How Big?</title> |
| 40 |
<body> |
| 41 |
|
| 42 |
<p> |
| 43 |
The number of partitions is highly dependent on your environment. For instance, |
| 44 |
if you have lots of users, you will most likely want to have your |
| 45 |
<path>/home</path> separate as it increases security and makes backups easier. |
| 46 |
If you are installing Gentoo to perform as a mailserver, your <path>/var</path> |
| 47 |
should be separate as all mails are stored inside <path>/var</path>. A good |
| 48 |
choice of filesystem will then maximise your performance. Gameservers will have |
| 49 |
a separate <path>/opt</path> as most gaming servers are installed there. The |
| 50 |
reason is similar for <path>/home</path>: security and backups. You will |
| 51 |
definitely want to keep <path>/usr</path> big: not only will it contain the |
| 52 |
majority of applications, the Portage tree alone takes around 500 Mbyte |
| 53 |
excluding the various sources that are stored in it. |
| 54 |
</p> |
| 55 |
|
| 56 |
<p> |
| 57 |
As you can see, it very much depends on what you want to achieve. Separate |
| 58 |
partitions or volumes have the following advantages: |
| 59 |
</p> |
| 60 |
|
| 61 |
<ul> |
| 62 |
<li> |
| 63 |
You can choose the best performing filesystem for each partition or volume |
| 64 |
</li> |
| 65 |
<li> |
| 66 |
Your entire system cannot run out of free space if one defunct tool is |
| 67 |
continuously writing files to a partition or volume |
| 68 |
</li> |
| 69 |
<li> |
| 70 |
If necessary, file system checks are reduced in time, as multiple checks can |
| 71 |
be done in parallel (although this advantage is more with multiple disks than |
| 72 |
it is with multiple partitions) |
| 73 |
</li> |
| 74 |
<li> |
| 75 |
Security can be enhanced by mounting some partitions or volumes read-only, |
| 76 |
nosuid (setuid bits are ignored), noexec (executable bits are ignored) etc. |
| 77 |
</li> |
| 78 |
</ul> |
| 79 |
|
| 80 |
<p> |
| 81 |
However, multiple partitions have disadvantages as well. If not configured |
| 82 |
properly, you will have a system with lots of free space on one partition and |
| 83 |
none on another. Another nuisance is that separate partitions - especially |
| 84 |
for important mountpoints like <path>/usr</path> or <path>/var</path> - often |
| 85 |
require the administrator to boot with an initramfs to mount the partition |
| 86 |
before other boot scripts start. This isn't always the case though, so YMMV. |
| 87 |
</p> |
| 88 |
|
| 89 |
<p> |
| 90 |
There is also a 15-partition limit for SCSI and SATA. |
| 91 |
</p> |
| 92 |
|
| 93 |
</body> |
| 94 |
</subsection> |
| 95 |
</section> |
| 96 |
<section> |
| 97 |
<title>Using fdisk on HPPA to Partition your Disk</title> |
| 98 |
<body> |
| 99 |
|
| 100 |
<p> |
| 101 |
Use <c>fdisk</c> to create the partitions you want: |
| 102 |
</p> |
| 103 |
|
| 104 |
<pre caption="Partitioning the disk"> |
| 105 |
# <i>fdisk /dev/sda</i> |
| 106 |
</pre> |
| 107 |
|
| 108 |
<p> |
| 109 |
HPPA machines use the PC standard DOS partition tables. To create a new |
| 110 |
DOS partition table, simply use the <c>o</c> command. |
| 111 |
</p> |
| 112 |
|
| 113 |
<pre caption="Creating a DOS partition table"> |
| 114 |
# <i>fdisk /dev/sda</i> |
| 115 |
|
| 116 |
Command (m for help): <i>o</i> |
| 117 |
Building a new DOS disklabel. |
| 118 |
</pre> |
| 119 |
|
| 120 |
<p> |
| 121 |
PALO (the HPPA bootloader) needs a special partition to work. You have |
| 122 |
to create a partition of at least 16MB at the beginning of your disk. |
| 123 |
The partition type must be of type <e>f0</e> (Linux/PA-RISC boot). |
| 124 |
</p> |
| 125 |
|
| 126 |
<impo> |
| 127 |
If you ignore this and continue without a special PALO partition, your system |
| 128 |
will stop loving you and fail to start. Also, if your disk is larger than 2GB, |
| 129 |
make sure that the boot partition is in the first 2GB of your disk. PALO is |
| 130 |
unable to read a kernel after the 2GB limit. |
| 131 |
</impo> |
| 132 |
|
| 133 |
<pre caption="A simple default partition scheme"> |
| 134 |
# <i>cat /etc/fstab</i> |
| 135 |
/dev/sda2 /boot ext3 noauto,noatime 1 1 |
| 136 |
/dev/sda3 none swap sw 0 0 |
| 137 |
/dev/sda4 / ext3 noatime 0 0 |
| 138 |
|
| 139 |
# <i>fdisk /dev/sda</i> |
| 140 |
|
| 141 |
Command (m for help): <i>p</i> |
| 142 |
|
| 143 |
Disk /dev/sda: 4294 MB, 4294816768 bytes |
| 144 |
133 heads, 62 sectors/track, 1017 cylinders |
| 145 |
Units = cylinders of 8246 * 512 = 4221952 bytes |
| 146 |
|
| 147 |
Device Boot Start End Blocks Id System |
| 148 |
/dev/sda1 1 8 32953 f0 Linux/PA-RISC boot |
| 149 |
/dev/sda2 9 20 49476 83 Linux |
| 150 |
/dev/sda3 21 70 206150 82 Linux swap |
| 151 |
/dev/sda4 71 1017 3904481 83 Linux |
| 152 |
</pre> |
| 153 |
|
| 154 |
<p> |
| 155 |
Now that your partitions are created, you can continue with <uri |
| 156 |
link="#filesystems">Creating Filesystems</uri>. |
| 157 |
</p> |
| 158 |
|
| 159 |
</body> |
| 160 |
</section> |
| 161 |
<section id="filesystems"> |
| 162 |
<title>Creating Filesystems</title> |
| 163 |
<subsection> |
| 164 |
<title>Introduction</title> |
| 165 |
<body> |
| 166 |
|
| 167 |
<p> |
| 168 |
Now that your partitions are created, it is time to place a filesystem on them. |
| 169 |
If you don't care about what filesystem to choose and are happy with what we use |
| 170 |
as default in this handbook, continue with <uri |
| 171 |
link="#filesystems-apply">Applying a Filesystem to a Partition</uri>. |
| 172 |
Otherwise read on to learn about the available filesystems... |
| 173 |
</p> |
| 174 |
|
| 175 |
</body> |
| 176 |
</subsection> |
| 177 |
|
| 178 |
<subsection> |
| 179 |
<include href="hb-install-filesystems.xml"/> |
| 180 |
</subsection> |
| 181 |
|
| 182 |
<subsection id="filesystems-apply"> |
| 183 |
<title>Applying a Filesystem to a Partition</title> |
| 184 |
<body> |
| 185 |
|
| 186 |
<p> |
| 187 |
To create a filesystem on a partition or volume, there are tools available for |
| 188 |
each possible filesystem: |
| 189 |
</p> |
| 190 |
|
| 191 |
<table> |
| 192 |
<tr> |
| 193 |
<th>Filesystem</th> |
| 194 |
<th>Creation Command</th> |
| 195 |
</tr> |
| 196 |
<tr> |
| 197 |
<ti>ext2</ti> |
| 198 |
<ti><c>mkfs.ext2</c></ti> |
| 199 |
</tr> |
| 200 |
<tr> |
| 201 |
<ti>ext3</ti> |
| 202 |
<ti><c>mkfs.ext3</c></ti> |
| 203 |
</tr> |
| 204 |
<tr> |
| 205 |
<ti>ext4</ti> |
| 206 |
<ti><c>mkfs.ext4</c></ti> |
| 207 |
</tr> |
| 208 |
<tr> |
| 209 |
<ti>reiserfs</ti> |
| 210 |
<ti><c>mkreiserfs</c></ti> |
| 211 |
</tr> |
| 212 |
<tr> |
| 213 |
<ti>xfs</ti> |
| 214 |
<ti><c>mkfs.xfs</c></ti> |
| 215 |
</tr> |
| 216 |
<tr> |
| 217 |
<ti>jfs</ti> |
| 218 |
<ti><c>mkfs.jfs</c></ti> |
| 219 |
</tr> |
| 220 |
</table> |
| 221 |
|
| 222 |
<p> |
| 223 |
For instance, to have the boot partition (<path>/dev/sda2</path> in our |
| 224 |
example) in ext2 and the root partition (<path>/dev/sda4</path> in our example) |
| 225 |
in ext3 (as in our example), you would use: |
| 226 |
</p> |
| 227 |
|
| 228 |
<pre caption="Applying a filesystem on a partition"> |
| 229 |
# <i>mkfs.ext2 /dev/sda2</i> |
| 230 |
# <i>mkfs.ext3 /dev/sda4</i> |
| 231 |
</pre> |
| 232 |
|
| 233 |
<p> |
| 234 |
Now create the filesystems on your newly created partitions (or logical |
| 235 |
volumes). |
| 236 |
</p> |
| 237 |
|
| 238 |
</body> |
| 239 |
</subsection> |
| 240 |
<subsection> |
| 241 |
<title>Activating the Swap Partition</title> |
| 242 |
<body> |
| 243 |
|
| 244 |
<p> |
| 245 |
<c>mkswap</c> is the command that is used to initialize swap partitions: |
| 246 |
</p> |
| 247 |
|
| 248 |
<pre caption="Creating a Swap signature"> |
| 249 |
# <i>mkswap /dev/sda3</i> |
| 250 |
</pre> |
| 251 |
|
| 252 |
<p> |
| 253 |
To activate the swap partition, use <c>swapon</c>: |
| 254 |
</p> |
| 255 |
|
| 256 |
<pre caption="Activating the swap partition"> |
| 257 |
# <i>swapon /dev/sda3</i> |
| 258 |
</pre> |
| 259 |
|
| 260 |
<p> |
| 261 |
Create and activate the swap with the commands mentioned above. |
| 262 |
</p> |
| 263 |
|
| 264 |
</body> |
| 265 |
</subsection> |
| 266 |
</section> |
| 267 |
<section> |
| 268 |
<title>Mounting</title> |
| 269 |
<body> |
| 270 |
|
| 271 |
<p> |
| 272 |
Now that your partitions are initialized and are housing a filesystem, it is |
| 273 |
time to mount those partitions. Use the <c>mount</c> command. Don't forget to |
| 274 |
create the necessary mount directories for every partition you created. As an |
| 275 |
example we mount the root and boot partition: |
| 276 |
</p> |
| 277 |
|
| 278 |
<pre caption="Mounting partitions"> |
| 279 |
# <i>mount /dev/sda4 /mnt/gentoo</i> |
| 280 |
# <i>mkdir /mnt/gentoo/boot</i> |
| 281 |
# <i>mount /dev/sda2 /mnt/gentoo/boot</i> |
| 282 |
</pre> |
| 283 |
|
| 284 |
<note> |
| 285 |
If you want your <path>/tmp</path> to reside on a separate partition, be sure |
| 286 |
to change its permissions after mounting: <c>chmod 1777 /mnt/gentoo/tmp</c>. |
| 287 |
This also holds for <path>/var/tmp</path>. |
| 288 |
</note> |
| 289 |
|
| 290 |
<p> |
| 291 |
We will also have to mount the proc filesystem (a virtual interface with the |
| 292 |
kernel) on <path>/proc</path>. But first we will need to place our files on the |
| 293 |
partitions. |
| 294 |
</p> |
| 295 |
|
| 296 |
<p> |
| 297 |
Continue with <uri link="?part=1&chap=5">Installing the Gentoo |
| 298 |
Installation Files</uri>. |
| 299 |
</p> |
| 300 |
|
| 301 |
</body> |
| 302 |
</section> |
| 303 |
</sections> |