Need to migrate all logical volumes from one MBR Rocky 9 host/SSD to a new Rocky 9 install on another host/SSD (going from MBR to UEFI w/XFS)

Hi-

I’m faced with converting a Centos 7.9 SSD install and a Rock 9.2 SSD install from MBR to UEFI/GPT. Both use XFS file system for all partitions/LVM, ie. here’s info from the old source SSD (Rocky 9 here):
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 2099199 2097152 1G 83 Linux
/dev/sda2 2099200 2000408575 1998309376 952.9G 8e Linux LVM

and parted:
[root@hostname ~]# parted
GNU Parted 3.5
Using /dev/sda
Welcome to GNU Parted! Type ‘help’ to view a list of commands.
(parted) p
Model: ATA KINGSTON SKC6001 (scsi)
Disk /dev/sda: 1024GB
Sector size (logical/physical): 512B/4096B
Partition Table: msdos
Disk Flags:

Number Start End Size Type File system Flags
1 1049kB 1075MB 1074MB primary xfs boot
2 1075MB 1024GB 1023GB primary lvm

so I cannot easily add a UEFI/GPT partition to my knowledge, as one cannot shrink XFS. I would rather not reinstall all the software/configs on the new host from scratch.

Taking the Rocky 9.2 case (I assume the Centos 7.9 procedure will be nearly indentical (?)), I would prefer instead to install Rocky 9.2 fresh from the DVD on a new SSD (same exact size as older one) so as to install UEFI/GPT, and then take a backup of the entire volume group from the old MBR/legacy disk and restore it to the new UEFI/GPT Rocky 9.2 install partition. the SSD size and partition size will be identical to the old MBR SSD, apart from whatever is created for UEFI on the new SSD.

What are the steps to accomplish this? I’ve found a great deal of confusing info online. Use of pvmove/pvcreate as seen here: ubuntu - Copy LVM Volume Group to a new single hard disk - Server Fault seems close, but the old and new SSD R9 installs won’t be part of the same VG- they are completely separate. Do I instead copy the PV with cp/tar? What steps do I use to prepare the target SSD/LVM partition during the R9.2 install routine/after? Please let me know your thoughts on the best way to accomplish this, including other methods i did not mention.

Thank you!

The easiest way is create a new LVM on the new disk, and just use standard Linux tools like cp, rsync or whatever to copy the data from the old volumes to the new ones. Makes no sense to try cloning/moving the actual LVM volume.

interesting. the more i thought about this, the more the simple tools seemed correct. i guess i was thinking there was some kind of LVM-specific tool that i would need/was missing. this UEFI(/GPT) conversion is quite annoying when you’re using XFS. thank you for your reply!

1 Like

i have 3 lvs- “/” and “/home” and “/tester”. seems like copying all “/” to the new SSD post-install will cause issues? like “/boot” folder? i’m trying to preserve on the target SSD the UEFI/GPT stuff…? and what copying /etc- what about /etc/fstab? this seems wrong. please advise.

copying folders like /etc/ from original to new install doesn’t seem workable- UID/GID issues, overwriting needed configs in /etc, /boot, etc.

i suppose what I really need to know is how to convert my Centos 7.9 and my Rocky 9.2 master SSDs, both with XFS file systems, from MBR to UEFI/GPT.

RH has an article on converting MBR to GPT/UEFI:

you shouldn’t be copying /etc, and all the system stuff. You should only be copying your data if you are doing what I suggested before. The above link and conversion may or may not work. Make sure you have a backup in case it goes wrong.

The additional problem you have is you are trying to switch OS at the same time. The above link would more fit, eg: moving RHEL8 from MBR to GPT/UEFI with it still being RHEL8 at the end, for example.

In reality, when copying data, you should just be copying /home and /tester - nothing else unless it it data that you need. Then install a new OS and configure it from scratch. Also remember, upgrades are not supported by Rocky.

Hi-

I just reinstalled R9 w/UEFI/GPT. :slight_smile:
Thank you everyone!

1 Like

Here is a write up I did on converting msdos disks to GPT on a live system.

GPT conversion on a Live system

I should note that kernel parameters should be added with the “grubby” tool and not “grub2-editenv” tool. You can skip this step if you have no special parameters to add.