Migratin XEN LVM VM to Proxmox KVM

bill_mustermann

New Member
Nov 23, 2015
24
0
1
Hi,

i found several threads in this forum how to migrate a xen maschine into proxmox. BUT i have not a XENServer installed, i have a normal XEN installed on Ubuntu 14.04 LTS.

This XEN LVM is already backed up as IMG file in RAW format. What i did: I create a LVM Snapshot of the needed mashine. Then i dd'ed it into an vm.img file. With qemu-img status i can see that it is in raw format.

So, what are next steps to bring this on proxmox? What is the best solution, LVM, qcow2?

Can someone pls describe exactly what to do to bring this XEN vm.img to proxmox?

I will now try it out with raw image. but i stuck at this point:

4. Need to create Partitioning like Xen VM. So as we have only one Partition in Xen VM. We will just create one Partition inside the kvmvm image.

parted /mnt/backup-snapshot/snapshot/monitoring-disk-kvm.raw(parted)$ mklabel msdos

(parted)$ mkpart primary xfs 0 56320M

(parted)$ set 1 boot on

(parted)$ quit



- i have created a new file: dd if=/dev/zero of=/mnt/backup-snapshot/snapshot/monitoring-disk-kvm.raw bs=1M count=56320
- i have done all steps in 4
- when i now have a look with cfdisk at this new disk i see the partition table (name, boot-flag, part-type pri, system linux, size 56320)
- WHEN I LOOK WITH CFDISK AT THE OLD IMG FILE THERE IS NO PARTITION!!! (no name, no boot-flag, no part-type, free space, size 56320)

IS THIS OK LIKE THIS???

regards,

bill
 
Last edited:
I think the more simply solution, is to create a new vm on proxmox, with a local raw file as storage.

then, replace it with your current raw file

cp yourrawfile /var/lib/vz/images/VMID/vm-vmid-disk-1.raw


Then, il you want to change format or storage, you can use "move disk" button in gui.
 
Hi,

>> I think the more simply solution, is to create a new vm on proxmox, with a local raw file as storage.

An empty local raw file or should i install an OS on it?

>> I think the more simply solution, is to create a new vm on proxmox, with a local raw file as storage.
>> then, replace it with your current raw file

What is the correct way to create "my own" raw file?

regards,
bill
 
Hi Bill
It is not clear to me
do your original Xen image vm.img contains "just" a filesystem or do you have partition table on that ?
You can detect this by calling "file" on the disk image.

If you were using HVM on Xen most probably it#s a disk image, if you had a PV domU it was most probably a single partition.
 
Hi,

my orinal XEN VM is in an LVM. Then i create a snapshot of that lvm and per dd i create an img file out of the snapshot.

root@xxxxxx:~# file /mnt/backup-snapshot/snapshot/monitoring-disk-2015-11-09.img
/mnt/backup-snapshot/snapshot/monitoring-disk-2015-11-09.img: SGI XFS filesystem data (blksz 4096, inosz 256, v2 dirs)

how do i proceed now?

regards,
bill
 
Last edited:
Hi,

my orinal XEN VM is in an LVM. Then i create a snapshot of that lvm and per dd i create an img file out of the snapshot.

root@xxxxxx:~# file /mnt/backup-snapshot/snapshot/monitoring-disk-2015-11-09.img
/mnt/backup-snapshot/snapshot/monitoring-disk-2015-11-09.img: SGI XFS filesystem data (blksz 4096, inosz 256, v2 dirs)

how do i proceed now?

regards,
bill

check that the file is a raw file with :

#qemu-img info monitoring-disk-2015-11-09.img

if it's a raw, simply copy it

cp monitoring-disk-2015-11-09.img /var/lib/vz/images/VMID/vm-vmid-disk-1.raw
 
Hi,

root@XXXXXX:~# qemu-img info /mnt/backup-snapshot/snapshot/monitoring-disk-2015-11-09.img
image: /mnt/backup-snapshot/snapshot/monitoring-disk-2015-11-09.img
file format: raw
virtual size: 50G (53796143104 bytes)
disk size: 50G

root@xxxxxx:~# file /mnt/backup-snapshot/snapshot/monitoring-disk-2015-11-09.img
/mnt/backup-snapshot/snapshot/monitoring-disk-2015-11-09.img: SGI XFS filesystem data (blksz 4096, inosz 256, v2 dirs)


i thought i have to do this:
https://www.evernote.com/shard/s45/...95aff9f0ade6/859044161126bab200636e1ab742c552

is this not necessary???

regards,
bill
 
Hi,

pls keep in mind: i do not have a xenserver! i have XEN installed.

xen_version : 4.4.2

The following i do not understand:

You say if its a raw format i can just copy it to proxmox and boot. If it does not boot it is the way on evernote described. BUT......if it does not boot it has something todo with grub bootloader and not with creating a partion table first and then copy the raw image to the new partitioned disk as described in here:
https://www.evernote.com/shard/s45/...95aff9f0ade6/859044161126bab200636e1ab742c552
in 3 and 4.

I also do not understand why to load the dm-mod module. Seems like i dont have it on ubuntu 14.04 LTS :( But Point 6 is working without errors.

regards,
bill
 
Last edited:
Your image is a partition, not a disk.
Your best best would be to create a VM with a disk larger than your partition and then:
- attach your partition file to the VM as secondary disk (edit the /etc/pve/qemu-server/<VMID>.conf file)
- boot a Live Linux ISO
- partition the main VM disk
- dd your partition (/dev/hdb /dev/sdb /dev/vdb or something like that) to the main disk partition (/dev/sdaX /dev/hdaX /dev/vdaX)
- mount your main disk partition somewhere
- bind mount /dev /dev/pts /proc and /sys inside it
- chroot in it
- adjust your /etc/fstab
- install grub on the main disk
- exit the chroot, unmount the bindings, unmount the main disk
- reboot and pray
 
Hi,

i have it running now but there is still a problem:

- VM comes up - i can login via ssh :) yeah :)
- BUT :( in Proxmox Console it hangs on: random: nonblocking tool is initialized

it is absolutly not ok for me to be not able to login via proxmox console. What can i do to fix this?

regards,
bill
 
Hi,

still not better. STRG-ALT-F1 brings the same screen. STRG-ALT-F2 and the following brings a blank black screen with a blinking cursor on the left top. typing is not working.

regards,
bill
 
Hi Bill
You can check with ps ax | grep getty to see which getties ( ie login prompt on a display)

You should see something like this:
ps ax | grep getty
2701 tty1 Ss+ 0:00 /sbin/agetty --noclear tty1 linux

important here is the 'tty1' part at the beginning and the end
 
hi,

i get this:

root@monitoring:~# ps ax | grep getty
5151 ? Ss 0:00 /sbin/getty -8 38400 hvc0
5162 pts/1 S+ 0:00 grep --color=auto getty


regards,
 
hvc0 is Xen specific.
you need to re-enable tty[1-6]

For example:

Code:
root@hosting:~# cat /etc/init/tty1.conf
# tty1 - getty
#
# This service maintains a getty on tty1 from the point the system is
# started until it is shut down again.


start on stopped rc RUNLEVEL=[2345] and (
            not-container or
            container CONTAINER=lxc or
            container CONTAINER=lxc-libvirt)


stop on runlevel [!2345]


respawn
exec /sbin/getty -8 38400 tty1
 
Hi,

many thanks, its working now.

Is there a favorit method for disks:

- Virtio
- IDE
- SCSI
- ....

to get the best available performance?

regards,
bill
 

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!