mediumMultiple Choice
XK0-006 Practice Question: A system is running out of disk space in the…
A system is running out of disk space in the /var/log directory. The administrator needs to temporarily free up space while preserving the latest log entries. Which approach is best?
⚠ Common exam trap
CompTIA often tests the misconception that deleting old files with find or truncating a log file is a safe way to free space, but the correct approach is to use logrotate to manage log rotation and compression while preserving the latest entries.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Run logrotate with compression enabled
Logrotate with compression is the best approach because it rotates, compresses, and optionally removes old log files while preserving the latest entries. It can be configured to keep a specific number of rotated logs, thus freeing disk space without deleting current logs. This matches the requirement to temporarily free up space while retaining the most recent log data.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
Run logrotate with compression enabled
Why this is correct
Compression shrinks rotated logs while retaining the most recent entries, freeing space in /var/log without deleting current data. Running logrotate satisfies the constraint of temporarily reclaiming disk space while preserving the latest log entries, unlike outright deletion.
- ✗
find /var/log -mtime +7 -delete
Why it's wrong here
Deletes logs older than 7 days, but does not compress.
- ✗
cat /dev/null > /var/log/messages
Why it's wrong here
Truncating /var/log/messages empties that single file, discarding its latest entries rather than preserving them, and leaves other large logs untouched. It is tempting because truncation frees space without deleting the file, which suits clearing one known log when its contents are no longer needed.
- ✗
rm -rf /var/log/*
Why it's wrong here
Deleting every file under /var/log destroys all log data, including the latest entries the task requires preserving, and removes active log files that running services hold open. It is tempting as a fast space reclamation method, but that is appropriate only when logs are expendable and no retention requirement applies.
About these practice questions
This XK0-006 question is part of Courseiva's 781-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This XK0-006 practice question is part of Courseiva's free CompTIA certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the XK0-006 exam.