Migrating from Debian Xen to Proxmox

mikestreety

New Member
Nov 1, 2019
2
0
1
35
Hey team :)

I currently have several VMs running on Debian machines using Xen and wish to move them to use Proxmox so I have better management. I currently have a new machine set up running Proxmox which I was looking to migrate my VMs to.

I spent about 4 hours yesterday researching all of the topics that mention Xen and Proxmox - the issue is I am using the "free" Xen, no XenServer - which all of the tutorials I found seem to reference. The command line tool I have is xl, not xe or xm - which is where the export tools seem to be (xl documentation).

I'm at such a dead end as to how I can do this. Any suggestions/recommendations would be hugely appreciated.
 
Worst case scenario you could always dd the disks over from the virtual machine itself to the host:

Make sure to stop all services and freeze the filesystem to prevent inconsistency (or just load a recovery iso)
Bash:
fsfreeze / -f

dd the complete filesystem over to a already created vm on the pve host.
Bash:
ssh vm.domain.com 'dd if=/dev/xvda bs=4096' | pv --rate-limit 30m | dd of=/dev/pve/vm-102-disk-0 bs=4096

To gain back some disk space you wasted by filling with zeroes enable discard on the disk in hardware settings and trim the filesystem
Bash:
fstrim /

It may be a slow process but one that works in just about any case.

btw, if your machine is using para virtualization you'll encouter boot issues.
Simply edit grub at boot and delete "console="hvc0"".
 
Thanks for taking the time to answer @mbosma.

It doesn't look like I have a /dev/xvda on the Xen host. I have /dev/xen and that contains:

Bash:
crw-------  1 root root 10, 55 Sep 27 08:08 evtchn
crw-------  1 root root 10, 54 Sep 27 08:08 gntdev
crw-------  1 root root 10, 56 Sep 27 08:08 privcmd
crw-------  1 root root 10, 62 Sep 27 08:08 xenbus
crw-------  1 root root 10, 61 Sep 27 08:08 xenbus_backend

For each VM I do have a disk.img and a swap.img - I tried to dd the disk.img to the image of the VM on Proxmox but on boot, the VM just showed the install screen for Debian.

Edit: Realised the dd was done on the VM itself - sorry! :D Will give that a go, thank you.

On the VM itself I have the following in /dev - which oen would I need?

Bash:
brw-rw----  1 root disk    202,   1 Oct 31 17:12 xvda1
brw-rw----  1 root disk    202,   2 Oct 31 17:12 xvda2
 
Last edited:
If your XEN machines are all Linux, the easiest method would be to convert them to LXC. Both (XEN and LXC) abstract the kernel or can be run with an "external kernel", so that you can just rsync the files from the xen domu to an lx(c) container.
 
Hi,

I'm sorry I didn't answer your issue with trying to dd from the host instead of the vm earlier.

The xvda1 and xvda2 are partitions on the xvda disk. If you create a disk the same size or larger on the target vm you can simply dd xvda so all partitions will be copied over.
 
For debian vm on debian with xen.

So, I have the same prob - the prob is grub and boot!
The steps!
just rsync (lvm) or dd hdd from xen

start install vm's linux debian or cent or wathever version on pve. after setup hd stop vm (may be with ext4 this step is not required, but i'm with xfs)
boot from live cd - the same os vm os version
mount /dev/Xda to /mnt

delete
1.
/mnt/boot
/mnt/etc/initramfs-tools/
/mnt/usr/lib/grub
/mnt/usr/share/grub/
/mnt/etc/grub.d
2.
rsync to 1. from vm same type
mount --rbind /dev /proc /sys to /mnt
chroot /mnt

apt-get (yum) install grub-common grub-pc grub-pc-bin (or what is on cent, fedora ...)
fix /boot/device.map - (hd0) /dev/sda
fix /etc/fstab
install grub - grub-install /dev/sda
install kernel or reinstall kernel

umount all
(exit from chroot - umount /mnt/dev , /mnt/proc etc ...)
halt

reboot
 
Last edited:

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!