Search notes:

Filesystem: Partition

Block devices can be divided into one or more partitions. The layout of the partitions is recorded in the partition table which is usually found in sector 0 of the disk. (BSD users speak of disk slices and disk labels).

Determine the file system of a partition

file -sL /dev/sda4
lsblk -f
On Windows: diskpart list disk (diskpart.exe).

Directories required for booting

The directories /etc and /usr are required in the boot process. Therefore, they should be in the root partition, or mounted early.

Tools to manage partitions

fdisk, gdisk, parted, partx etc.

Superblock

The superblock records some information about the filesystem it belongs to, for example

GUIDs / UUIDs

There are up to (at least) three GUIDs (UUIDs) that are related to a partion
These GUIDs can be be shown, for example, with lsblk like so:
# lsblk -o NAME,UUID,PARTUUID,PARTTYPE,TYPE,FSTYPE

NAME        UUID                                 PARTUUID                             PARTTYPE                             TYPE FSTYPE
nvme0n1                                                                                                                    disk 
├─nvme0n1p1 BC6A-B14F                            f6cf495b-6bf9-4eff-bb49-6d6e45b0e9d0 c12a7328-f81f-11d2-ba4b-00a0c93ec93b part vfat
├─nvme0n1p2                                      2dfe186d-580a-4222-93af-c2ad66176ec9 e3c9e316-0b5c-4db8-817d-f92df00215ae part 
├─nvme0n1p3 B2586C6C586C3171                     a122444b-362e-4473-8d5f-7b0937015779 ebd0a0a2-b9e5-4433-87c0-68b6b72699c7 part ntfs
├─nvme0n1p4 A684C1BB84C18DED                     080b18c7-af94-4949-93c0-9f440219fe7d de94bba4-06d1-4d40-a16a-bfd50179d6ac part ntfs
└─nvme0n1p5 748c91ba-39f3-47ed-902d-4109bb0db68 7f5c7250-0cbc-4c9b-b7a9-b875d6e15253 0fc63daf-8483-4772-8e79-3d69d8477de4 part btrfs

Filesystem UUID

The purpose of the filesystem UUID is to uniquely identify a partition and to make it discoverable, for example
  • /etc/fstab
  • /EFI/debian/grub.cfg on the EFI System Partition
The filesystem UUID is reported, for example, with the UUID format of lsblk.

Partition UUID

Partition type UUID

The partition type UUID (PARTTYPE, not PARTUUID in lsblk) is stored in the GPT partition table entry for that partition.
Some important partition types in my little world are:
0fc63daf-8483-4772-8e79-3d69d8477de4 Linux filesystem data
c12a7328-f81f-11d2-ba4b-00a0c93ec93b EFI System Partition
de94bba4-06d1-4d40-a16a-bfd50179d6ac Windows Recovery Environment
e3c9e316-0b5c-4db8-817d-f92df00215ae Microsoft Reserved Partition (MSR)
ebd0a0a2-b9e5-4433-87c0-68b6b72699c7 Basic data partition (This seems to be a Microsoft thingy, reported as «Microsoft reserved» with fdisk -l)
See also Wikipedia (table must be opened).

TODO

btrfs partitioning (seems to replace MBR and GPT partitioning).

CHS - Cylinder, Head, Sector

CHS (cylinder, head, sector) addressing has never been important for Linux.
Solid state drives don't have physical cylinders or heads anyway.

See also

/proc/partitions lists major and minor numbers of partitioned devices as well as their names in /dev.
Partition tables and file systems
Remove an old partition with wipefs.
The Powershell command get-partition

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:51 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(51): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(66): id_of(Object(PDO), 'uri', '/notes/hardware...') #2 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/hardware...', 1788356515, '216.73.217.21', 'Mozilla/5.0 App...', NULL) #3 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/hardware/harddisk/partition/index(144): insert_webrequest() #4 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 51