ハンドブック:HPPA/ブロック/ディスク

From Gentoo Wiki
Jump to: navigation, search
This page is a translated version of the page Handbook:HPPA/Blocks/Disks and the translation is 100% complete.


パーティションとスライス

理論的にはディスク全体をLinuxシステムに使用することが出来ますが、実際にはほとんど行われません。その代わりに、ディスクブロックデバイス全体を小さく、より扱いやすいブロックデバイスに分割します。ほとんどのシステムでは、これはパーティションと呼ばれます。スライスと呼ばれる、似た技術を使用するアーキテクチャも存在します。

Designing a partition scheme

How many partitions and how big?

The number of partitions is highly dependent on the environment. For instance, if there are lots of users, then it is advised to have /home/ separate as it increases security and makes backups easier. If Gentoo is being installed to perform as a mail server, then /var/ should be separate as all mails are stored inside /var/. A good choice of filesystem will then maximize the performance. Game servers will have a separate /opt/ as most gaming servers are installed there. The reason is similar for the /home/ directory: security and backups. In most situations, /usr/ is to be kept big: not only will it contain the majority of applications, it typically also hosts the Gentoo ebuild repository (by default located at /var/db/repos/gentoo) which already takes around 650 MiB. This disk space estimate excludes the binpkgs/ and distfiles/ directories that are stored under /var/cache/ by default.

It very much depends on what the administrator wants to achieve. Separate partitions or volumes have the following advantages:

  • Choose the best performing filesystem for each partition or volume.
  • The entire system cannot run out of free space if one defunct tool is continuously writing files to a partition or volume.
  • If necessary, file system checks are reduced in time, as multiple checks can be done in parallel (although this advantage is more with multiple disks than it is with multiple partitions).
  • Security can be enhanced by mounting some partitions or volumes read-only, nosuid (setuid bits are ignored), noexec (executable bits are ignored), etc.

However, multiple partitions have disadvantages as well. If not configured properly, the system might have lots of free space on one partition and none on another. Another nuisance is that separate partitions - especially for important mount points like /usr/ or /var/ - often require the administrator to boot with an initramfs to mount the partition before other boot scripts start. This isn't always the case though, so results may vary.

There is also a 15-partition limit for SCSI and SATA unless the disk uses GPT labels.

What about swap space?

There is no perfect value for the swap partition. The purpose of swap space is to provide disk storage to the kernel when internal memory (RAM) is under pressure. A swap space allows for the kernel to move memory pages that are not likely to be accessed soon to disk (swap or page-out), freeing memory. Of course, if that memory is suddenly needed, these pages need to be put back in memory (page-in) which will take a while (as disks are very slow compared to internal memory).

When the system is not going to run memory intensive applications or the system has lots of memory available, then it probably does not need much swap space. However, swap space is also used to store the entire memory in case of hibernation. If the system is going to need hibernation, then a bigger swap space is necessary, often at least the amount of memory installed in the system.


HPPAでのfdiskの使用

必要なパーティションを作成するのにfdiskを使用してください:

root #fdisk /dev/sda

HPPAのマシンは、PC標準のDOSパーティションテーブルを使用します。新しいDOSパーティションテーブルを作成するために、oキーを押してください。

Command (m for help):o
Building a new DOS disklabel.

PALO(HPPAのブートローダ)は、動作するために特別なパーティションを必要とします。PALO用に、ディスクの先頭に最低16MBのパーティションを作成する必要があります。パーティションの種類はf0(Linux/PA-RISC boot)でなければなりません。

重要
もしこれを忘れ、特別なPALOパーティションなしでインストールが進んでしまうと、結局システムは再スタートに失敗するでしょう。また、もしディスクが2GB以上ある場合、ブートパーティションは確実にディスクの最初の2GB以内に収めてください。PALOは2GB以降のカーネルを読み込むことが出来ません。
FILE /etc/fstab単純でデフォルトのパーティション設計
/dev/sda2    /boot   ext2    noauto,noatime   1 1
/dev/sda3    none    swap    sw               0 0
/dev/sda4    /       ext4    noatime          0 0

fdiskでは、このようなパーティションレイアウトなら以下のような出力になるでしょう:

Command (m for help):p
Disk /dev/sda: 4294 MB, 4294816768 bytes
133 heads, 62 sectors/track, 1017 cylinders
Units = cylinders of 8246 * 512 = 4221952 bytes
  
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1           8       32953   f0  Linux/PA-RISC boot
/dev/sda2               9          20       49476   83  Linux
/dev/sda3              21          70      206150   82  Linux swap
/dev/sda4              71        1017     3904481   83  Linux