Additional bytes pkhex how to use

Manual: Alpha / Installation / Hard disks

Introduction to block-oriented devices

Block-oriented devices

Let's look at the hard drive-specific aspects of Gentoo Linux and Linux in general - particularly Linux file systems, partitions, and block devices. Once you understand the pros and cons of hard drives and file systems, you can create partitions and file systems for Linux installation.

To start with, let's look at block-oriented devices. The most famous block device is probably the one that is the first drive on a Linux system, namely / dev / sda. SCSI and serial ATA drives are both named / dev / sd *. Even IDE drives are named this way with the libata framework in the kernel. When using the old device framework, the first IDE drive is / dev / hda.

The following table will help readers determine where to find a certain type of block device on the system:

Type of deviceDefault device handleEditorial notes and considerations
NVM Express (NVMe)/ dev / nvme0n1The latest in solid state technology, NVMe drives are connected to the PCI Express bus and have the fastest transfer block speeds on the market. Systems from around 2014 and newer may have support for NVMe hardware.
SATA, SAS, SCSI, or USB flash/ dev / sdaFound on hardware from roughly 2007 until the present, this device handle is perhaps the most commonly used in Linux. These types of devices can be connected via the SATA bus, SCSI, USB bus as block storage.
MMC, eMMC, and SD/ dev / mmcblk0Embedded MMC devices, SD cards, and other types of memory cards can be useful for data storage. That said, many systems may not permit booting from these types of devices. It is suggested to not use these devices for active Linux installations; rather consider using them to transfer files, which is their design goal. Alernatively they could be useful for short-term backups.
IDE / PATA/ dev / hdaOlder Linux kernel drivers for IDE / Parallel ATA hardware displayed rotational block storage devices connected to the IDE bus starting at this location. Generally these types of devices has been phased out of personal computers since the year 2003, which is when the computer industry standard shifted to SATA. Most systems with one IDE controller could support four devices (hdda-hdd).
Alternative naming for these older interfaces include Extended IDE (EIDE) and Ultra ATA (UATA).

The block-oriented devices mentioned above represent an abstract interface to the hard disk. User agents can use these block devices to interact with the hard drive without worrying about whether the hard drives are attached via IDE, SCSI, or something else. The program can simply address the memory on the hard disk as a collection of contiguous 512-byte blocks with random access.

Slices

Although it would theoretically be possible to use a full hard drive to accommodate a Linux system, this almost never happens in practice. Instead, complete hard disk block devices are divided into smaller, more manageable block devices. On Alpha systems, these will be Slices called.

note
In the following sections, the installation instructions use the example partitioning of the ARC / AlphaBIOS setup. Please adapt this to your personal ideas!

Design a partition scheme

How many partitions and how big?

The number of partitions depends heavily on the target environment. For example, if there are many users, a separate / home / partition is advisable as this increases security and simplifies backups. If Gentoo is installed to serve as a mail server, it should have its own / var / because all mail is stored in / var /. A good choice of file system then maximizes performance. Game servers will have their own / opt / partition since most game server software will be installed there. The reason is similar to that for the / home / directory: security and backups. In most situations / usr / has to be big enough: not only is the majority of the applications stored here, but also the Gentoo ebuild repository (by default under: / var / db / repos / gentoo), which alone requires around 650 MiB. This size estimate does not yet contain the required disk space for the binpkgs / and distfiles / directories, which are stored under / var / cache / by default.

In most situations on Gentoo, / usr and / var should be kept relatively large in size. / usr hosts the majority of applications available on the system and the Linux kernel sources (under / usr / src). By default, / var hosts the Gentoo ebuild repository (located at / var / db / repos / gentoo) which, depending on the file system, generally consumes around 650 MiB of disk space. This space estimate excludes the / var / cache / distfiles and / var / cache / binpkgs directories, which will gradually fill with source files and (optionally) binary packages respectively as they are added to the system.

So it depends a lot on what the administrator wants to achieve. Separate partitions or volumes have the following advantages:

  • Choose the best performing file system for each partition or volume.
  • The entire system cannot run out of free space if a faulty tool continually writes files to a partition or volume.
  • If necessary, file system checks are reduced in time because several checks can be carried out at the same time. (Even though this advantage is more useful with multiple hard drives than with partitions.)
  • You can increase security by using some partitions or volumes read-only, (setuid flags are ignored), (executable flags are ignored) etc. include.

