LPIC-1 Administrative Tasks Practice Question
A server has a backup script that runs daily at midnight. The system administrator notices that the script sometimes fails because the filesystem is mounted read-only. Which approach is the best practice to ensure the script runs only when the filesystem is writable?
⚠ Common exam trap
Many candidates assume remounting (Option A) is a safe fix, but LPIC-1 emphasizes that a read-only filesystem often indicates a deeper problem, and the best practice is to check state rather than force a change.
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
✓
Wrap the backup command in a script that checks if the filesystem is writable before proceeding
It implements a proactive check within the script itself, using a command like `touch /mountpoint/testfile 2>/dev/null` or checking `/proc/mounts` to verify write access before executing the backup. This avoids unnecessary remounts and ensures the script only proceeds when the filesystem is writable, which is a robust and self-contained solution.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Add a cron job that runs before the backup to remount the filesystem read-write
Why it's wrong here
Remounting read-write via cron masks the underlying fault and risks writing to a filesystem the kernel remounted read-only after detecting errors, potentially worsening corruption. It is tempting as an automated workaround, but remounting read-write is a manual recovery action after the cause is resolved, not a scheduled prerequisite.
- ✗
Use anacron to run the job after boot
Why it's wrong here
Anacron runs missed jobs after boot based on elapsed days, not on filesystem writability, so the backup could still execute against a read-only mount. It is tempting because anacron handles downtime, but it is designed for machines not running continuously, not for gating jobs on mount state.
- ✓
Wrap the backup command in a script that checks if the filesystem is writable before proceeding
Why this is correct
Testing writability with a command such as touch or mount before invoking the backup prevents failures caused by a read-only remount. The wrapper aborts cleanly instead of leaving a partial archive, directly addressing the intermittent read-only filesystem constraint.
- ✗
Change the cron job to run every hour until it succeeds
Why it's wrong here
Hourly retries do not test writability and will keep failing while the filesystem stays read-only, while also spawning repeated backup attempts. It is tempting as a persistence tactic for transient failures, but it suits intermittent network or lock contention, not a kernel-enforced read-only mount requiring diagnosis.
Go deeper
Related to this question
About these practice questions
Courseiva writes every LPIC-1 question from scratch — 402 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or 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 LPIC-1 practice question is part of Courseiva's free LPI 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 LPIC-1 exam.