Practice Labs

Scenario-based Linux troubleshooting practice: try the problem first, then reveal a suggested investigation approach.

L1โ€“L3Lab2 min read Updated by Vishal Sharma

Lab safetyRun these on a disposable VM, not on a production server.

1. A filesystem is 95% full and growing

Task: find what is growing, free space safely and prevent a repeat.

df -hT; df -i
du -xh --max-depth=1 /var | sort -h | tail
lsof +L1
journalctl --vacuum-size=200M

Check deleted-open files, inodes and log rotation; extend the volume if the data is legitimate. Full walkthrough โ†’

2. A service is not responding after a change

Task: find out why it will not start or answer, without guessing.

systemctl status SERVICE -l --no-pager
journalctl -xeu SERVICE --no-pager | tail -40
ss -ltnp
SERVICE_BINARY -t         # config test where supported

Look at the exit status, port conflicts, permissions, SELinux and dependencies. Full walkthrough โ†’

3. Load average is high but the CPU looks idle

Task: decide whether it is CPU, I/O or memory, and find the process.

uptime; nproc
vmstat 1 5
iostat -xz 1 5
ps -eo state,pid,wchan:20,cmd | awk '$1=="D"'

High wa/b and D-state processes point at storage or NFS. Full walkthrough โ†’

4. An application suddenly cannot write: โ€œRead-only file systemโ€

Task: confirm what is read-only and decide whether it is safe to remount.

findmnt -no TARGET,OPTIONS /data
dmesg -T | grep -i -E 'remount|I/O error|EXT4-fs|XFS'
lsblk -o NAME,RO,MOUNTPOINT

Look for storage errors before repairing. Full walkthrough โ†’

5. You cannot SSH to a server (connection refused)

Task: work out which layer is at fault from another host and from the console.

nc -vz HOST 22                  # from the client: refused vs timeout
systemctl status sshd           # on the server (console)
ss -ltnp | grep ':22'
firewall-cmd --list-all
sshd -t

Refused means a host replied; a timeout usually means a firewall or routing drop. More โ†’

6. Extend /var by 10 GB online

Task: add space to a mounted LVM logical volume without downtime.

vgs; lvs; lsblk
vgextend vg01 /dev/sdc          # only if the VG has no free space
lvextend -r -L +10G /dev/vg01/lv_var
df -h /var

Check vgs first. Extending LVM โ†’