Bird
Raised Fist0
Linux CLIscripting~20 mins

Why disk management prevents outages in Linux CLI - Challenge Your Understanding

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Disk Management Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
Disk usage monitoring command output
You run the command df -h / on a Linux server to check disk usage of the root partition. What is the expected output format?
Linux CLI
df -h /
A
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 50G 30G 20G 150% /
B
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 50G 60G 20G 120% /
C
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 50G 30G 20G 60% /
D
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 50G 30G 20G 0% /
Attempts:
2 left
💡 Hint
Disk usage percentages cannot exceed 100%.
🧠 Conceptual
intermediate
1:30remaining
Why monitoring disk space prevents outages
Why does monitoring disk space usage help prevent system outages?
ABecause it allows administrators to free up space before the disk is full, avoiding system crashes.
BBecause it automatically deletes files when disk space is low.
CBecause it increases the disk size without manual intervention.
DBecause it disables all running services when disk space is low.
Attempts:
2 left
💡 Hint
Think about what happens when a disk is completely full.
🔧 Debug
advanced
2:30remaining
Identify the error in disk space alert script
This script is intended to alert when disk usage exceeds 90%. What error causes it to never alert?
usage=$(df / | tail -1 | awk '{print $5}' | sed 's/%//')
if [ $usage -gt 90 ]
then
  echo "Disk usage critical: $usage%"
fi
Linux CLI
usage=$(df / | tail -1 | awk '{print $5}' | sed 's/%//')
if [ $usage -gt 90 ]
then
  echo "Disk usage critical: $usage%"
