Advanced storage: LVM, RAID, LUKS and snapshots
You build, grow and repair logical volumes, thin provisioning, snapshots, RAID and encrypted disks the way it is done in production.
Level 301 · 20 lessons · 21 practice labs
Lessons
LVM in depth
- LVM architecture: PV, VG, LV and extents
- Growing and shrinking: what each file system allows
- Safe upgrades with LVM snapshots
- Thin provisioning: thin pools and the risk of filling up
- Moving data to another disk live with pvmove
- LVM metadata backups and vgcfgrestore
- Short task: retire an ageing disk without downtime
RAID
- RAID levels: 0, 1, 5, 6, 10 and their real costs
- Building and monitoring an array with mdadm
- Replacing a failed disk and watching the rebuild
- Using RAID and LVM together
- Short task: notice a degraded array and repair it
Encryption
- LUKS key slots: adding, removing and changing passphrases
- LUKS header backup and recovery
- Encrypted disks that unlock at boot: crypttab and key files
- Encryption below or above LVM: which and when
- Short task: move the customer-data volume onto an encrypted one
Monitoring and planning
- Disk health with SMART
- I/O schedulers and partition alignment
- Capstone: design and build redundant, encrypted storage for a database server
Practice labs
- Find how much space is free in a volume group: From pvs, vgs and lvs output, tabulate how many free extents remain on each physical volume.
- Retire an ageing disk without downtime: Add a new disk to the group, move data live with pvmove and remove the old disk from the group.
- Rescue a thin pool about to fill: Find the data and metadata fullness of an over-committed thin pool, grow it and set the auto-extend threshold.
- Snapshot before an update and roll back: Take a snapshot of the application volume, apply a broken update and merge the snapshot to roll back.
- Rescue a snapshot that is about to fill: Watch a snapshot's fill level with lvs under heavy writes, extend it before it becomes invalid and set the automatic extension threshold in lvm.conf.
- Bring back a deleted logical volume from metadata backup: Restore an accidentally removed volume from the LVM metadata archive with vgcfgrestore and confirm the data is intact.
- Read which encrypted volume opens at boot: Match crypttab against lsblk output to find the encrypted volume opened at boot, the device it sits on and where its key comes from, and write them down.
- Make an encrypted volume unlock at boot: Create a key file, add crypttab and fstab entries and verify the volume mounts after reboot without a passphrase prompt.
- Rotate the boot key file without an outage: Add a new key file to a free slot, update crypttab, narrow the file's permissions to root only, remove the old slot only after a reboot has been tested and confirm the passphrase still works as a fallback.
- Find an array's level and usable space: Use /proc/mdstat and mdadm to tabulate the level, disk count and usable space of the existing arrays.
- Notice a degraded array and repair it: Remove the failed disk from the array, add the spare and confirm the resync has completed.
- Set up monitoring that alerts on array failure: Hook mdadm monitor mode to an alert script and prove the alert fires by marking a disk faulty.
- Read a block device stack: Use lsblk to map the disk, RAID, encryption and LVM layers under a server's data volume and write down their order.
- Layer LVM on top of RAID: Create a RAID 5 array from three disks, build a volume group and two logical volumes on it and make it assemble at boot.
- Build redundant, encrypted storage for a database server: Build RAID 10 from four disks with LUKS and LVM on top, create data and log volumes and have them mount at boot.
- Add a second passphrase to an encrypted volume: Add a key slot for a new admin to a LUKS volume and remove the departed admin's slot.
- Back up a LUKS header and recover from damage: Back up the header, simulate the damage that corrupts it and reopen the volume after restoring from backup.
- Move customer data onto an encrypted volume: Move data from an unencrypted volume to a new LUKS volume with ownership, switch the mount point and wipe the old volume.
- Find the failing disk from SMART data: Use reallocated and pending sector counts in saved SMART output to find the disk that should be replaced.
- Pick the right I/O scheduler and make it stick: Find each disk's scheduler and whether it is rotational, then set a suitable scheduler persistently with a udev rule.
- Find a misaligned partition and recreate it: Run an alignment check with parted and recreate the misaligned partition on the right boundary while keeping the data.
About this course
You build, grow and repair logical volumes, thin provisioning, snapshots, RAID and encrypted disks the way it is done in production.
What you will learn
- LVM in depth
- RAID
- Encryption
- Monitoring and planning
Prerequisites
You should be comfortable with the level 101 and 201 topics of the same path.
Lab environment
Lessons run in your own Kali Linux terminal that opens in the browser. Nothing to install; the lab starts clean in every lesson.
Frequently asked questions
- Is this course right for my level?
- The course is at level 301; it assumes you know the topics of the lower-level courses.
- Is there anything to install?
- No. Every lesson runs in your own lab environment that opens in the browser.
- How do lessons work?
- Each lesson has 8 to 10 steps and a short quiz. Early steps show the command to type, later steps give less help; if two attempts fail, the solution opens.
- Can I try it for free?
- Yes. The first three lessons of every course are free.