| |

LFCS 164 ๐Ÿง LFCS Practice Scenarios โ€” Storage

โฑ๏ธ Estimated read: 10 min | |

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

CommandPurpose
parted mklabelCreate the partition table
parted mkpartCreate the partition
partprobeReread the table
mkfs.ext4 -LFormat with the label

Mount Commands

CommandPurpose
mount <dev> <dir>Mount the filesystem
umount <dir>Unmount
mount -aMount the fstab entries
blkidShow the UUID
findmntShow the mount tree

LVM Commands

CommandPurpose
pvcreatePhysical volume
vgcreateVolume group
lvcreate -L -nLogical volume
lvextend -LExtend
xfs_growfsGrow the XFS

RAID Commands

CommandPurpose
wipefs -aClear the signatures
mdadm --createCreate the array
mdadm --detailShow the state
mdadm --failMark the disk failed
mdadm --removeRemove the disk
mdadm --addAdd 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

PitfallWhy It HappensFix
Mount lost on rebootNo fstab entryAdd the entry
fstab fails to mountWrong UUID or typeVerify with blkid
LVM extend failsNo free space in VGvgextend or lvextend
RAID sync slowDefault speedspeed_limit_min
Kernel does not see the partitionNo partprobeRun 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

ItemValue
Partitionparted
Formatmkfs.ext4, mkfs.xfs
Mountmount, /etc/fstab
LVM physicalpvcreate
LVM volume groupvgcreate
LVM logical volumelvcreate
LVM extendlvextend, xfs_growfs
RAID createmdadm --create
RAID persist/etc/mdadm.conf
Verificationlsblk, df, blkid

Key takeaways:

  • The persistence is the trap. The mount is the runtime. The /etc/fstab is the persistent. The mdadm --create is the runtime. The /etc/mdadm.conf is the persistent. The exam tests the persistence.
  • The UUID is the device name stability. The /dev/sdb1 can change between the reboots. The UUID=... in the /etc/fstab is the stable reference. The blkid -s UUID -o value extracts the UUID.
  • The LVM stack is the layers. The pvcreate, the vgcreate, the lvcreate, the mkfs, the mount. Each layer has its own commands and its own extension options. The XFS has the xfs_growfs for the grow.
  • The RAID is the mdadm. The --create, the --detail, the --fail, the --remove, the --add. The --fail is the mandatory before the --remove. The --detail --scan persists.
  • The verification is the final step. The lsblk, the df, the findmnt, the blkid. 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.

Was this helpful?


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!