We want to check the filesystem on the disks as /deb/sdc
... /dev/sdg
on each Red Hat Linux machine.
The target is to find what are the disks that require e2fsck
( as e2fsck -y /dev/sdb
etc.)
According to man page
-n
Open the filesystem read-only, and assume an answer of 'no' to all questions. Allowse2fsck
to be used non-interactively. This option may not be specified at the same time as the-p
or-y
options.
When we run the command (example)
e2fsck -n /dev/sdXX
we get
e2fsck 1.42.9 (28-Dec-2013) Warning! /dev/sdc is mounted. Warning: skipping journal recovery because doing a read-only filesystem check. /dev/sdc: clean, 94/1310720 files, 156685/5242880 blocks
So what do we need to capture from e2fsck -n
output, that requires us to run e2fsck
(without -n
)?
e2fsck process
init 1
umount /dev/sdXX
e2fsck -y /dev/sdXX # (or e2fsck -C /dev/sdXX for full details)
init 3