Have many systems with ext4 directly on the block device and others on lvm. I routinely create new systems with ext4 directly on the block device and use tune2fs to have automatic filesystem checks. In older versions of CentOS such as 4,5, or 6, i could do the same with ext filesystems on LVM, but not with newer versions. What is the best practice set of commands to make certain that filesystems are checked when they reside on LVM?
What is the best way to ensure a lvm volume is not corrupt? How to run fsck against a LVM filesystem? Is there something built in to lvm to automatically check the fs? If so, which logfile entry actually proves a check was done?
- Boot into single user mode, stop the diskmapper service and run
mount
to make certain all lvm volumes are NOT mounted.fsck /dev/mapper/vg0
with what parameters? - Or boot from a LiveCD
/
that does not automatically mount LVM and run fsck from there?
Is there a way to use tune2fs for an ext filesystem on LVM? The most frequent way i have filesystem checks run is to have the OS do them automatically upon startup at regular intervals via tune2fs: tunefs -c 5 -i 7days /dev/sda1
but that does not work with lvm.
If fsck is the way, what switches does one pass to it? Without lvm, i fsck -c -c -D -C0 /dev/sda1
to get badblocks out of the picture and optimize folder structure. What lvm commands should be run before running the fsck?
Most of the documentation I have referenced in the past is not available.