Boot installed system fails


The scenario is: migrating a physical machine to a VM.
The root partition on the PM is in /dev/md0, in the VM will be in /dev/sda1
I have tried different approachs to copy the data (rsync, fsarchiver, dd), but none works well.
The last has been with dd. The process is:

In the PM
dd if=/dev/md0 of=/mnt/root.dd

where /mnt is a external storage
The image is created wit no errors
Then I restore it to the VM

dd if=/mnt/root.dd of=/dev/sda1
I mount the partition and it is there, everything seems ok.
I edit fstab and change the id of the partition with the /dev/disk/by-uuid/ id of /dev/sda1

Evidently grub is not installed so it seems now the problem is reinstalling grub
I try to boot the system from the Opensuse 15.1 DVD, but the system is not found

Well, I boot with the rescue system, to reinstall grub chrooted

#mount /dev/sda1 /mnt
#mount --rbind /proc /mnt/proc  
#mount --rbind /sys /mnt/sys
#mount --rbind /dev /mnt/dev
#chroot /mnt

then I edit /etc/grub/devices.lst

and change
(hd0) /dev/sda
(hd1) /dev/sdb

and then I rebuil the initrd


Which finish succesfully

Then I reinstall grub

grub-install.unsupported /dev/sda

Again no error.

then I boot the VM, grubs appear … and instead of booting the system it reboots the VM… ang again and again…

Then I boot again with the 15.1 opensuse DVD and select boot installed system.
This time it detects sda1 as 200GB, ext4, Opensuse Leap 15.1, I can select wich kernel to boot (I have two of them to choose, I have tried with them both), and when I select it, it says “you may select an alternative device name for the system partition” last option is precisely the id I have in fstab, but I have tried with them all with the same result: “Sorry, system didn’t boot”

I don’t know why it is failing nor what more to try.

Any suggestions will be apreciated.


Is that legacy grub, rather than grub2?

I haven’t compared the boot record of an md device to a primary partition in too long to remember, if ever. Are they identical? If not, I wouldn’t expect dd to be the right tool for this migration.

Good point. I have seen that I have both /etc/grub and /etc/grub2 in my system… but the updated one is grub2, so all I was doing with grub was using old configuration.

I have run yast2 from the chrooted environment and tried to install grub2, then it fails because the swap partition was not there… god, i missed it!. when I have created the partitions in the VM I have not created a swap partition. As I noticed it before, I removed the swap mount point from fstab but I did not realized that grub used it for resume, so that was it. Creating a swap partition and setting it in the grub2 configuration in yast solved the problem.


Yes, the copying of the partition works, it was a grub issue.