2

I imported a virtual machine (CentOS) from XenServer to KVM. This virtual machine originally had two disks (LVM). I added both disks to the imported machine in KVM. The disk containing the boot partition is correctly defined, but apparently the import had problems with the second disk.

What do I do to fix this?

Below the errors that occur during boot ...

Errors that occur during boot!

Other information I...

Other information I!

Other information II...

Other information II!

Other information III...

Other information III!

Eduardo Lucio
  • 253
  • 3
  • 13
  • Okay, we need a lot more information. Did the Volume Group "RH" span both of the virtual-disks? If yes, then booting the VM and showing us how the broken VG looks from inside the VM is kind of pointless. You should focus on fixing the import problems of the second disk. Either delete the bad file and re-import, or try and repair the file (doubtful this is possible). If you don't have both disks attached to the VM, booting it and troubleshooting does no good. – 0xSheepdog Dec 27 '19 at 20:55

1 Answers1

1

The problem was that the device "xvdb1" (XenServer)...

[root@vmrhs1doctxt01 consultor]# cat /etc/fstab
[...]
/dev/xvdb1               /mount                  ext4    defaults        0 1
[...]

... is now called "vdb1" (KVM).

The solution was change the entry in "/etc/fstab" to "vdb1"...

[root@vmrhs1doctxt01 consultor]# cat /etc/fstab
[...]
/dev/vdb1               /mount                  ext4    defaults        0 1
[...]

But to access the contents of the "/etc/fstab" file you must first mount the "/" of the VG (Volume Group) in question by doing as follows...

First boot using a Linux system rescue disk. In my case I used SystemRescueCd ( http://www.system-rescue-cd.org/ ) (systemrescuecd-6.0.3.iso).

With the system booted run the command below to find out the name of the VG...

[root@vmrhs1doctxt01 consultor]# pvdisplay 
[...]
  VG Name               RH
[...]

... once VG is discovered, then LV (Logical Volume) will be in "/dev/RH/".

Once you discover the target LV - "/dev/RH/LV_ROOT" in my case - you will need to find out the LV filesystem...

[root@vmrhs1doctxt01 consultor]# file -s /dev/RH/LV_ROOT
/dev/RH/LV_ROOT: symbolic link to `../dm-0'
[root@vmrhs1doctxt01 consultor]# file -s /dev/dm-0
/dev/dm-0: Linux rev 1.0 ext4 filesystem data (needs journal recovery) (extents) (large files) (huge files)

NOTE: "/dev/RH/LV_ROOT" is a symbolic link to "/dev/dm-0".

Once discovered the filesystem ("ext4" in my case), then mount the LV...

[root@vmrhs1doctxt01 consultor]# mkdir /mnt/LV_ROOT
[root@vmrhs1doctxt01 consultor]# mount -t ext4 /dev/RH/LV_ROOT /mnt/LV_ROOT

... and edit the "fstab" file...

[root@vmrhs1doctxt01 consultor]# vi /mnt/LV_ROOT/etc/fstab

Done! =D

[Refs.: https://forums.centos.org/viewtopic.php?t=4455#p21571 , https://www.systutorials.com/241497/how-to-mount-lvm-volume-from-an-external-hard-disk-on-centos/ , https://unix.stackexchange.com/a/235166/61742 ]

Eduardo Lucio
  • 253
  • 3
  • 13