However, many partitions can also have disadvantages. If these are badly adapted to the system, it is possible that one partition is full and there is still a lot of free space available on another partition. Another disadvantage is that separate partitions - especially for important mount paths such as / usr / or / var / - often make it necessary to use an initramfs during booting, which mounts these partitions before executing other boot scripts . However, this is not always necessary and depends on the individual case.

There is also a limit of a maximum of 15 partitions for SCSI and SATA data carriers, unless the data carrier uses GPT labels.

What about the swap space?

There is no such thing as the perfect size for a swap partition. The purpose of swap space is to reserve hard drive space for the kernel when internal memory (RAM) is running low. The swap memory allows the kernel to swap memory pages that will probably not be accessed soon on the disk (swap or page out) in order to free up memory. If the memory contents are suddenly needed, these memory pages have to be loaded back into the main memory (page-in), this takes a while (since hard drives are very slow compared to main memory).

If the system is not running memory-intensive applications, or if the system has a lot of memory available, it probably does not require a lot of swap space. However, the swap space is also used to store all of the memory in the Hibernation (Hibernation). When the system does the Hibernation is required, you therefore need a larger amount of swap space. Often this must be at least as large as the RAM installed in the system.

Partition hard drive with fdisk (SRM only)

The following sections explain how to create the slice layout example for SRM:

Slice description
/ dev / sda1Swap slice
/ dev / sda2Root slice
/ dev / sda3Entire hard drive (required)

Change the slice layout according to your ideas.

Identify available hard drives

To find out which hard drives are running in the system, use the following commands:

For IDE hard drives:

For SCSI hard drives:

The output shows which hard drives were recognized and their respective / dev / entry. In the following sections we assume that it is a SCSI hard disk on / dev / sda.

Now start fdisk:

Delete all slices

If the hard disk is completely empty, first create a BDS disklabel.

/ dev / sda contains no disklabel. Do you want to create a disklabel? (y / n) y A bunch of drive-specific info will show here 3 partitions: # start end size fstype [fsize bsize cpg] c: 1 5290 * 5289 * unused 0 0

We'll start by deleting all slices except the 'c' slice (a requirement when using BSD disklabels). In the following we show how to delete a slice (in the example we use 'a'). Repeat the process to delete all other slices (again with the exception of the 'c' slice).

Use to view all existing slices. is used to delete a slice.

8 partitions: # start end size fstype [fsize bsize cpg] a: 1 235 * 234 * 4.2BSD 1024 8192 16 b: 235 * 469 * 234 * swap c: 1 5290 * 5289 * unused 0 0 d: 469 * 2076 * 1607 * unused 0 0 e: 2076 * 3683 * 1607 * unused 0 0 f: 3683 * 5290 * 1607 * unused 0 0 g: 469 * 1749 * 1280 4.2BSD 1024 8192 16 h: 1749 * 5290 * 3541 * unused 0 0
Partition (a-h): a

After repeating this process for all slices, the listing should look something like this:

3 partitions: # start end size fstype [fsize bsize cpg] c: 1 5290 * 5289 * unused 0 0

Create a swap slice

On Alpha based systems there is no need for a separate boot slice. However, the first cylinder must not be used because the "aboot" image is stored there.

We will create a swap slice starting with the third cylinder, with a total size of 1 GB. Use to create a new slice. After creating the slice, change the type to (one) which means swap.

Partition (a-p): a First cylinder (1-5290, default 1): 3 Last cylinder or + size or + sizeM or + sizeK (3-5290, default 5290): + 1024M
Partition (a-c): a Hex code (type L to list codes): 1

After these steps, your layout should look similar to the following:

3 partitions: # start end size fstype [fsize bsize cpg] a: 3 1003 1001 swap c: 1 5290 * 5289 * unused 0 0

Create a root slice

Who will now create the root slice starting with the first cylinder after the swap slice. Use the command to see where the swap slice ends. In our example this is at 1003, so the root slice starts at 1004.

Another problem is that there is currently a bug in. This leads to the opinion that one more cylinder is available than is actually the case. In other words, if you are asked for the last cylinder, decrease the cylinder number (in the example: 5290) by one.

When the slice has been created, change the type for ext2 to 8.

Partition (a-p): b First cylinder (1-5290, default 1): 1004 Last cylinder or + size or + sizeM or + sizeK (1004-5290, default 5290): 5289
Partition (a-c): b Hex code (type L to list codes): 8

