What you will learn in this TP
- Create PVs, VGs and LVs
- Mount by UUID in fstab
- Extend online and take a snapshot
Introduction #
What you will learn in this section
- Create PVs, VGs and LVs
- Mount by UUID in fstab
- Extend online and take a snapshot
Context. An application's data volume is filling up. You set up LVM storage that can grow without downtime. Disks are simulated with files (loop devices): nothing touches the real disks.
Prerequisites: a disposable Ubuntu 24.04 virtual machine (Multipass, Vagrant or cloud) with a sudo account · Estimated time: 50 min
A /data volume grown from 600 MB to 1.4 GB without unmounting.Hands-on #
Guided steps, with their solution.
1. Create two virtual disks
Why? Loop devices let you practise without risk to the system disk.
Create two 1 GB files and attach them as loop devices. Keep their names in variablesD1andD2.2. Create the logical volume
Why? The VG is a pool; allocate only what the LV needs to keep headroom.
Initialise$D1as a PV, create VGvg_tpand a 600 MB LVlv_dataformatted as ext4, mounted on/data.3. Make the mount persistent
Why? An fstab mistake can block boot: always check with findmnt and mount -a.
Add/datato/etc/fstabwith its UUID and thenofailoption, check the file, unmount and remount withmount -a.4. Fill the volume
Why? Simulate data growth to see the need for extension.
Write a 450 MB file to/dataand check usage. Leave an application writing to the volume.5. Extend online
Why? With LVM, you add space without unmounting or stopping the application.
Add$D2to the VG, extendlv_databy 800 MB growing the file system in the same command, and check writing continues.6. Take a snapshot
Why? A snapshot freezes the volume for a consistent backup or a rollback.
Create a 200 MB snapshot, mount it read-only, compareapp.logwith the original, then delete the snapshot.7. Clean up
Why? Undo cleanly in reverse order: mount, LV, VG, PV, loop.
Stop the writer, unmount, remove the fstab line and delete LVM and the loop devices.
Difficulty level : ●●●○○ (3/5)
My progress
Sign in to track your progress and take notes. Sign in
💬 Questions about this lesson
No questions yet: be the first to ask for help or share your configuration.
Recommended Articles
Windows storage: disks, volumes, Storage Spaces and RAID
Manage storage on Windows: GPT and MBR, partitions and volumes with PowerShell, NTFS and ReFS, St...
Linux vs Unix: the complete guide to commands and distributions
Understand the differences between Linux and Unix, explore distributions (server, desktop, lightw...
Linux system architecture: kernel, boot and directory tree
Understand how a Linux server works: kernel and user space, the UEFI, GRUB, initramfs and systemd...
Processes, memory and performance: monitoring and troubleshooting a Linux server
Understand and control Linux processes (ps, top, signals, nice, jobs), interpret load, memory and...
Group Policy (GPO): configuring the estate from Active Directory
Design and troubleshoot Group Policy: computer and user configuration, OU linking, LSDOU order, i...
Ansible: managing security (Vault, SSH, privileges and secrets)
Securing Ansible: Ansible Vault, SSH key authentication, become and sudo, no_log, hardening the c...
Ansible: the inventory (static, dynamic, groups and variables)
Understand and master the Ansible inventory: INI and YAML files, groups, host and group variables...
Users, groups, NTFS permissions and SMB shares
Manage local accounts and groups, understand UAC, apply NTFS permissions with inheritance, create...
Understanding Azure: regions, resource hierarchy, tools and pricing
Microsoft Azure basics: geographies, regions, region pairs and availability zones, the hierarchy ...