Manually fsck your LVM filesystems on CentOS7

With the introduction of CentOS7 the default filesystem was changed to XFS. However XFS has some disadvantages on large filesystems. Because of this I still prefer to install my servers with EXT4. The one large drawback of sticking with EXT4 is that you occasionally need to fsck your filesystems after a crash.

Here is a short howto on getting into single user mode for CentOS7:

  • Reboot your box and wail until you’re inside the grub menu
  • hit “e” to edit your default boot item
  • Scroll down to the line that starts with something like “linux16 /…”
  • on that line replace the “ro” with: “rw init=/sysroot/bin/sh
  • ctrl+x to boot the entry

Now activate your LVM partitions and fsck them:

  • search for your volume groups: lvm vgscan
  • activate your volumes: lvm vgchange -a y
  • optionally see what you have: lvm lvs –all
  • make the nodes for mounting: lvm vgscan -v –mknodes
  • fsck you volumes like this: fsck -ys /dev/vg01/lv_*


CentOS Forcing fsck after reboot

Simply touch a file in the root of your filesystem like so, and then reboot.

While you’re at it you can specify options for fsck by adding them to /fsckoptions:

Be aware that CentOS 7 now uses XFS as a filesystem by default, things have changed – your mileage may vary