LFCS 164 ๐ง LFCS Practice Scenarios โ Storage
The previous chapters reviewed the exam objectives by the domain. This chapter is the practice: the scenarios that simulate the exam tasks in the storage domain. The LFCS is the performance-based exam, and the storage tasks are the most common type: the partition, the format, the mount, the RAID, and the LVM. The critical trap is the persistence. The mkfs formats the device, but the mount is the runtime. The /etc/fstab is the persistence. The parted creates the partition, but the kernel may not see it without the partprobe or the udevadm settle. The scenarios test the complete workflow, not just the single command.
Key point: The storage scenarios are the end-to-end tasks: the partition, the filesystem, the mount, the persistence, the verification. The candidate must be able to perform the task without the reference, verify the state with the lsblk, the df, and the blkid, and make the change persistent with the /etc/fstab. The scenarios assume the extra disks (/dev/sdb, /dev/sdc, etc.) that the exam environment provides.
Why the storage practice requires a specific mental model
The destructive problem. The mkfs wipes the existing data. The parted mklabel wipes the partition table. The wipefs -a wipes the filesystem signatures. The practice scenarios must not be run on the production disks. The lsblk and the blkid verify the target device before the destructive command.
The naming problem. The device names can change between the reboots. The /dev/sdb may become the /dev/sdc if the hardware changes. The practice uses the current names, but the production uses the UUID or the label in the /etc/fstab for the persistence.
The mount problem. The mount /dev/sdb1 /mnt/data is the runtime. The umount detaches. The lsof and the fuser show what is using the mount. The mount --bind is the alternative. The /etc/fstab entry must have the correct type, options, and the dump/pass fields.
The verification problem. The lsblk shows the block device tree. The df -hT shows the mounted filesystems with the types. The blkid shows the UUIDs and the labels. The findmnt shows the mount tree. The verification is the mandatory final step of every storage scenario.
The trade-off. The storage scenarios are the most destructive and the most common. The candidate must be careful and fast. The practice on the disposable VM is the requirement.
a. The partition and the filesystem
The scenario: the create a 2 GiB partition on /dev/sdb, the format it as ext4, the mount it at /mnt/data, and make it persistent.
# Verify the target
lsblk /dev/sdb
# Create the partition table and the partition
sudo parted /dev/sdb --script mklabel gpt
sudo parted /dev/sdb --script mkpart primary ext4 1MiB 2GiB
# Inform the kernel
sudo partprobe /dev/sdb
sudo udevadm settle
# Format
sudo mkfs.ext4 -L data /dev/sdb1
# Create the mount point and mount
sudo mkdir -p /mnt/data
sudo mount /dev/sdb1 /mnt/data
# Verify
lsblk /dev/sdb
df -hT /mnt/data
blkid /dev/sdb1
The parted --script suppresses the prompts. The mklabel gpt creates the GPT. The mkpart creates the partition. The partprobe rereads the partition table. The mkfs.ext4 -L data sets the label. The mount attaches. The lsblk and the df confirm.
The persistent entry uses the UUID, not the device name.
# Get the UUID
UUID=$(sudo blkid -s UUID -o value /dev/sdb1)
# Add to the fstab
echo "UUID=$UUID /mnt/data ext4 defaults 0 2" | sudo tee -a /etc/fstab
# Test the fstab
sudo umount /mnt/data
sudo mount -a
df -hT /mnt/data
The /etc/fstab fields: the UUID, the mount point, the type, the options, the dump (0), the pass (2). The mount -a tests the entry. The df confirms.
b. The LVM volume
The scenario: the create the LVM volume group vgdata on /dev/sdc and /dev/sdd, the create the logical volume lvdata of 5 GiB, the format it as XFS, the mount it at /srv/lvdata.
# Create the physical volumes
sudo pvcreate /dev/sdc /dev/sdd
# Create the volume group
sudo vgcreate vgdata /dev/sdc /dev/sdd
# Create the logical volume
sudo lvcreate -L 5G -n lvdata vgdata
# Verify
sudo pvs
sudo vgs
sudo lvs
# Format
sudo mkfs.xfs /dev/vgdata/lvdata
# Mount
sudo mkdir -p /srv/lvdata
sudo mount /dev/vgdata/lvdata /srv/lvdata
# Verify
df -hT /srv/lvdata
The pvcreate initializes the physical volumes. The vgcreate creates the volume group. The lvcreate creates the logical volume. The /dev/vgdata/lvdata is the device path for the format and the mount. The XFS does not have the online shrink, but it has the xfs_growfs for the extend.
The extension.
# Extend the logical volume
sudo lvextend -L +2G /dev/vgdata/lvdata
# Extend the XFS
sudo xfs_growfs /srv/lvdata
# Verify
df -hT /srv/lvdata
The lvextend -L +2G adds the 2 GiB. The xfs_growfs grows the filesystem into the new space. The df confirms.
c. The RAID array
The scenario: the create the RAID 1 array on /dev/sde and /dev/sdf, the format it as ext4, the mount it at /mnt/raid1, and simulate the failure and the replacement.
# Clear the signatures
sudo wipefs -a /dev/sde /dev/sdf
# Create the RAID 1
sudo mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sde /dev/sdf
# Verify the sync
cat /proc/mdstat
# Format and mount
sudo mkfs.ext4 /dev/md0
sudo mkdir -p /mnt/raid1
sudo mount /dev/md0 /mnt/raid1
# Persist the configuration
sudo mdadm --detail --scan | sudo tee -a /etc/mdadm.conf
The wipefs -a removes the existing signatures. The mdadm --create creates the array. The /proc/mdstat shows the sync progress. The /etc/mdadm.conf persists the array definition.
The failure simulation.
# Mark the disk as failed
sudo mdadm /dev/md0 --fail /dev/sde
# Remove the disk
sudo mdadm /dev/md0 --remove /dev/sde
# Add the replacement
sudo mdadm /dev/md0 --add /dev/sdg
# Monitor the rebuild
watch -n 5 cat /proc/mdstat
The --fail marks the disk. The --remove detaches. The --add starts the rebuild. The --detail shows the state.
Complete Example Session
# ============================================
# PART 1: PARTITION THE DISK
# ============================================
sudo parted /dev/sdb --script mklabel gpt
sudo parted /dev/sdb --script mkpart primary ext4 1MiB 2GiB
sudo partprobe /dev/sdb
# ============================================
# PART 2: FORMAT AND MOUNT
# ============================================
sudo mkfs.ext4 -L data /dev/sdb1
sudo mkdir -p /mnt/data
sudo mount /dev/sdb1 /mnt/data
df -hT /mnt/data
# ============================================
# PART 3: PERSIST THE MOUNT
# ============================================
UUID=$(sudo blkid -s UUID -o value /dev/sdb1)
echo "UUID=$UUID /mnt/data ext4 defaults 0 2" | sudo tee -a /etc/fstab
sudo umount /mnt/data
sudo mount -a
# ============================================
# PART 4: LVM PHYSICAL VOLUMES
# ============================================
sudo pvcreate /dev/sdc /dev/sdd
sudo vgcreate vgdata /dev/sdc /dev/sdd
sudo lvcreate -L 5G -n lvdata vgdata
# ============================================
# PART 5: LVM FORMAT AND MOUNT
# ============================================
sudo mkfs.xfs /dev/vgdata/lvdata
sudo mkdir -p /srv/lvdata
sudo mount /dev/vgdata/lvdata /srv/lvdata
# ============================================
# PART 6: LVM EXTEND
# ============================================
sudo lvextend -L +2G /dev/vgdata/lvdata
sudo xfs_growfs /srv/lvdata
df -hT /srv/lvdata
# ============================================
# PART 7: RAID 1 CREATE
# ============================================
sudo wipefs -a /dev/sde /dev/sdf
sudo mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sde /dev/sdf
sudo mkfs.ext4 /dev/md0
sudo mount /dev/md0 /mnt/raid1
# ============================================
# PART 8: RAID PERSIST
# ============================================
sudo mdadm --detail --scan | sudo tee -a /etc/mdadm.conf
# ============================================
# PART 9: RAID FAILURE
# ============================================
sudo mdadm /dev/md0 --fail /dev/sde
sudo mdadm /dev/md0 --remove /dev/sde
sudo mdadm /dev/md0 --add /dev/sdg
The nine parts trace the storage scenarios: the partition, the format and mount, the persistence, the LVM physical, the LVM format, the LVM extend, the RAID create, the RAID persist, and the RAID failure.
Quick Reference
Partition Commands
| Command | Purpose |
|---|---|
parted mklabel | Create the partition table |
parted mkpart | Create the partition |
partprobe | Reread the table |
mkfs.ext4 -L | Format with the label |
Mount Commands
| Command | Purpose |
|---|---|
mount <dev> <dir> | Mount the filesystem |
umount <dir> | Unmount |
mount -a | Mount the fstab entries |
blkid | Show the UUID |
findmnt | Show the mount tree |
LVM Commands
| Command | Purpose |
|---|---|
pvcreate | Physical volume |
vgcreate | Volume group |
lvcreate -L -n | Logical volume |
lvextend -L | Extend |
xfs_growfs | Grow the XFS |
RAID Commands
| Command | Purpose |
|---|---|
wipefs -a | Clear the signatures |
mdadm --create | Create the array |
mdadm --detail | Show the state |
mdadm --fail | Mark the disk failed |
mdadm --remove | Remove the disk |
mdadm --add | Add the disk |
Best Practices
โ Do This:
sudo parted /dev/sdb --script mklabel gpt
<!-- Use the script mode for the automation --> # โ
UUID=$(sudo blkid -s UUID -o value /dev/sdb1)
<!-- Use the UUID in the fstab --> # โ
sudo mdadm --fail /dev/md0 /dev/sde
<!-- Fail the disk before the remove --> # โ
โ Don’t Do This:
sudo mount /dev/sdb1 /mnt/data
# Without the fstab
<!-- The mount is lost on reboot --> # โ
echo "/dev/sdb1 /mnt/data ext4 defaults 0 2" >> /etc/fstab
<!-- The device name can change --> # โ
sudo mdadm /dev/md0 --remove /dev/sde
# Without the fail
<!-- The disk is removed but not failed --> # โ
Common Pitfalls
| Pitfall | Why It Happens | Fix |
|---|---|---|
| Mount lost on reboot | No fstab entry | Add the entry |
| fstab fails to mount | Wrong UUID or type | Verify with blkid |
| LVM extend fails | No free space in VG | vgextend or lvextend |
| RAID sync slow | Default speed | speed_limit_min |
| Kernel does not see the partition | No partprobe | Run partprobe |
Real-World Examples
1. Partition
parted /dev/sdb --script mklabel gpt
parted /dev/sdb --script mkpart primary ext4 1MiB 2GiB
2. Format
mkfs.ext4 -L data /dev/sdb1
3. Mount
mount /dev/sdb1 /mnt/data
4. fstab
echo "UUID=$(blkid -s UUID -o value /dev/sdb1) /mnt/data ext4 defaults 0 2" >> /etc/fstab
5. LVM Create
pvcreate /dev/sdc
vgcreate vgdata /dev/sdc
lvcreate -L 5G -n lvdata vgdata
6. LVM Extend
lvextend -L +2G /dev/vgdata/lvdata
xfs_growfs /srv/lvdata
7. RAID Create
mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sde /dev/sdf
8. RAID Persist
mdadm --detail --scan >> /etc/mdadm.conf
9. RAID Fail
mdadm /dev/md0 --fail /dev/sde
10. Verify
lsblk; df -hT; blkid
Visual
Storage Scenario Flow
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Identify the target (lsblk, blkid) โ
โโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Partition (parted) โ
โโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Format (mkfs.ext4, mkfs.xfs) โ
โโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Mount (mount) โ
โโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Persist (fstab, mdadm.conf) โ
โโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Verify (df, lsblk, findmnt) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
LVM Stack
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Filesystem (ext4, xfs) โ
โโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Logical volume (lvdata) โ
โโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Volume group (vgdata) โ
โโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Physical volumes (sdc, sdd) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Summary
| Item | Value |
|---|---|
| Partition | parted |
| Format | mkfs.ext4, mkfs.xfs |
| Mount | mount, /etc/fstab |
| LVM physical | pvcreate |
| LVM volume group | vgcreate |
| LVM logical volume | lvcreate |
| LVM extend | lvextend, xfs_growfs |
| RAID create | mdadm --create |
| RAID persist | /etc/mdadm.conf |
| Verification | lsblk, df, blkid |
Key takeaways:
- The persistence is the trap. The
mountis the runtime. The/etc/fstabis the persistent. Themdadm --createis the runtime. The/etc/mdadm.confis the persistent. The exam tests the persistence. - The UUID is the device name stability. The
/dev/sdb1can change between the reboots. TheUUID=...in the/etc/fstabis the stable reference. Theblkid -s UUID -o valueextracts the UUID. - The LVM stack is the layers. The
pvcreate, thevgcreate, thelvcreate, themkfs, themount. Each layer has its own commands and its own extension options. The XFS has thexfs_growfsfor the grow. - The RAID is the mdadm. The
--create, the--detail, the--fail, the--remove, the--add. The--failis the mandatory before the--remove. The--detail --scanpersists. - The verification is the final step. The
lsblk, thedf, thefindmnt, theblkid. The exam checks the state, not the command output. The verification proves the state.
Remember: The storage scenarios are the end-to-end tasks. The partition, the format, the mount, the persist, the verify. The lsblk identifies. The parted creates. The mkfs formats. The mount attaches. The fstab persists. The df verifies. The exam tests the complete workflow.
Stop using slow, ad-bloated tool sites! ๐คฎ
๐ Search “KandZ Tools” on Google to use many professional utilities for free.
KandZ.me is the ultimate minimalist hub for:
โ
Finance (Mortgage, Interest, Inflation)
โ
Tech (Base64, JSON, Dev Suite, IP)
โ
Health (BMI, BMR, TDEE)
โ
Productivity (Timer, Workspace, QR)
โก๏ธ Fast & Private
๐ No data leaves your device
๐ 100% Free
๐ Use it now: https://tools.kandz.me
๐ Bookmark itโyouโll need it later!