0

I have a friend who has a system that was configured with Centos 7. He can't tell me exactly what he did, but he didn't have enough space to install a piece of software and he was looking at the size of the partitions and somehow he thinks he might have renamed the LVM volume, although he doesn't even know what an LVM volume is.

The machine won't boot anymore, it just hangs and has to be shutdown and restarted. One other big problem is that it appears it was setup with the /boot partition on the LVM volume, and it can't mount the LVM volume.

Booting from installation media using the "Troubleshooting" selection can't find the existing Linux installation and just crashes out. The only way I can boot is to skip the check for the existing install and just get a command prompt. After doing that when I run pvscan, or lvscan, it says it can't find any LVM volumes. I can run sfdisk and look at the linux drive and I see three partitions, one is the EFI, one is a data partition which looks to be formatted in a Windows format, and the LVM volume. I don't see any issues with the partition table.

If I can get it up and running again, I'll move the /boot partition to a dedicated partition (non LVM), but for now, how can I get the LVM volume mounted?

0

First, the fact that the partition type says "Linux LVM" does not guarantee that the actual contents of the partition match that. Use file -s <PV device> to see what the contents actually are. Example (anonymized) output from an intact LVM PV:

# file -s /dev/sda3
/dev/sda3: LVM2 PV (Linux Logical Volume Manager), UUID: xxxxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxxxx, size: nnnnnnnnnnnn

Likewise, if the partition type is reported as Microsoft basic data, it won't necessarily mean that; it might just be that CentOS sets the type of the /boot partition that way. I guess it might be to work around some bug in some early UEFI firmware version that was deemed important enough to work around automatically at the time of initial release of RHEL 7 the CentOS is based on?

Try running vgscan -vv to explicitly make LVM try and recognize the PV on the disk. When run with -vv, it should produce plenty of debug output you can use to verify that it actually looks at the right disk, and whether it sees anything LVM-like on it or not.

To gain access to the LVM logical volumes, you'll need to activate them first, with vgchange -ay, or one by one with lvchange -ay <name of LV>.

Normally, that should make the device nodes of the LVM volumes available for use, but in a rescue environment you might have to run vgscan --mknodes to generate them explicitly.

If the name of a LV or the VG it's in has been changed, you'll have two options: either to change it back to what it was, or to fix the configuration referring to it. I would guess that the places you'll need to look at are the root= option on the line that defines the kernel boot options in GRUB configuration file at /boot/grub/grub.cfg (or <mountpoint>/grub/grub.cfg if a separate /boot partition exists and you mount it into a temporary location for fixing it), and /etc/fstab.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.