Running CentOS 7.9, I seen computer freeze for many times and I want to check disk for errors. I am not sure I am doing it correctly or what the command output means. I created a Centos install disk with same version (7.9) and I booted from that...

fdisk -l (photo 1) shows "Linux LVM" as second partition, this should be my root.

Running fsck /dev/centos/root said I should seee xfs_repair (photo 2), so I assume this is the one to run ?

I ran lvscan and got a list of paritions

ran lvchange -ay /dev/centos/root trying to activate the partition in order to check it (?!)

ran xfs_repair /dev/centos/root (photo 2), at this point it is unclear to me if it didn't do a proper check or if there were no errors (photo 2, 3, 4).

also ran xfs_repair /dev/centos/swap (the other parition listed by lvscan) to compare the results, for this one I got (photo 5) ... error reading superblock, unable to verify superblock, Sorry, could not find a valid secondary superblock.

Does this mean that root partition was OK and there are some errors in swap ? If not, how do I run a proper check with this partition setup ?

enter image description here enter image description here enter image description here enter image description here enter image description here

1 Answer 1


No need to worry.

Looks like your xfs_repair /dev/centos/root did not find anything wrong: all the messages from xfs_repair are just descriptions of what it's doing at the moment.

Your swap is not a XFS filesystem, and so xfs_repair was not the right tool for it. That fully explains the errors it displayed. In fact, swap is not a filesystem at all.

Unless you use your swap for hibernation, there is very little that can go wrong with swap and survive a reboot. When a system is booted normally (and not resumed from hibernation), basically only the swap area header (that identifies it as a swap area and contains an UUID and optionally a label for it) is kept: the rest of the swap area is effectively initialized if and when it's needed after a reboot.

You have a LVM-based filesystem layout: your swap area and root filesystem are contained in LVM logical volumes, or LVs for short. Unlike classic partitions, LVs can extend from one disk to another, and don't necessarily have to be contiguous on disk. They can even be moved around while in use. All of this makes LVs easier to resize and otherwise manage when needed.

Modern Linux distributions usually activate any intact LVs they can detect automatically on boot and on hot-plug. But running the activation command manually should never be harmful, and it's good to know how to do it, in case you have to operate within a minimalist recovery environment, or need to recover data from a LV that has a part missing (there is a --partial option to lvchange to enable activating a LV even if some parts of it are missing).

  • I didn't knew a LVM partition can be made out of multiple drives. Do you know if this can be used to speed up the storage ? (like a raid)
    – adrianTNT
    Sep 21, 2021 at 22:12
  • Yes, LVM supports RAID0 and some other RAID modes. Check man lvconvert for details. A LVM volume group should be considered as a "pool of storage": you add one or more whole disks or classic partitions as LVM PVs into a volume group to get a pool of storage you can then present as one or more LVs. If using just as a JBOD, then you don't usually need to care about the PV(s) the LV is located on; but RAID modes may place additional requirements. For striping, you'll need to have PVs on two or more separate physical disks in order to get any advantage.
    – telcoM
    Sep 22, 2021 at 10:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .