LPIC-1: Linux Disk Management
Disks act as physical containers for data. Before we can use a disk in Linux, we must break it down into logical "fences" known as partitions. This compartmentalization allows us to separate User Data (/home) from OS Data (/), improving stability and security.
1. Partition Tables & Filesystems
Every disk requires at least one partition. The information about where partitions start and end is stored in the Partition Table. There are two main standards:
- MBR (Master Boot Record): Legacy standard. Supports up to 4 primary partitions and disks up to 2TB.
- GPT (GUID Partition Table): Modern standard. Part of UEFI. Supports nearly unlimited partitions and huge disks.
Inside each partition lives a Filesystem (FS). The FS acts as the librarian, organizing how files and directories relate to one another. Common Linux filesystems include ext4, xfs, and btrfs.
2. LVM (Logical Volume Manager)
Traditionally, a partition cannot span across multiple physical disks. LVM solves this limitation. It abstracts physical storage into logical "pools".
Why use LVM?
- Flexibility: You can resize partitions (Logical Volumes) on the fly.
- Spanning: A single logical volume can be spread across multiple hard drives.
- Snapshots: Take backups of the system state before making changes.
3. Mount Points
Unlike Windows which uses drive letters (C:, D:), Linux uses a single directory tree. To access a filesystem, it must be mounted to a specific directory.
# Example: Viewing directory contents
[02:37 PM]-[0x5ha157@0x5ha157-Dell]-[/home]-
$ ls
0x5ha157 0xt3m4
Key Mount Hierarchies:
/mnt: Historically used for temporary manual mounts (admin mounting a USB to fix it)./media: The modern default for auto-mounting removable media. Usually appears as/media/USER/LABEL.
Best Practice: If you are manually mounting a filesystem permanently, you might often use specific folders you create, but for temporary admin work, stick to /mnt.
4. The Boot Partition (/boot)
This partition contains the kernel (vmlinuz), initial RAM disk (initrd), and bootloader configuration (GRUB2).
- Location: Usually the first partition on the disk.
- Size: Historically ended before cylinder 1024 (528 MB) to ensure old BIOS could read it. Modern practice suggests 512MB-1GB.
- Safety: Keeping
/bootseparate ensures the system can still load the kernel even if the root filesystem (/) gets corrupted.
5. The EFI System Partition (ESP)
For modern machines using UEFI (Unified Extensible Firmware Interface) instead of BIOS, an ESP is required.
- Format: Must be formatted as FAT32 (unlike the rest of Linux which uses ext4/xfs).
- Identifier: On GPT disks, it has a specific Globally Unique Identifier so the firmware finds it immediately on power-up.
- Mount Point: Typically mounted at
/boot/efi.