5. Linux Packages, Systemd, Boot & LVM Storage

Modules 10-16: apt/dnf, systemctl services, GRUB boot sequence, fdisk, ext4/XFS filesystems, LVM PV/VG/LV & RAID levels

Module 1: Package Management & systemd Service Control

Managing software packages (apt, dpkg, dnf, rpm) and controlling systemd service units.

🇬🇧 English Definition

Package managers install, update, and resolve software dependencies. systemd is the init and service manager controlling system units, targets, and runtime states.

🇮🇳 Hinglish Definition

Ubuntu/Debian me apt/dpkg aur RHEL me dnf/rpm common hain. systemd services ko start, stop, enable aur disable karta hai.

Core Concepts & Rules

  • apt vs dpkg / dnf vs rpm: High-level package managers (apt, dnf) resolve dependencies automatically; low-level tools (dpkg, rpm) work on local files.
  • systemctl start vs enable: start changes current runtime state immediately; enable configures automatic boot startup.

🔍 Line-by-Line Command Breakdown

  1. Line 1: sudo apt update refreshes package index repositories.
  2. Line 2: sudo systemctl start nginx starts nginx web server runtime immediately.
  3. Line 3: sudo systemctl enable nginx configures nginx to start on boot.
  4. Line 4: systemctl status nginx checks service health and PID.

🎯 Interview Focus & Questions

  • Q: apt vs dpkg?
    A: apt handles repositories and dependency resolution; dpkg is the lower-level Debian package tool.
  • Q: start vs enable?
    A: start changes current runtime state; enable configures automatic startup on boot.
  • Q: reload vs restart?
    A: reload rereads configuration without stopping service; restart stops and starts service.
💻 Command Example & Terminal Output - Package Management & systemd Service Control
sudo apt update
sudo apt install nginx
systemctl status nginx
sudo systemctl start nginx
sudo systemctl stop nginx
sudo systemctl restart nginx
sudo systemctl enable nginx
systemctl is-enabled nginx
📤 Terminal Output / Interpretation:
● nginx.service - A high performance web server and a reverse proxy server Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled) Active: active (running) since Sun 2026-10-04 18:00:00 UTC

Module 2: Linux Boot Process, GRUB & Storage Partitioning

Understanding the Linux startup sequence, GRUB bootloader, and disk block device management.

🇬🇧 English Definition

Boot sequence: BIOS/UEFI -> GRUB -> Kernel -> Initramfs -> systemd/PID 1 -> Targets -> Login. Partition disks using fdisk or parted and mount formatted filesystems.

🇮🇳 Hinglish Definition

Boot time par GRUB kernel load karta hai, kernel initramfs ke saath userspace start karta hai aur systemd services initialize karta hai.

Core Concepts & Rules

  • GRUB: Grand Unified Bootloader responsible for loading kernel images into memory.
  • PID 1: The initial userspace process (systemd) that spawns all other system services.
  • Persistent Mounts: Configured inside /etc/fstab using device UUIDs.

🔍 Line-by-Line Command Breakdown

  1. Line 1: systemd-analyze blame prints boot time consumed by each service unit.
  2. Line 2: lsblk lists block storage devices and partition layout tree.
  3. Line 3: blkid displays filesystem UUID identifiers for persistent mounting.
  4. Line 4: sudo fdisk -l lists partition table details for attached drives.

🎯 Interview Focus & Questions

  • Q: What is GRUB?
    A: A bootloader commonly used to load the Linux kernel and select boot entries.
  • Q: What is PID 1?
    A: The first userspace process; on modern Linux distributions it is systemd.
💻 Command Example & Terminal Output - Linux Boot Process, GRUB & Storage Partitioning
systemd-analyze
systemd-analyze blame
lsblk
blkid
sudo fdisk -l
sudo mkfs.ext4 /dev/sdb1
sudo mkfs.xfs /dev/sdb2
mount /dev/sdb1 /mnt/data
📤 Terminal Output / Interpretation:
Startup finished in 1.821s (firmware) + 2.115s (loader) + 1.250s (kernel) + 3.120s (userspace) = 8.307s NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS sda 8:0 0 40G 0 disk └─sda1 8:1 0 40G 0 part /

Module 3: LVM (Logical Volume Manager) & RAID Redundancy

Flexible storage pooling with LVM and multi-disk redundancy levels.

🇬🇧 English Definition

LVM provides dynamic storage management: Physical Volume (PV) -> Volume Group (VG) -> Logical Volume (LV) -> Filesystem. RAID combines multiple disks for performance (RAID 0) or mirroring redundancy (RAID 1/5/6/10).

🇮🇳 Hinglish Definition

LVM se storage ko flexible tarike se pool aur resize kar sakte ho. RAID multiple disks ko combine karke performance aur redundancy deta hai.

Core Concepts & Rules

  • LVM Hierarchy: PV (physical disk) -> VG (storage pool) -> LV (virtual partition).
  • XFS vs ext4 Resizing: ext4 filesystems can be grown and shrunk; standard XFS can only be grown online.
  • RAID is NOT Backup: RAID protects against physical disk failure but not accidental deletion or corruption.

🔍 Line-by-Line Command Breakdown

  1. Line 1: sudo pvcreate /dev/sdb initializes physical volume for LVM.
  2. Line 2: sudo vgcreate vgdata /dev/sdb creates volume group pool named vgdata.
  3. Line 3: sudo lvcreate -L 10G -n lvdata vgdata allocates 10GB logical volume.
  4. Line 4: sudo lvextend -L +5G /dev/vgdata/lvdata expands logical volume dynamically.

🎯 Interview Focus & Questions

  • Q: PV vs VG vs LV?
    A: PV is physical storage prepared for LVM; VG is a storage pool of PVs; LV is allocated logical partition storage.
  • Q: Does RAID replace backup?
    A: No. RAID does not protect against accidental file deletion, corruption, ransomware, or logical disasters.
💻 Command Example & Terminal Output - LVM (Logical Volume Manager) & RAID Redundancy
sudo pvcreate /dev/sdb
pvs
sudo vgcreate vgdata /dev/sdb
vgs
sudo lvcreate -L 10G -n lvdata vgdata
lvs
sudo lvextend -L +5G /dev/vgdata/lvdata
sudo resize2fs /dev/vgdata/lvdata
📤 Terminal Output / Interpretation:
Physical volume "/dev/sdb" successfully created. Volume group "vgdata" successfully created Logical volume "lvdata" created. Size of logical volume vgdata/lvdata changed from 10.00 GiB to 15.00 GiB.