0
0
Linux CLIscripting~20 mins

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

Choose your learning style9 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.