Linux /var Real-World Scenario Quiz

10 scenario-based questions for Sys Admin, DevOps, and SRE practice

Goal: Practice real troubleshooting decisions for /var, including logs, Docker storage, package cache, databases, web roots, and dangerous cleanup commands.
Total Questions
10
Answered
0
Score
0
Timer
10:00

Result

Scenario 1 Not answered

You receive an alert: Filesystem /var is 95% full. Which command should you run first to find what is taking space?

Explanation: First investigate the disk usage. The du command with --max-depth=1 shows which first-level folders inside /var are using space. Never delete or compress blindly.
Scenario 2 Not answered

Your web server is working, but /var/log is growing very fast. Which command helps check the total size of /var/log?

Explanation: sudo du -sh /var/log shows the total size of the log directory in human-readable format.
Scenario 3 Not answered

A DevOps server running Docker has low disk space. You suspect Docker is using too much storage. Where is Docker data commonly stored?

Explanation: Docker commonly stores images, containers, layers, volumes, and other runtime data under /var/lib/docker.
Scenario 4 Not answered

Your CI runner has many unused Docker images and stopped containers. Which command should you run first to check Docker disk usage?

Explanation: docker system df safely shows Docker disk usage before cleanup. After reviewing it, you can decide whether docker system prune is needed.
Scenario 5 Not answered

Your Ubuntu server has a large /var/cache/apt directory. Which command safely cleans the package cache?

Explanation: On Ubuntu/Debian, sudo apt clean safely removes downloaded package cache files.
Scenario 6 Not answered

Your RHEL server has a large /var/cache/dnf directory. Which command should you use to clean package cache?

Explanation: On RHEL/Fedora systems, sudo dnf clean all cleans DNF package cache safely.
Scenario 7 Not answered

A MySQL database stores data in /var/lib/mysql. You want to back it up. What is the safest approach?

Explanation: Database files change while the database is running. Use proper backup tools like mysqldump, or stop the service before taking a file-level backup.
Scenario 8 Not answered

An application is actively writing logs to /var/log/app.log. What is the best practice for compressing logs?

Explanation: logrotate is the correct tool for managing logs. It rotates active logs and compresses old logs safely.
Scenario 9 Not answered

Apache/NGINX is running, but the website shows a blank or default page. Which common default web root should you check first?

Explanation: /var/www/html is commonly used as the default web root in many Apache and NGINX labs. The exact path still depends on server configuration.
Scenario 10 Not answered

A junior admin suggests running sudo rm -rf /var/* to fix disk space. What should you say?

Explanation: /var contains logs, databases, Docker data, package manager data, mail, web files, and service state. Deleting everything can seriously damage the system.