User:Zulu Foxtrott/GentooOnARM/EasyInstall/BlockDevices

Block devices
On Linux block devices represent an abstract interface to physical storage devices. User programs can use these block devices to interact with the storage device without worrying about whether the devices are SATA, SCSI, or something else. The program can simply address the storage on the device as a bunch of contiguous, randomly-accessible 4096-byte (4K) blocks.

SCSI and Serial ATA drives are both labeled under device handles such as:, , , etc. On more modern machines, PCI Express based NVMe solid state disks have device handles such as , , etc., while SD cards and MMCs have handles such as , , etc.

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

Partition tables
Although it is theoretically possible to use a raw, unpartitioned storage device to house a Linux system (when creating a btrfs RAID for example), this is almost never done in practice. Instead, block devices representing a physical device are split up into smaller, more manageable block devices. On most systems capable of running Linux, these are called partitions. The current standard partitioning technology is GPT, whereas older systems might still use MBR, sometimes also called DOS disklabel).

GPT
The GPT (GUID Partition Table) setup uses 64-bit identifiers for the partitions, which means there is practically no limit on the amount of partitions for a GPT disk. Also the size of a partition is bounded only by a quite big limit (almost 8 ZiB - yes, zebibytes).

GPT also takes advantage of checksumming and redundancy. It carries CRC32 checksums to detect errors in the header and partition tables and has a backup GPT at the end of the disk. This backup table can be used to recover damage of the primary GPT near the beginning of the disk.

MBR (DOS)
The MBR (Master boot record) boot sector was first introduced in 1983 with PC DOS 2.x. MBR uses 32-bit identifiers for the start sector and length of the partitions, and supports three partition types: primary, extended, and logical. Primary partitions have their information stored in the master boot record itself - a very small (usually 512 bytes) location at the very beginning of a disk. Due to this small space, only four primary partitions are supported (for instance, to ).

In order to support more partitions, one of the primary partitions in the MBR can be marked as an extended partition. This partition can then contain additional logical partitions (partitions within a partition).

It is suggested to use GPT whenever possible for Gentoo installations.

Device mapper
Also, Linux allows to free the abstract interface to storage devices from its limitation to directly addressable (singular) physical devices. With the kernel's device mapper framework it is possible to have virtual block devices that are mapped to one or more physical devices. Those virtual devices can be addressed like regular block devices, the kernel takes care of relaying the data to the underlying hardware. The corresponding device handles are addressable under and can be arbitrarily labeled, for example, , etc.

Utilizing the device mapper framework, it is, for example, possible to create a virtual device that receives data like a regular block device and forwards it in encrypted form to the real hardware (and vice versa) and thus transparently encrypts the data.

LUKS
LUKS, the Linux Unified Key Setup, is used on top of the device mapper framework's crypt target (dm-crypt) to facilitate dealing with data encryption. To that end the application, which is the reference implementation of LUKS, offers a simple way of managing encrypted storage devices and associated passphrases and keys. As nowadays encrypting storage devices is widely regarded best practice to protect user data (for instance in case of theft) it is recommended to consider using LUKS for the installation.

Next
Introduction to filesystems