The slice layout should now look similar to the following:

3 partitions: # start end size fstype [fsize bsize cpg] a: 3 1003 1001 swap b: 1004 5289 4286 ext2 c: 1 5290 * 5289 * unused 0 0

Save slice layout and exit fdisk

End the program by pressing the button. This will also save the slice layout.

Partition hard disk with fdisk (only ARC / AlphaBIOS)

The following sections describe how the slice layout example for ARC / AlphaBIOS is generated:

Slice Description
/ dev / sda1Boot partition
/ dev / sda2Swap partition
/ dev / sda3Root partition

Change the layout of the partitions according to your ideas.

Identify available hard drives

To find out which hard drives are running in the system, use the following commands:

For IDE hard drives:

For SCSI hard drives:

Depending on the output, it should be easy to see which hard drives were found and their associated / dev / entries. In the following sections we assume that it is a SCSI hard disk on / dev / sda.

Now start fdisk:

Delete all partitions

If the hard disk is completely empty, you must first create a DOS disk label.

Building a new DOS disklabel.

We'll start by deleting all partitions. The following shows how to delete a partition (in the example we use '1'). Repeat the process to delete all other partitions as well.

Use to display all existing partitions. Press to delete a partition.

Disk / dev / sda: 9150 MB, 9150996480 bytes 64 heads, 32 sectors / track, 8727 cylinders Units = cylinders of 2048 * 512 = 1048576 bytes Device Boot Start End Blocks Id System / dev / sda1 1 478 489 456 83 Linux / dev / sda2 479 8727 8446976 5 Extended / dev / sda5 479 1433 977904 83 Linux Swap / dev / sda6 1434 8727 7469040 83 Linux
Partition number (1-6): 1

Create boot partition

On Alpha systems that use MILO to boot, we need to create a small vfat boot partition.

Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-8727, default 1): 1 Last cylinder or + size or + sizeM or + sizeK (1-8727, default 8727): + 16M
Selected partition 1 Hex code (type L to list codes): 6 Changed system type of partition 1 to 6 (FAT16)

Create swap partition

We will create a swap partition with a total capacity of 1 GB. Press to create a new partition.

Command action e extended p primary partition (1-4) p Partition number (1-4): 2 First cylinder (17-8727, default 17): 17 Last cylinder or + size or + sizeM or + sizeK (17-8727, default 8727): + 1000M
Partition number (1-4): 2 Hex code (type L to list codes): 82 Changed system type of partition 2 to 82 (Linux swap)

After these steps, your layout should look similar to the following:

Disk / dev / sda: 9150 MB, 9150996480 bytes 64 heads, 32 sectors / track, 8727 cylinders Units = cylinders of 2048 * 512 = 1048576 bytes Device Boot Start End Blocks Id System / dev / sda1 1 16 16368 6 FAT16 / dev / sda2 17 971 977920 82 Linux swap

Create root partition

We will now create the roop partition. Again just use the command.

Command action e extended p primary partition (1-4) p Partition number (1-4): 3 First cylinder (972-8727, default 972): 972 Last cylinder or + size or + sizeM or + sizeK (972-8727, default 8727): 8727

After these steps, your layout should look similar to the following:

Disk / dev / sda: 9150 MB, 9150996480 bytes 64 heads, 32 sectors / track, 8727 cylinders Units = cylinders of 2048 * 512 = 1048576 bytes Device Boot Start End Blocks Id System / dev / sda1 1 16 16368 6 FAT16 / dev / sda2 17 971 977920 82 Linux swap / dev / sda3 972 8727 7942144 83 Linux

Partition layout Save and exit fdisk

Save the changes you made in by typing. This command also terminates the program at the same time.

Now that the partitions have been created, continue with the Creating the File System section.

Creating file systems

introduction

After the partitions have been created, it is time to create file systems on them. The next section describes the different file systems that Linux supports. Readers who already know which file system they want to use can continue with Creating a file system on a partition. Everyone else should read on to learn more about the file systems available ...

File systems

Several file systems are available. Some of them are considered stable on the alpha architecture. It is advisable to research the file system and its level of support before deciding on important partitions for a more experimental file system.

