Operating Systems
After a power failure, a Linux workstation drops to an emergency shell because the root filesystem reports errors. The technician has booted from live media and the partition /dev/sda2 is NOT mounted. Which command should be run to check and repair it?
Show the answer
Correct answerA. fsck /dev/sda2
AWhy this is right: fsck checks and repairs filesystem inconsistencies on an unmounted device, which is what the power failure caused.
BWhy not this: sudo runs a command with elevated rights; a device path is not a command, so nothing is checked.
CWhy not this: mount attaches the filesystem to a directory; it does not repair errors and may mount a damaged volume.
DWhy not this: su switches user accounts; a device path is not a valid user, so it does not repair anything.
fsck checks and repairs filesystem consistency and should be run on an unmounted partition such as /dev/sda2. mount only attaches a filesystem to the directory tree and does not repair anything.