fi
AThe variable $usage is treated as a string, causing the numeric comparison to fail.
BThe sed command removes the percent sign incorrectly, leaving a non-numeric value.
CThe if statement syntax is incorrect; it needs double brackets [[ ]] for numeric comparison.
DThe script works correctly and will alert when usage is above 90%.
Attempts:
2 left
💡 Hint
Check how shell compares numbers inside single brackets.
🚀 Application
advanced
3:00remaining
Automate disk cleanup to prevent outages
Which script snippet safely deletes only log files older than 30 days in /var/log to free disk space?
Arm /var/log/*.log -mtime +30
Bfind /var/log -type f -name '*.log' -mtime +30 -exec rm {} \;
Cfind /var/log -name '*.log' -delete
Dfind /var/log -type f -name '*.log' -mtime -30 -exec rm {} \;
Attempts:
2 left
💡 Hint
Use find with -mtime to select files older than 30 days.
🧠 Conceptual
expert
3:00remaining
How disk management strategies prevent outages in production
Which of the following best explains how disk management strategies prevent outages in production systems?
ABy proactively monitoring disk usage, automating cleanup, and alerting admins, systems avoid crashes caused by full disks.
BBy disabling all write operations when disk usage reaches 80%, preventing data loss.
CBy automatically increasing disk size without human intervention to handle any load.
DBy moving all data to RAM to avoid disk usage entirely.
Attempts:
2 left
💡 Hint
Think about practical, reliable ways to keep systems running smoothly.

Practice

(1/5)
1. Why is regular disk management important to prevent system outages?
easy
A. It helps avoid running out of disk space and system crashes.
B. It makes the computer run faster by increasing CPU speed.
C. It changes the screen resolution automatically.
D. It updates the operating system without user permission.

Solution

  1. Step 1: Understand disk space impact

    Running out of disk space can cause programs to fail and the system to crash.
  2. Step 2: Recognize disk management role

    Disk management monitors and frees space to keep the system stable.
  3. Final Answer:

    It helps avoid running out of disk space and system crashes. -> Option A
  4. Quick Check:

    Disk space management prevents crashes = B [OK]
Hint: Disk space full? System crashes. Manage disks to prevent that. [OK]
Common Mistakes:
  • Confusing disk management with CPU or display settings
  • Thinking disk management updates software automatically
  • Ignoring disk space as a cause of outages
2. Which Linux command correctly shows disk usage of all mounted filesystems?
easy
A. top
B. ls -l
C. df -h
D. ps aux

Solution

  1. Step 1: Identify command purpose

    The df command reports disk space usage; -h makes it human-readable.
  2. Step 2: Compare other commands

    ls -l lists files, top shows processes, ps aux lists running processes.
  3. Final Answer:

    df -h -> Option C
  4. Quick Check:

    Disk usage command = df -h [OK]
Hint: Use df -h to check disk space in human-friendly format. [OK]
Common Mistakes:
  • Using ls or ps commands to check disk space
  • Forgetting the -h option for readable sizes
  • Confusing process commands with disk commands
3. What is the output of the command lsblk on a Linux system?
medium
A. Prints the contents of the current directory.
B. Shows current CPU usage statistics.
C. Displays network interface details.
D. Lists all block devices like disks and partitions.

Solution

  1. Step 1: Understand lsblk command

    lsblk lists block devices such as hard drives and their partitions.
  2. Step 2: Eliminate unrelated outputs

    CPU stats, network info, and directory contents are shown by other commands like top, ifconfig, and ls.
  3. Final Answer:

    Lists all block devices like disks and partitions. -> Option D
  4. Quick Check:

    lsblk shows disks and partitions = A [OK]
Hint: lsblk lists disks and partitions clearly. [OK]
Common Mistakes:
  • Confusing lsblk with commands showing CPU or network info
  • Expecting file listings instead of device info
  • Assuming lsblk modifies disks instead of listing
4. You run df -h and see 100% usage on /dev/sda1. What is the best immediate action to prevent outages?
medium
A. Change the screen resolution to reduce load.
B. Delete unnecessary files or move data to free space.
C. Run top to kill CPU-heavy processes.
D. Restart the computer immediately without checking disk.

Solution

  1. Step 1: Analyze disk full problem

    100% disk usage means no free space, risking crashes and data loss.
  2. Step 2: Choose proper action

    Deleting or moving files frees space immediately; restarting or changing screen resolution won't fix disk space.
  3. Final Answer:

    Delete unnecessary files or move data to free space. -> Option B
  4. Quick Check:

    Free disk space to prevent outages = D [OK]
Hint: Free disk space first to avoid crashes. [OK]
Common Mistakes:
  • Restarting without fixing disk space
  • Confusing CPU load with disk space issues
  • Trying unrelated fixes like screen changes
5. You want to automate disk checks to prevent outages. Which script snippet correctly checks disk usage and warns if usage exceeds 90% on /dev/sda1?
hard
A. usage=$(df /dev/sda1 | tail -1 | awk '{print $5}' | sed 's/%//'); if [ "$usage" -gt 90 ]; then echo "Warning: Disk usage above 90%"; fi
B. usage=$(top -b | grep sda1); if [ "$usage" -gt 90 ]; then echo "Warning"; fi
C. usage=$(lsblk /dev/sda1); if [ "$usage" -gt 90 ]; then echo "Warning"; fi
D. usage=$(ps aux | grep sda1); if [ "$usage" -gt 90 ]; then echo "Warning"; fi

Solution

  1. Step 1: Extract disk usage percentage correctly

    The command df /dev/sda1 shows disk usage; awk '{print $5}' gets the percent; sed 's/%//' removes the percent sign.
  2. Step 2: Use conditional to warn if usage > 90%

    The if statement compares usage as a number and prints a warning if above 90.
  3. Final Answer:

    usage=$(df /dev/sda1 | tail -1 | awk '{print $5}' | sed 's/%//'); if [ "$usage" -gt 90 ]; then echo "Warning: Disk usage above 90%"; fi -> Option A
  4. Quick Check:

    Correct disk usage check and warning = A [OK]
Hint: Use df and awk to get usage, then compare with if. [OK]
Common Mistakes:
  • Using unrelated commands like top or ps for disk usage
  • Not removing % sign before numeric comparison
  • Incorrect syntax in if statement
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard