Planning a disk layout

Deciding what goes on which partition before you install: which directories are worth separating, why /boot and swap are special, and what LVM buys you over a fixed partition table.

Lesson 1 of 6 in objective 102. Linux installation and package management, part of LPIC-1 Exam 101-500.

What each separate partition buys, and where one reason covers two. Left column, What gets its own partition; right column, What that buys. /var and /tmp both point at Filling it cannot stop the machine (A runaway log fills only its own partition; /tmp can also be noexec). /boot and /boot/efi both point at Somewhere readable before the machine is up (The EFI partition is FAT, and the firmware itself reads it). /home points at A reinstall that keeps the user data. swap points at Somewhere to page memory out (Not a directory, and hibernation needs at least the size of RAM). What gets its own partition What that buys /var /tmp Filling it cannot stop the machine A runaway log fills only its own partition; /tmp can also be noexec /boot /boot/efi Somewhere readable before the machine is up The EFI partition is FAT, and the firmware itself reads it /home A reinstall that keeps the user data swap Somewhere to page memory out Not a directory, and hibernation needs at least the size of RAM
What each separate partition buys, and where one reason covers two.

What is worth its own partition, and why

The reason to separate a directory is almost always that something can fill it. /var holds logs, mail spools and package caches, and a runaway log on a single-partition system fills the root filesystem and stops the machine. /home holds user data, and separating it means a reinstall can keep it. /tmp is world-writable, so a separate /tmp bounds what any user can consume and lets it be mounted with noexec and nosuid.

/boot is separated for a different reason: something has to be readable before the machine is fully up. If the root filesystem is encrypted or sits on an exotic volume manager, the kernel and initramfs have to live somewhere the boot loader can read unaided. On UEFI systems there is also an EFI system partition, formatted FAT and usually mounted at /boot/efi, which the firmware itself reads.

Swap is not a directory but a partition or file the kernel uses to page memory out. The old rule of twice RAM is long obsolete; what matters for the exam is that swap exists, that it is type 82 on an MBR table, that mkswap prepares it and swapon activates it, and that hibernation needs swap at least the size of RAM.

LVM, and mount points as a layer of indirection

A classic partition table pins sizes at install time and resizing them later means moving data. LVM adds a layer: physical volumes (the partitions or disks) are grouped into a volume group, and logical volumes are carved out of that group and can be grown, shrunk or moved while the system runs. The filesystem sits on the logical volume, so /home can borrow space from the volume group next year without repartitioning.

The three layers have three sets of commands named after them, and the exam asks for them by name rather than by description. pvcreate initialises a partition or a whole disk as a physical volume; vgcreate pools one or more physical volumes into a named volume group; lvcreate carves a logical volume out of that group, and only the logical volume ever receives a filesystem and a mount point. Growing follows the same naming one word further on — vgextend adds another physical volume to an existing group, lvextend hands group space to a logical volume — and the filesystem on top is a separate step again, grown with resize2fs or xfs_growfs after the volume beneath it has moved. pvs, vgs and lvs report each layer.

Either way, the thing a user sees is a mount point — a directory in the single tree at which a filesystem is attached. Linux has no drive letters: a second disk is not "D:", it is whatever directory you mount it on, and the same filesystem mounted somewhere else is the same data at a different path.

The layers under a mount point on LVM, and the one that resizes while the system runs. From What a user sees: a directory in the tree to The disks and partitions you hand to LVM: Mount point, say /home (a directory in the single tree; Linux has no drive letters), then The filesystem (sits on the logical volume, not straight on a partition), then Logical volume (carved from the group; grown, shrunk or moved while running), then Volume group (the pooled space a logical volume borrows from), then Physical volumes (the partitions or disks given to LVM). What a user sees: a directory in the tree Mount point, say /home a directory in the single tree; Linux has no drive letters The filesystem sits on the logical volume, not straight on a partition Logical volume carved from the group; grown, shrunk or moved while running Volume group the pooled space a logical volume borrows from Physical volumes the partitions or disks given to LVM The disks and partitions you hand to LVM
The layers under a mount point on LVM, and the one that resizes while the system runs.

Worth carrying in

/boot
Kernel and initramfs. Separate when root is encrypted or on LVM the loader cannot read.
/var
Logs, spools, caches — the directory that grows without asking.
/home
User data. Separating it survives a reinstall.
swap
Paged-out memory. Prepared with mkswap, activated with swapon, listed in /proc/swaps.
EFI system partition
FAT partition the firmware reads, normally mounted at /boot/efi.
LVM
Physical volumes → volume group → logical volumes, resizable after the fact.
pvcreate / vgcreate / lvcreate
Initialise a physical volume, pool volumes into a group, carve a logical volume out of it. In that order.
vgextend / lvextend
Add a physical volume to a group; give group space to a logical volume. The filesystem is grown separately.

What the exam does with this

Objective
102. Linux installation and package management
Share of the exam
18.33% (the whole objective)
Questions in this lesson
10
Signed for by a person
0

Partly checked. None of the 10 questions here has been read against the cited source by a person. 10 questions have been checked against their cited clause by an automated pass — which is not the same thing, and is not a signature.

Only questions a person has signed for are used in mock exams here. That is the whole difference between the two kinds of checking above.

How these questions are written — where each question comes from, what the verification ledger records, and what happens when one is found wrong.

Drill this lesson

A lesson is one sitting: the trainer draws a short run from these questions alone and spaces the ones you get wrong.

Practise Planning a disk layout

Questions in this lesson

Practise Planning a disk layout

The rest of objective 102