Handbook:SPARC/Blocks/Disks/ru

Таблица разделов
Although it is theoretically possible to use a raw, unpartitioned disk to house a Linux system (when creating a btrfs RAID for example), this is almost never done in practice. Instead, disk block devices are split up into smaller, more manageable block devices. On systems, these are called partitions. There are currently two standard partitioning technologies in use: Sun and GPT; the latter is supported only on more recent systems with a sufficiently recent firmware.

GUID Partition Table (GPT)
GUID Partition Table (GPT, таблица разделов GUID, также может называться GPT disklabel) использует 64-битные идентификаторы разделов. Место, в котором хранится информация о разделах, также гораздо больше, чем 512 байт таблицы разделов MBR (DOS disklabel), что означает, что нет почти никаких ограничений на количество разделов для диска с GPT. Также максимальный размер раздела был значительно увеличен (почти 8 ЗиБ — да, зебибайт).

Также GPT использует контрольные суммы и избыточность. Он содержит контрольные суммы CRC32 для обнаружения ошибок в заголовке и таблице разделов. У GPT есть резервная таблица в конце диска. Её можно использовать для восстановления первичной таблицы GPT, которая располагается в начале диска.

GPT is only supported on Oracle SPARC machines of the T4 generation or newer. Additionally, only certain more recent firmware includes GPT support. There are several methods to check whether GPT support is available.

From the OBP prompt, execute:

If is included in the output, then GPT support is available. Alternatively, this can be determined from the installation media without entering OBP. Use the command from  to access this information from userspace:

Or, check if the file exists. If none of these methods succeeds, then a firmware update is required in order to support GPT.

Sun partition table
Systems not manufactured by Oracle, T3 or earlier systems, or systems running an earlier firmware must use the Sun partition table type.

The third partition on Sun systems is set aside as a special "whole disk" slice. This partition must not contain a file system.

Users who are used to the DOS partitioning scheme should note that Sun partition tables do not have "primary" and "extended" partitions. Instead, up to eight partitions are available per drive, with the third of these being reserved.

The Handbook authors suggest using GPT whenever possible for Gentoo installations.

Default partitioning scheme
Due to the differences in required partition layout between GPT and Sun partition tables, a single partitioning scheme is not sufficient to support all possible system requirements. Some example schemes are provided below.

GPT partition scheme
The following partitioning scheme will be used as an example for GPT-formatted disks:

Sun formatted partition scheme
The following partitioning scheme will be used as an example for Sun-formatted disks:

Partitioning the disk with GPT
The following parts explain how to create the example partition layout for a GPT installation using. The example partition layout was mentioned earlier:

Change the partition layout according the system's needs.

Viewing the current partition layout
is a popular and powerful tool to split a disk into partitions. Fire up against the disk (in the example,  is used):

Use the key to display the disk's current partition configuration:

Creating a new disklabel and removing all existing partitions
Type to create a new GPT disklabel on the disk; this will remove all existing partitions.

For an existing GPT disklabel (see the output of above), alternatively consider removing the existing partitions one by one from the disk. Type to delete a partition. For instance, to delete an existing :

The partition has now been scheduled for deletion. It will no longer show up when printing the list of partitions (, but it will not be erased until the changes have been saved. This allows users to abort the operation if a mistake was made - in that case, type immediately and hit  and the partition will not be deleted.

Repeatedly type to print out a partition listing and then type  and the number of the partition to delete it. Eventually, the partition table will be empty:

Now that the in-memory partition table is empty, we're ready to create the partitions.

Creating the BIOS boot partition
First, create the BIOS boot partition. Type to create a new partition, followed by  to select the first partition. When prompted for the first sector, make sure it starts from 2048 (which may be needed for the boot loader) and hit. When prompted for the last sector, type +2M to create a partition 2 Mbyte in size:

Mark the partition as a BIOS boot partition:

Creating the swap partition
Next, to create the swap partition, type to create a new partition, then type  to create the second partition,. When prompted for the first sector, hit. When prompted for the last sector, type +4G (or any other size needed for the swap space) to create a partition 4 GiB in size.

After all this is done, type to set the partition type,  to select the partition just created and then type in 19 to set the partition type to "Linux Swap".

Creating the root partition
Finally, to create the root partition, type to create a new partition. Then type to create the third partition,. When prompted for the first sector, hit. When prompted for the last sector, hit to create a partition that takes up the rest of the remaining space on the disk. After completing these steps, typing should display a partition table that looks similar to this:

Saving the partition layout
To save the partition layout and exit, type.

With the partitions created, it is now time to put filesystems on them.

Partitioning the disk with a Sun partition table
The following parts explain how to create the example partition layout for a Sun partition table installation using. The example partition layout was mentioned earlier:

Change the partition layout according to personal preference. If partitioning for a system using OBP version 3 or earlier, ensure that the root partition is less than 2G in size, and additionally create partitions and onward for additional filesystems.

Viewing the current partition layout
is a popular and powerful tool to split a disk into partitions. Fire up against the disk (in our example, we use ):

Use the key to display the disk's current partition configuration:

Creating a new disklabel / removing all partitions
Type to create a new Sun disklabel on the disk; this will remove all existing partitions.

For an existing Sun disklabel (see the output of above), alternatively consider removing the existing partitions one by one from the disk. Type to delete a partition. For instance, to delete an existing :

The partition has now been scheduled for deletion. It will no longer show up when printing the list of partitions (, but it will not be erased until the changes have been saved. This allows users to abort the operation if a mistake was made - in that case, type immediately and hit  and the partition will not be deleted.

Repeatedly type to print out a partition listing and then type  and the number of the partition to delete it. Eventually, the partition table will be empty:

Now that the in-memory partition table is empty, we're ready to create the partitions.

Creating the whole disk partition
First, create the whole disk partition. Type to create a new partition, followed by  to select the third partition. When prompted for the first sector, hit. When prompted for the last sector, hit to create a partition that takes up all of the space on the disk.

will automatically set the type of such a partition to 'Whole disk', so there is no need to explicitly set the type.

Creating the root partition
Next, to create the root partition, type to create a new partition. Then type to create the third partition,. When prompted for the first sector, hit. When prompted for the last sector, type -4G (or whatever space is required for non-root partitions). After completing these steps, typing should display a partition table that looks similar to this:

Creating the swap partition
Finally, to create the swap partition, type to create a new partition, then type  to create the second partition,. When prompted for the first sector, hit. When prompted for the last sector, hit to take up the remaining space on the disk.

After all this is done, type to set the partition type,  to select the partition just created and then type in 82 to set the partition type to "Linux Swap".

After completing these steps, typing should display a partition table that looks similar to this:

Saving the partition layout
To save the partition layout and exit, type.

With the partitions created, it is now time to put filesystems on them.