Rocky 9 install : existing logical volumes are not visible

I think this is something unique to your system that you had to do this. I created raid+lvm under Rocky 8, then disconnected the disks, and connected them to Rocky 9 and it was accessible as soon as I activated the mdadm.

As you found, mileage varies, what works for one person, not necessarily another. The good think is you were able to use lvmdevices to add the device and then the vgchange command to activate it. Maybe mine just worked because it was created under Rocky 8, rather than using LVM under CentOS 7. Perhaps that had something to do with it, perhaps not.

Iā€™ve had varying issues with lvm, also had one inaccessible once, and was just enough to use vgchange to activate it. Others it was irrecoverable due to metadata loss but was able to get it back from a backup. So itā€™s handy to make a list of commands used that helped resolve it, just in case for the future you might need them again.

1 Like

Thank you guys. This works great.
And This is for the posterity.

$ lvmdevices --addev /dev/sdb1
$ lvmdevices --addev /dev/sdb2
$ vgchange -ay vg-datastore

After this command, the system.devices file changed which contains the info above.

My lvm vg was made via Rocky linux 8.
This command is not for raid, but works.

1 Like

Hello,
Iā€™ve been a CentOS user since V4 and I loved it when Rocky started up.
Iā€™ve been on Rocky since its beginning.
But Iā€™ve now been motivated by this thread.
My home server (web/file) has gone from CentOS V4 up to Rocky 8.7.
Of course it is and old server so I decided to upgrade.
Its now on Rocky 9.1.
All of my /home content is on a LV.
After installing Rocky 9.1 fresh on the new server I did the following on the old one to move the disks over:

systemctl stop httpd smb
umount /home
vgchange -an vg_home
vgexport vg_home

I then removed the drives and installed them on the new server and did:

systemctl stop httpd
pvscan

And NOTHING of these drives was visible.

found I could use gdisk and see them but LVM couldnā€™t see anything.
So before I reformatted them I ran across this thread and used the

lvmdevices --adddev /dev/sd<1>
lvmdevices --adddev /dev/sd<2>

After that, pvscan could see them and i was able to vgimport, vgchange and mount it.

Saved recovering 7TB of data.

So LVM has more rules about what it can and canā€™t pay attention to, at least between Rock 8.7 and 9.1 (RHEL 8.7 RHEL 9.1).

Thanks to All of you for the FANTASTIC work.

1 Like

Hello guys,
I just had the same problem (after reinstaling CentOS 7 machine to Rocky 9), so thank you all for solution!

I had to use:

lvmdevices --adddev /dev/sdx

For pvscan and vgscan to see the old lvm, and then I was able to read its name and activate it:

vgscan 
vgchange -ay centos_xxx
2 Likes

@prazape fantastic!

My ā€œ/dev/mapper/rl-homeā€ (/home) disappearedā€¦ I commented ā€œfstabā€ to Rocky Linux work again.

With your comands:
lvmdevices --adddev /dev/nvme01xxxx (SSD)
Next
vgscan
(show rl group)
Next
vgchange -ay rl

So I uncommented fstab (/dev/mapper/rl-home) and the magic happened :slight_smile:

Thanks!