Based on the Linux Master 1 exam syllabusReport an error
mdadm, and its status is viewed in /proc/mdstat (U=healthy, _=failed).quotacheck → quotaon → edquota. Soft is grace/warning, hard blocks immediately.Two real-world threats remain. Disks eventually fail (single point of failure), and users can hog disk space without limit. RAID solves the former, and quotas solve the latter.
| Level | Method | Min. disks | Fault tolerance (failures allowed) | Capacity efficiency | Features |
|---|---|---|---|---|---|
| 0 | Striping | 2 | 0 (if one dies, everything is lost) | 100% | Fastest, no safety |
| 1 | Mirroring | 2 | 1 | 50% | Exact copy, fast reads |
| 5 | Striping + distributed parity | 3 | 1 | (N-1)/N | Loses one disk's worth to parity |
| 6 | Striping + double parity | 4 | 2 | (N-2)/N | Loses two disks' worth to parity |
| 10 | 1+0 (mirror + stripe) | 4 | 1 per pair | 50% | Fast and safe, expensive |
Parity is "the XOR sum of the data". If you store the XOR of the data blocks as parity, then when one disk dies you can XOR the remaining data and the parity again to restore the lost block. RAID 5 distributes parity across all disks, and RAID 6 keeps two different parities so it recovers even if two disks die at once. RAID 0 and 1 do not use parity.
RAID 5's capacity efficiency is (N-1)/N — with 3 disks, the capacity of 2 disks (67%), with parity taking one disk's worth. RAID 6 is (N-2)/N — with 4 disks, 2 disks' worth (50%). With RAID 1 and 10, half (50%) is consumed by replicas. RAID 0 is 100% but has zero safety, so it is never used alone for storing data. The "capacity efficiency vs safety" trade-off is the essence of choosing a level.
⚠️ Pitfall: The minimum disk count easily becomes a trap — RAID 0 and 1 need 2 disks, RAID 5 needs 3, RAID 6 and 10 need 4. Choices that make you mistake the "RAID 5 minimum disks" for 2 are common. At least 3 are needed for distributing parity. Wrong statements such as "RAID 1 uses parity" are also used as wrong answers — RAID 1 is simple replication (mirror), so it has no parity.
RAID 10 and RAID 0+1 are different. RAID 10 (1+0) is "stripe the mirrored pairs", while RAID 0+1 is "mirror the striped sets". RAID 10 is more robust for failure recovery — RAID 10 survives one disk dying in each mirror pair, whereas RAID 0+1 is at risk if one stripe set breaks entirely. In practice, "RAID 10" usually means 1+0.
Linux can build software RAID with mdadm even without a hardware RAID controller. The resulting devices look like /dev/md0, /dev/md1.
# Create RAID 5 (3 disks)
mdadm --create /dev/md0 --level=5 --raid-devices=3 /dev/sdb1 /dev/sdc1 /dev/sdd1
# Check status
mdadm --detail /dev/md0 # Array details (state, disk roles)
cat /proc/mdstat # Summary of all md arrays + sync progress
# Handling a disk failure
mdadm /dev/md0 --fail /dev/sdb1 # Mark the disk as faulty
mdadm /dev/md0 --remove /dev/sdb1 # Remove from the array
mdadm /dev/md0 --add /dev/sde1 # Add a new disk → automatic rebuild
# Make the configuration permanent
mdadm --detail --scan >> /etc/mdadm.conf # Save array info--level specifies the RAID level and --raid-devices the number of disks. The RAID device you create (/dev/md0) is formatted with mkfs.ext4 /dev/md0 and mounted like any ordinary block device. In other words, RAID is a layer below the filesystem. When used with LVM, you usually put LVM on top of RAID (md → PV → VG → LV).
⚠️ Pitfall:
/proc/mdstatis the fastest window into RAID status. When a rebuild is in progress after replacing a disk, a progress bar and a status like[UU_]are shown here.U=healthy,_=failed/rebuilding. "Which file shows software RAID status?" →/proc/mdstatis the answer.
# Try it yourself — observing RAID (when an md array exists)
cat /proc/mdstat # Array status/sync
mdadm --detail /dev/md0 # Details
lsblk # Disk-md relationship tree| Limit | Meaning |
|---|---|
| soft limit | Exceeding it does not block immediately; it gives a warning. Allowed during the grace period |
| hard limit | Absolute ceiling. Beyond this, writing itself is refused |
Quota application flow:
# 1) Add the quota options to fstab, then remount
# /dev/sdb1 /home ext4 defaults,usrquota,grpquota 0 2
mount -o remount /home
# 2) Create the quota database files (scan)
quotacheck -cugm /home # -c create -u user -g group -m force
# 3) Enable quotas
quotaon /home # Disable with quotaoff
# 4) Edit per-user limits (opens an editor)
edquota -u user1 # Edit user1's soft/hard limits
edquota -g group1 # Edit group quota
edquota -t # Set the grace period
# 5) Verify
quota -u user1 # A specific user's usage/limits
repquota /home # Quota report for the whole filesystemTo use quotas, you must first give the usrquota/grpquota options in fstab (or mount). Running only quotaon without the options will not enable them. Then create the quota database (aquota.user, aquota.group) with quotacheck and turn it on with quotaon. Order: fstab option → remount → quotacheck → quotaon → edquota. This order appears on the exam.
Be clear on the difference between soft and hard. With the soft limit, writing is still allowed during the grace period even after exceeding it but a warning appears; once the grace period passes, soft acts like hard and blocks. The hard limit blocks immediately with no grace. "Which limit gives only a warning with a grace period?" → soft limit.
Quotas set a block (capacity) limit and an inode (file count) limit separately. When opened with edquota, the blocks column and the inodes column each split into soft/hard. So it is possible to be unable to create more because you hit the file-count quota "even though capacity remains". repquota -a shows the quota status of all filesystems at once.
The five key tools for diagnosing the state of storage devices are distinguished by "what they show".
| Tool | What it shows | Unit/viewpoint |
|---|---|---|
| df | Total/used/free capacity per filesystem | Per mounted FS |
| du | Space actually occupied by directories/files | Per path |
| lsblk | Block device tree (disk-partition-mount) | Device hierarchy |
| blkid | A device's UUID, type, label | Device identification |
| fsck | Filesystem integrity check and repair | FS consistency |
# df — filesystem capacity
df -h # Human-readable units (G/M)
df -i # Inode usage
df -T # Including filesystem type
# du — actual usage per path
du -sh /var/log # Directory total (summary)
du -h --max-depth=1 / # Usage per first-level subdirectory
du -ah /tmp | sort -rh | head # Largest first
# lsblk / blkid — device identification
lsblk -f # FSTYPE, UUID, mount point
blkid /dev/sdb1 # UUID and TYPE
# fsck — integrity check (must be unmounted!)
umount /dev/sdb1
fsck /dev/sdb1 # Check (interactive repair)
fsck -y /dev/sdb1 # Answer yes to all questions (automatic repair)
fsck -f /dev/sdb1 # Force check even if it looks cleanThe difference between df and du is easy to confuse. df reads filesystem metadata and quickly reports "how much capacity is left on the whole FS", while du walks the directories directly and computes "how much this path actually occupies". Sometimes their totals disagree (files that are deleted but still open by a process, etc.), and that discrepancy is itself a diagnostic clue.
fsck must be run while unmounted (or read-only). Checking while mounted can damage the filesystem because it changes during the check. The root filesystem normally can't be unmounted, so it is checked at boot time or in recovery mode (the pass in the 6th field of fstab is this check order). "What if you run fsck on a mounted FS?" → Risk of damage.
fsck is a front end that calls fsck.<type> (e.g., fsck.ext4=e2fsck, fsck.xfs). Interestingly, xfs's fsck.xfs does nothing (returns success immediately) — because xfs establishes consistency by replaying the journal at mount time, and actual repair uses a separate tool called xfs_repair. "What tool checks and repairs xfs?" → xfs_repair.
The pattern du -ah /var | sort -rh | head -20 is commonly used in practice to find large directories. The flow of when the disk is full (confirm with df) → who is the culprit (trace with du) → clean up is an operator's fundamental skill. Note, though, that du walks every directory, so it can be slow on large volumes.
Next, Day 5 comprehensively reviews all of Week 5 and wraps up with practice questions.
/dev/md0./proc/mdstat : The file showing software RAID array status and rebuild progress. U=healthy, _=failed.edquota -t.quotacheck / quotaon : The command that creates the quota database and the command that enables quotas.repquota : The command that prints a quota usage report for the whole filesystem.df vs du : Viewing total capacity through filesystem metadata versus walking paths to count actual usage.fsck : A front end that checks and repairs filesystem integrity. Always run it while unmounted.xfs_repair : The xfs-only repair tool. fsck.xfs does nothing.Click a choice to reveal the answer and explanation.
Question 1
Which correctly gives the minimum number of disks to configure RAID 5 and the number of simultaneous disk failures it can tolerate?
Question 2
Which statement about RAID levels is NOT correct?
Question 3
Which lets you check the current state and sync progress of a software RAID array?
Question 4
Which correctly describes the difference between the soft limit and the hard limit of a disk quota?
Question 5
Which most accurately describes the difference between the df and du commands?
Question 6
What is the correct order of steps to apply disk quotas?
Question 7
Which is a requirement that must be observed when checking the ext4 filesystem /dev/sdb1 with fsck?