-
Hi Everybody
I have some virtual machine on debian Xen server. The DomU machine disks defined on lvm volume. Are there any way to migrate these VM to xcp-ng ?
I have find a script, but it didnt work for me.Thank
Zoltan -
Hi!
Have you read our official documentation first? https://docs.xcp-ng.org/installation/migrate-to-xcp-ng/#-from-xen-on-linux
-
@olivierlambert
Hi
Yes, I have read, and tried. The import was successfully, but the new VM stop during the boot, and I got initram prompt. -
That's pretty much scarce information. Is your VM PV or HVM?
-
Hi
I use PVM guest, that run on LVM volume.
Here is my xen.cfg file
kernel = '/boot/vmlinuz-5.10.0-28-amd64'
extra = 'elevator=noop'
ramdisk = '/boot/initrd.img-5.10.0-28-amd64'vcpus = '1'
memory = '4096'Disk device(s).
Physical volumes
root = '/dev/xvda2 ro'
disk = [
'phy:/dev/xenvol/sl2601,xvda2,w',
'phy:/dev/xenvol/sl2601_swap,xvda1,w',
] -
Hi
In the original configuration the root disk is xvda2 and a swap xvda1.
After the migration under xcp-ng has created two disks.
xvda for the root and xvdb for the swap.
Booting stop at this moment.Gave up waiting for root file system device. Common problems:
- Boot args (cat /proc/cmdline)
- Check rootdelay= (did the system wait long enough?)
- Missing modules (cat /proc/modules; ls /dev)
ALERT! /dev/xvda2 does not exist. Dropping to a shell!
(initramfs) [ 249.512144] random: crng init done
Do you have any id , how can solve this problem ?
Thanks. - Boot args (cat /proc/cmdline)
-
Rebuild your initrd correctly and fstab to use the right drive numbering. Also, PV is deprecated, you should transform your VM in HVM mode (install grub in the bootloader)
-
I add extra parameter on advanced tab.
PV args root=/dev/xvda roThe VM has started . Nice.
Modified the fstab, and grub menu.lst with correct drive.
After that I have tried install grub in to the bootloader. It was not success.
I have got this.
Searching for GRUB installation directory ... found: /boot/grub
WARNING: tempfile is deprecated; consider using mktemp instead.
WARNING: tempfile is deprecated; consider using mktemp instead.
The file /boot/grub/stage1 not read correctly.Fdisk said that is not correct partition table.
root@sl1802:~# fdisk /dev/xvdaWelcome to fdisk (util-linux 2.36.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.The device contains 'ext4' signature and it will be removed by a write command. See fdisk(8) man page and --wipe option for more details.
Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0x5df197a4.
-
Ok so just to check: now you have a working PV guest, right?
-
Yes. It works, but I can not convert to HVM until I can not install grub, righ ?
-
Yes, that's correct. At least, you can boot the VM, which is already better
To install Grub on the main drive:
grub-install /dev/xvda
. If that doesn't work, check https://bugs.archlinux.org/task/30241 -
I have tried this, but not work.
root@sl1802:~# grub-install /dev/xvda
Searching for GRUB installation directory ... found: /boot/grub
WARNING: tempfile is deprecated; consider using mktemp instead.
WARNING: tempfile is deprecated; consider using mktemp instead.
The file /boot/grub/stage1 not read correctly. -
I have been migrating VMs from Xen on Debian 11/12 using the python2 script this past week and it worked best if I had ensured the VMs were booting on Debian using pygrub as the bootloader rather than the specified kernel from the Dom0.
Then all I had to do after running the script was go into Xen Orchestra and change the "PV args" for the VM under "Advanced" to "root=/dev/xvda ro" (instead of "root=/dev/xvda2 ro" from the imported config), edit the "Network" config to match the MAC addresses used by the VM before, and mount the tools disk.
The VM will then boot and I can edit the /etc/fstab file to use xvda and xvdb for the boot disk and swap respectively (instead of xvda2 and xvda1 that Debian had been using).
I edited my VM's /etc/network/interfaces (because we have standardised on having the internal network as the first ethernet port rather than the second), then mounted the tools and ran 'sudo /mnt/Linux/install.sh' before rebooting. It is a pretty quick process once you've done a dozen or so!!
I tried updating the script to use python3 but as I am not a python developer I decided it was safer to build python2.7 from sources to run on Debian 12, since unfortunately python 2 is no longer available from packages on Debian 12.
Thanks for sharing your experience here, which I thought I would just add to as it may help others migrating to xcp-ng over coming months/years. All I can say is, "Do it!". The sooner the better!
Once I have all the VM migrated in PV mode, I will then work on moving to HVM.