btrfs
A next generation filesystem that provides many advanced features such as snapshotting, self-healing through checksums, transparent compression, subvolumes and integrated RAID. A few distributions have begun to ship it as an out-of-the-box option, but it is not ready for production. Reports of filesystem corruption are common. Its developers urge people to run the latest kernel version for safety because the older ones have known problems. This has been the case for years and it is too early to tell if things have changed.Fixes for corruption issues are rarely backported to older kernels. Proceed with caution when using this filesystem!
ext2
This is the tried and true Linux file system, but it does not have metadata journaling. This means that normal ext2 file system checks at system startup can be quite time consuming. There is now a good selection of journaling file systems that can be checked for consistency very quickly and are therefore generally preferred to their non-journaling versions. Journaling file systems prevent long delays when the system is booted and it happens that the file system is in an inconsistent state.
ext3
The journaling version of the ext2 file system. It offers metadata journaling for quick recovery in addition to other journaling modes such as full data and ordered data journaling. It uses an H-tree (Htree) index which enables high performance in almost all situations. In short, ext3 is a very good and reliable filesystem.
ext4
Originally a spin-off from ext3, ext4 brings new functions, performance improvements and the removal of size restrictions through moderate changes to the on-disk format. It can span volumes of up to 1 EB and file sizes of up to 16 TB. Instead of the classic ext2 / 3 bitmap block allocation, ext4 uses extents that improve performance with large files and reduce fragmentation. ext4 also offers more sophisticated block allocation algorithms (time-delayed allocation and multiple preallocation), which offer the file system driver several options to optimize the layout of the data on the hard disk. It is the recommended general purpose filesystem for any platform.
f2fs
The Flash-Friendly File System was originally created by Samsung for use with NAND flash memory. As of Q2, 2016, this filesystem is still considered immature, but it is a decent choice when installing Gentoo to microSD cards, USB drives, or other flash-based storage devices.
JFS
The high-performance journaling file system from IBM. JFS is a lean, fast and reliable B + tree based file system with good performance under a wide variety of circumstances.
ReiserFS
A B + tree based journaling file system with good overall performance, especially at handling tiny files for the price of multiple CPU cycles. ReiserFS seems to be less maintained than other file systems.
XFS
A metadata journaled filesystem that comes with a number of robust capabilities and is optimized for scalability. XFS appears to be less fault tolerant of various hardware problems.
vfat
Also known as FAT32, it is supported by Linux but does not support permission settings itself. It is mainly used for reasons of compatibility with other operating systems (mainly Microsoft Windows). vfat is also a requirement for some system firmware (such as UEFI).
NTFS
This "New Technology" filesystem is the flagship filesystem of Microsoft Windows. Similar to vfat above it does not store permission settings or extended attributes necessary for BSD or Linux to function properly, therefore it cannot be used as a root filesystem. It should only be used for interoperability with Microsoft Windows systems (note the emphasis on only).

When using ext2, ext3 or ext4 on small partitions (smaller than 8 GB), the file system should be created with the appropriate options in order to reserve enough inodes. The application mke2fs (mkfs.ext2) uses the "bytes-per-inode" setting to calculate how many inodes a file system should have. On smaller partitions it is advisable to increase the calculated number of inodes.

With ext2, ext3 and ext4 this can be done with one of the following commands:

This usually quadruples the number of inodes for a given file system, since it reduces its "bytes-per-inode" (bytes per inode) from 16 kB to 4 kB per inode. This can even be further optimized by specifying the ratio:

Create a file system on a partition

File systems can be created on a partition or on a data carrier with the help of programs. The following table shows which command you need for which file system. For more information about a file system, you can click the file system name.

For example, to format the boot partition (/ dev / sda1) with ext2 and the root partition (/ dev / sda3) with ext4 (as in the example partition structure), one would use the following commands:

Now create the file systems on the previously created partitions (or logical drives).

Activate the swap partition

mkswap is the command used to initialize swap partitions:

To activate the swap partition, use swapon:

Now create and activate the swap partition with the commands mentioned above.

Mounting the root partition

Now that the partitions are initialized and contain a filesystem, it is time to mount them. Use the mount command, but don't forget to create the necessary mount directories for each partition. As an example we mount the root partition:

note
If / tmp / needs to be on a separate partition, change the permissions after mounting: This also applies to / var / tmp.

In the instructions, the file system proc (a virtual interface to the kernel) will be mounted together with other kernel pseudo-file systems. But first we install the Gentoo installation files.