Migration of servers to Proxmox VE
You can migrate existing servers to Proxmox VE. Moving Linux servers is always quite easy so you will not find much hints for troubleshooting here.
Windows systems specific P2V issues
inaccessible boot device
Booting a virtual clone (IDE) of a physical Windows system partition may fail with a BSOD referring to the problem
STOP: 0x0000007B (0xF741B84C,0xC0000034,0x00000000,0x00000000) INACCESSIBLE_BOOT_DEVICE
this means that the source physical windows machine had no support for IDE controller, or at least the one virtually replaced by kvm (see Microsoft KB article article for details): as Microsoft suggests, create a mergeide.reg file (File:Mergeide.zip) file on the physical machine and merge that in the registry, 'before the P2V migration. Btw, it may not be necessary but should be no harm, anyway, and save you lots of time and headaches.
Windows 2000: see 
Disk booting tips
- check that your disk has "boot flag" enabled (you can check this with gparted, on ntfs disks, booting the vm from a livecd iso, see this gparted manual page) maybe not so windows-specific but better remind it here.
- be sure that boot.ini on your system partition is still suitable to your current disk/partition configuration (see this kb article and this kb article)
Hidden nonpresent devices
If your source physical machine had network interface controllers (nics) with static IP assigned and then you clone the system to a vm, you will need to add a virtual ethernet controller, provided by kvm, but Windows won't let you assign the same fixed IP to the new virtual nic, because (it reports) there is a hidden and nonpresent devices already configured with the same IP (see Microsoft KB article).
For sure it should be removed from windows "known" hardware but, you won't find it in "device management", even if you specify "show hidden peripherals", why? because Microsoft is complicated :-)
To be able to see, and then remove the old physical NIC from "device management", you have to
- open a console window
set devmgr_show_nonpresent_devices = 1and press enter
- then, in the same console (do not close it) type:
start devmgmt.mscand press enter
- this will open the same "device management" panel you could have open from the "control panel", but now if you set the "show hidden peripherals" flag, the "nonpresent" devices will appear, although dimmed somehow, and you will be able to remove them, freeing the IP for your virtual nic.
Other suggested pages
- Acpi setup
- Windows 2003 guest best practices
- Paravirtualized Network Drivers for Windows
- Paravirtualized Block Drivers for Windows
Fake Raid specific issues
If you have a physical pc to clone and you use a method that requires access to the file system (like with fsarchiver) from GNU/Linux, you can be in troubles if you have a so called "fake raid", that is a raid created using the motherboard bios configuration. Let's say we have a RAID1. In short GNU/Linux (i.e. systemrescuecd) sees the device, sees that the disks have some Raid metadata, and when you try to mount them it uses the "mdadm" libraries, that can't work since that raid is totally different. To avoid this, you have to boot with the boot parameter 'nodmraid'. For example, if you boot with systemrescuecd, at the menu where you can choose what to boot hit "tab" key You will have something like:
ifcpu64.c32 rescue64 scandelay=1 -- rescue32 scandelay=1
modify it (on both sides of the "--" separator) like this:
ifcpu64.c32 rescue64 scandelay=1 nodmraid -- rescue32 scandelay=1 nodmraid
Physical server to Proxmox VE (KVM) using Clonezilla Live CDs
This method is fast, reliable and OS independent as it uses live cds.
- Get a live linux cd like CloneZilla.
- Prepare the source host, make sure that you have standard IDE drivers enabled (for WinXP/Win2003 use the mergeide.reg (File:Mergeide.zip) ), for W2k I followed this link (solution 2 worked for me): 
- Now, boot the physical host with Clonezilla, go for beginner mode and select device - device and then remote, just follow the wizard
- On the Proxmox VE host, prepare a KVM guest, make sure you got a big enough IDE disk assigned (add 1 GB extra to be on the safe side) and also boot this KVM guest with the live cd and execute a shell.
- Become root and run fdisk (fdisk /dev/sda/) to make sure that sda is here, exit fdisk with 'w'. this was essential.
- Now enter all commands from the wizard on the source server tells you (configure network and request the copy process)
- After success (the wizard just copies the data, means I got a 80 GB disk but only 5 GB data on it so it was just a few minutes for the whole process on a gigabit network) just change the boot device to the hard disk and start the VM. Windows will install all needed drivers automatically, just the Intel NIC drivers for e1000 must be loaded from ISO (I got one big driver ISO from Intel containing all NIC drivers).
SSH Migration of a Windows physical machine to a VM raw file directly
- You have a physical machine in which you imported the File:Mergeide.zip, as shown on top of this page
- The physical machine has disk device /dev/sda (read this with "fdisk -l", and look for "hda" or "sda" or similar, NOT dm- or other...)
- You have already created a virtual machine with a raw type, file-based disk in stopped state.
- The VM has VMID 101 (read this from the VM list in the web interface)
Download SystemRescueCD, burn it and reboot the physical machine with it in the cd tray.
At its bash prompt, give eth0 an ip, or use dhcp:
To assign ip:
ifconfig eth0 192.168.1.10 netmask 255.255.255.0 up (use ip on same subnet as proxmox server)
To use DHCP:
To start the image process on the physical machine:
dd if=/dev/sda | ssh root@proxmox dd of=/var/lib/vz/images/vmid/diskname.raw
Change the root@proxmox to root@yourproxmoxip and change the vmid/diskname to the VMid number and the name you want to call the disk. I.E. VMid 101 and disk called vm-101-disk-1.raw would be:
dd if=/dev/sda | ssh root@proxmox dd of=/var/lib/vz/images/101/vm-101-disk-1.raw
Once this completes you can assign this disk file to your VM on the Proxmox interface.
Tested a 8GB physical server over gigabit network and was running in about 10 minutes.
Migrate a Windows physical machine to a VM logical volume directly using NETCAT
- You have already created a virtual machine with a disk on LVM, larger in size than the physical machine one (at least 1 GB more), STOPPED, do NOT start it during this procedure!
- The VM has VMID 103 (read this from the VM list in the web interface)
- The LVM VG is named SHARED-VG (read this with: "vgdisplay -s")
- So the LV partition is /dev/SHARED-VG/vm-103-disk-1 (read this with: "lvdisplay |grep LV|grep 103")
Download SystemRescueCD, burn it and reboot the physical machine with it in the cd tray.
At its bash prompt, give eth0 an ip, coherent with the network of one proxmox server (in the following example: 10.0.0.27):
ifconfig eth0 10.0.0.17 netmask 255.255.255.0 up
then assign root user a password, so you can log in via ssh:
Log in via SSH on both the physical machine and the proxmox server.
On the proxmox server, give the command:
date; netcat -w30 -vvnlp 3333 | gzip -dc > /dev/SHARED-VG/vm-103-disk-1; date
and on the physical machine give the command:
dd if=/dev/sda | gzip -c | nc -w30 -vvn 10.0.0.27 3333
You have to start the second command WITHIN 30 seconds of issuing the first one (the -w30...)!
This way, the proxmox machine is waiting for a stream of bytes on tcp port 3333, then gunzip it and redirects on the vm virtual disk.
The physical machine outputs its ENTIRE hd as a stream of bytes, gzip it and pass it via netcat to the proxmox server.
The 2 date commands are useful to have a trace of when this process starts and ends.
Tested migrating a 75gb hd in about 90 minutes on a 100mbit lan. VM started and worked as expected, after recognizing at first boot the new IDE controllers.
An alternate method for Windows VMs is using ntfsclone with ncat. First, create the actual VM, and boot it with the System Rescue CD. Partition it to match the partition structure of the host machine. Once you have the partitions built out, you can copy the partitions directly from the source machine to the new VM. This will only copy used data. The commands are:
On the destination system :
# nc -l -p 1234 | ntfsclone -r -O /dev/sda3 -
On the source system :
# nc -s -o - /dev/sdb1 | netcat DestSrvIP 1234
Migrate from a physical machine to a a smaller partition on a VM
While it's quite easy to "clone" a partition to another (real or virtual) of the same or bigger size, it's not so simple to do the same if the destination partition is smaller than the original one. This is possible, fortunately, and at least a proven method follows, but you have to take care of some pre-conditions:
- Since you want to clone to a smaller partition, we will operate at the filesystem level, copying all the files from the source filesystem to the destination one.
- So, we have to make sure that the destination partition has enough room to get all the files, at least, with better some free space left there.
- The cloning is not possible directly, i.e disk-to-disk, but we have to "save" the source partition, and then "restore" it on the destination one.
- Must be sure that the tools used are known very well as to how to copy files on the filesystems involved, including symlinks, hardlinks, filesystem specific attributes, and so on.
Main tool: fsarchiver
One free tool you can use for this is fsarchiver, which is a system tool that allows you to save the contents of a file-system to a compressed archive file. The file-system can be restored on a partition which has a different size and it can be restored on a different file-system. Unlike tar/dar, FSArchiver also creates the file-system when it extracts the data to partitions. Everything is checksummed in the archive in order to protect the data. If the archive is corrupt, you just loose the current file, not the whole archive. Fsarchiver is released under the GPL-v2 license. It's still under heavy development so it must not be used on critical data. So, you've been warned. Latest fsarchiver should be in the latest SystemRescueCD, although you can obtain it on your favourite recent distribution.
Cloning NTFS, be sure to use either version 0.6.10 or a patched previous version, because there was a bug that caused errors with NTFS junctions (something like linux symlinks).
If your origin physical server is configured in RAID-1 using "Fake Raid" (MB Bios raid), see the section about it in this article
As said above, install File:Mergeide.zip on the physical Windows machine (see Microsoft KB article for details) to provide support for the natively supported IDE controllers in Windows. Without this, cloned XP booting failed for me.
Running fsarchiver from SystemrescueCD
Use the latest SystemRescueCD available, that has a recent fsarchiver version:
Confirm the version is right with:
# fsarchiver -V
it should be at least "0.6.10", particularly if you are cloning NTFS filesystems. Then run:
# fsarchiver probe simple
that will report your disks/partitions current layout in a simple, understandable way, like:
[======DISK======] [=============NAME==============] [====SIZE====] [MAJ] [MIN] [sda ] [WDC WD5002ABYS-5 ] [ 15.00 GB] [ 8] [ 0] [=====DEVICE=====] [==FILESYS==] [======LABEL======] [====SIZE====] [MAJ] [MIN] [loop0 ] [squashfs ] [<unknown> ] [ 671.85 MB] [ 7] [ 0] [sda1 ] [ntfs ] [System ] [ 15.00 GB] [ 8] [ 1] [ramzswap0 ] [swap ] [<unknown> ] [ 248.47 MB]  [ 0]
You have to provide a folder to save the partition "backup", which will be quite large (fsarchiver has several compression level, but just to be sure have enough free space there to accommodate all the uncompressed file...) if you need to reach a "tmpfolder" windows share, you have to install the smbfs package before (standard repositories), so that then you can
# mkdir /mnt/tmpfolder # mount -t smbfs //windows/tmpfolder /mnt/tmpfolder -o user=username
giving a suitable password when asked.
Backup the partition
Now you have to perform the "backup", BE CAREFUL the first path is the backup file to save, the second the source partition, do not invert
# fsarchiver savefs -v -o /mnt/tmpfolder/physical.fsa /dev/sda1
(-v is verbose, shows each file is backing up, and if you have a lot of files and a slow video card can slow down a lot the entire process)
Then (if no errors reported) run the same LiveCD in a KVM VM with a 15GB virtual empty disk, better if a bit larger, (virtio), so /dev/vda. After mounting the smb share in the same way, run Gparted (present in Systemrescuecd, startx to enter the graphical interface and run it) and created a empty ntfs partition there, /dev/vda1, and set the boot flag.
Restore the partition
Note: i use here /dev/vda1 while the original was /dev/sda1, and id=0 because i restore the first partition in the physical.fsa (yes, it may store more than one) as /dev/vda1
# fsarchiver restfs -v /mnt/tmpfolder/physical.fsa id=0,dest=/dev/vda1
check if there are no restore errors. It was quite quick and just worked.
- I successfully cloned an Windows XP professional machine from a physical 40GB (used 12GB) partition to a virtual (kvm) 15GB one, stored on pve LVM. The archive file was around 7GB. (i had just 2 hardlink restore errors, but in the log were reported on non critical files, although i would prefer 0 errors...)
- I successfully cloned an Windows 2003 AD controller machine from a physical 250GB (used 5GB) partition to a virtual (kvm) 15GB one, stored on pve LVM. The archive file was around 3,4GB. (i had just 0 restore errors of any kind)
- Cloned a physical ubuntu 9.04 desktop from a 32 raid5 disk to a virtual kvm 12 disk. Just had to reinstall grub to make it boot inside kvm. No errors.
Physical (running) server to Proxmox VE (KVM) using SelfImage
Warning : Selfimage does not do snapshot of physical disk. So, shutdown services and avoid writes during the copy process
Prepare the Windows operating system
Prepare the Proxmox VE VM
Create an new KVM container with a suitable disk size. It is recommended that you choose the size 1 GB bigger than the size of the physical disk that you want to migrate to make sure all your data fits to the virtual disk.
Use VNC or SSH to connect to console on the Proxmox VE host. Export the qcow2 disk in the container directory with NBD
qemu-nbd -t /var/lib/vz/images/xxx/vm-xxx-disk.qcow2 -p 1024
where xxx is the VM ID.
If you use LVM as storage model, you can also export the logical volume created by Proxmox via the web interface
qemu-nbd -t /dev/VolumeGroup/vm-xxx-disk-1 -p 1024
Do the migration
Start SelfImage on the physical machine, choose to image entire hard disk, not partition. On ouput file select NBD with your PVE host IP and port 1024 as parameters. Click Start.
When imaging is complete press CTRL+C on the PVE console to stop the export of your virtual disk file.
Start the virtual machine and have fun.
Physical (running) server to Proxmox VE (KVM) using Windows backup
This may be useful if any other approach fails, or looks too complicated for you, as does not involve other software except Windows and PVE itself. It was used successfully to convert a live Windows 2000 server sp4 to PVE 1.5, and was inspired from a blog post related to a similar migration to XEN, but proved to be effective also for PVE, and probably any other VE around.
Here is an archive of the original blog post
Here is the cache of the post along with the NewSID file.
This method is about
- making a backup on your physical machine (pm)
- creating a virtual machine (vm) from scratch, identical as possible to the pm
- installing the same base OS of the pm on the vm, from the original supports
- restoring the backup of the pm on the vm
easy, uh? well, it works! Of course there are some point to take care of, and some drawbacks, too, but it is a very simple method, and you can find the drawbacks (if any) worth for the easiness you have in return!
You don't need to get new software, or learn fancy linux commands: all you got to know (and it's supposed you ALREADY know) is
- how to create a vm in pve (kvm)
- how to make a backup/restore from windows (with the bundled software!)
Ok, follow me:
Backup the physical machine
The program you need is NTBackup, on a standard installation you can find it under the menu
- Start/Program Files/Accessories/System utilities/Backup
- if it has been removed, you can add it back from your windows CD
Start a backup that includes
- ALL the windows hard drives
- the system state (this include the whole registry, ips, hostname, and so on)
Then, choose the "file" option as a destination
- be sure to create this file on a network share, or a usb drive but NOT on the disks you are backing up
- be sure that the network share has enough space to hold the BIG file...
NOTE: Some services may "lock" some files in a way that NTBackup won't be able to copy them (while they're in use):
- this is normal, and usually some of this locked files are:
- files used by the open programs the logged user has (e.g. NTBackup logs...)
- SQL data files, webserver logs, and so on (usually running as services)
- You can find "locked" files running NTBackup once, and then looking at its log for lines containing a "will be ignored" string
- to find such lines in a BIG log file (mine had 250k lines) use the console FIND command ("c:\FIND /?" is your friend)
- the only workaround is, during the backup timeframe:
- close all the open (interactive) programs the logged user has
- temporarily stop the services that are locking the files (if you can)
Cloning the virtual machine
- on PVE, you must create a vm configured just like the pm you want to migrate
- same OS (you have to use a CD or a iso for that)
- same %WINDIR% folder name (e.g.: c:\windows or c:\winnt, etc), (the source blog post doesn't mention this but i did it...)
- same SP (service pack applied) level, hotfixes, etc.
- same CPU number
- same pagefile configuration (the source blog post doesn't mention this but it turned out to matter in my conversion)
- same drive layouts
- number of disks and partitions, those on the vm must be at least equal in size to the pm ones
- same drive letters mapping
- same network card number
Now, when your vm is just like your pm, except it doesn't have any of the programs and configuration the pm has:
- add one more temporary drive to hold (temporary) files during the migration, assign it a drive letter not used in the pm
- on this temporary drive, copy
- the file c:\boot.ini from the vm
- the whole folder c:\windows\repair or c:\winnt\repair, or whatever your %WINDIR% is on your vm
- the backup file you previously did with NTBackup, stored somewhere on your network
Then, before restoring, switch the vm NIC to a non-used network in PVE, e.g.:
- create a new fake bridge, not connected to any eth<x>,
- then delete the "working" vm NIC and
- re-add another NIC on the vm, linked to the new fake bridge
otherwise your new vm would "talk" to the real network / domain controllers, etc, and would result in a duplicate machine, duplicate ip address, and so on. This would be BAD.
Restore the backup on the virtual machine
Log on to the vm and perform a restore of the backup file you have on the temporary disk
- note: choose "always replace the files on my computer" (see tools>options>restore in NTBackup)
BEFORE REBOOTING (at the end of the restore NTBackup asks you to reboot, hold down your mouse for a while...)
- the file c:\boot.ini from the vm
- the whole folder c:\windows\repair or c:\winnt\repair, or whatever your %WINDIR% is on your vm
replacing those restored from the backup file.
Reboot the virtual machine
if you got any BSOD (blue screens) you may try to:
- boot in safe mode
- remove unrecognized components (e.g.: SCSI card)
- make windows detect those components and reinstall drivers
I didn't see any BSOD, so nothing to tell here.
Otherwise, log on to the vm,
- some component may not work, e.g. (mine) the mouse cursor may seem "out of sync" with the VNC one, be patient and wait because:
- windows may recognize more virtual components and install them automatically (PCI, video, network, and so on: after a reboot they will work as expected)
After that, you can
- turn off the pm
- on the vm add a NIC linked to the real network, assigning the real IP the pm had
- reboot and log into the domain
VMware to Proxmox VE (KVM)
This howto describes the migration of a Windows 2003 Server (or Windows XP) from VMware to Proxmox VE (KVM). This procedure can be applied to VMware Linux guests as well, just skip the Windows specific steps.
Prepare the Windows operating system
Before you begin make a copy of the VMware image.
Remove VMware tools
Start the Windows virtual machine on VMware and remove the VMware tools via the Windows control panel. Reboot.
- Start the Windows virtual machine on VMware and execute the File:Mergeide.zip. Now the registry is changed that your Windows can boot from IDE, necessary for KVM.
- Make sure Atapi.sys, Intelide.sys, Pciide.sys, and Pciidex.sys are in the %SystemRoot%\System32\Drivers folder. If any are missing they can be extracted from %SystemRoot%\Driver Cache\I386\Driver.cab which can be opened in Windows file Exlorer like a directory and then the missing files can be copied out.
- See Microsoft KB article for details.
- Shutdown Windows.
Prepare the disk file
My disk file used for this howto: win2003.vmdk
- Change your VMDK disk file with vmware-vdiskmanager.exe to a single growable file (vmware-vdiskmanager.exe is located in your VMware installation path, e.g. "C:\Program Files\VMware\VMware Server") - open a cmd and go to the directory where your vmdk disk files are.
"C:\Program Files\VMware\VMware Server\vmware-vdiskmanager" -r win2003.vmdk -t 0 win2003-pve.vmdk
- Create a new KVM VM on Proxmox VE web interface and - do not start - take a look on the VMID (e.g. 102)
- Copy the win2003-pve.vmdk to your Proxmox VE server into the following dir: /var/lib/vz/images/VMID (I used WinSCP as I worked on a Windows desktop)
- Change the win2003-pve.vmdk file to qemu format:
qemu-img convert -f vmdk win2003-pve.vmdk -O qcow2 win2003-pve.qcow2
- Or, copy the vmdk to an LVM based disk of the same size or larger
dd if=win2003-pve.vmdk of=/dev/VG_iscsi/vm-102-disk-1
Alternatively, your .vmdk file might be in a flat format, so running "qemu-img convert -f vmdk" will abort with "Operation not permitted". You can check your .vmdk file actual format with the *nix command "file". If it is a flat file instead of native format, your output would look like:
# file myVMwFlatImage-pre.vmdk myVMwFlatImage-pre.vmdk: x86 boot sector; partition 1: ID=0x83, active, starthead 1, startsector 63, 208782 sectors; partition 2: ID=0x8e, starthead 0, startsector 208845, 16563015 sectors, code offset 0x48
So simply convert .vmdk into .qcow2 omitting the "-f vmdk" from the command above, and let qemu-img auto-detect the source format:
qemu-img convert myVMwFlatImage-pve.vmdk -O qcow2 myVMwFlatImage-pve.qcow2
(This was experienced with a VMware ESXi 3.5 clone of a RHEL guest.)
If your kvm starts but does not boot (vnc console reporting something like "booting from hard disk...boot failed: not a bootable disk"), try instead of "single growable file", a "preallocated virtual disk", to know how:
Launch "vmware-vdiskmanager" without parameters, you will see all the instructions. You can specify "single growable file" using parameter "-t <disk type>", where
Disk types: 0 : single growable virtual disk 1 : growable virtual disk split in 2GB files 2 : preallocated virtual disk 3 : preallocated virtual disk split in 2GB files 4 : preallocated ESX-type virtual disk 5 : compressed disk optimized for streaming
so, you have to use type 2
vmware-vdiskmanager -r whatever.vmdk -t 2 whatever-pve.vmdk
Be aware that vmware-vdiskmanager could now create 2 files:
- one whatever-pve.vmdk really small: it is really a text file, which you can read and see that it refers to
- another vmdk, like whatever-pve-flat.vmdk, which has the full size of your disk, and this is what you want to convert to kvm after.
- please note that the second file has the real size of the hard disk as seen from inside the guest vm, so if you are copying this to LVM with dd, you have to make room enough for this file size, or more.
- This happened converting a ubuntu.vmdk from a linux vmware server 2 to pve using LVM storage, and the solution proposed worked.
Alternative migration using a rescue CD disk image
As an alternative to copying the .vmdk file, you can also boot the VMware guest using a rescue CD image, I use http://www.sysresccd.org/
There was no (obvious) method in (my) VMware Server 2.0 to specify that the VMware guest should boot from a CD image, and trying to intercept the VMware boot process in time to press F2 proved futile so many times I gave up.
Instead, I changed the disk order, some VMware guests by adding a new little disk, others just by swapping the existing disks. And then it booted from the rescue CD image.
Once inside the rescue CD image, could use SSH from the ProxMox VE server into the VMware guest running the rescue CD image. After that I simply ran this command:
- ssh root@vmware_guest dd if=/dev/sdb | dd of=/dev/VG/vm-103-disk-1
REMEMBER! that you swapped the disks in VMware to be able to boot from the rescue CD image. You can also dd of=/to/a/file/if/you/want/that. Remember to also dd all the other disks from the VMware guest.
It is possible to use gzip to transfer less data over the network, but I was on a local network in the same switch so it didnt matter. I did not see any higher speeds using gzip, and my speeds was from 4 MB/s to 12MB/s.
Adapt the new KVM Virtual Machine
- Go to the hardware tab on the web interface and remove the default harddisk file
- Add the migrated harddisk as IDE for windows (only IDE works for windows) or SCSI for Linux
- 2012-09-24: virtio now also works for windows, but it can not boot from it the first time. So boot as IDE, then shutdown, add or change a 2. harddisk as virtio, then boot up. Then shut down. Then change the ide0 to virtio0, I do that using vi in the console. Then you can boot up windows again, and it will change to the virtio driver, and say that the driver is from RedHat.
- Start the new Virtual Machine via the management interface
- First boot takes some time as some drives has to be loaded
- Do not forget to install Paravirtualized_Network_Drivers_for_Windows
XEN to Proxmox VE (KVM)
XEN also uses qemu disk format, so it should work in the same manner as described under "VMware to Proxmox VE (KVM)".
You can use xenmigrate to do it
Qemu/KVM to Proxmox VE
Create an new VM on Proxmox VE and add the existing disk image to this new VM, set the boot order and start.
First a VM has to be created. 120 is an unused VM ID.
qm create 120 --bootdisk scsi0
someImage.img is an image that was created before. someStorage is the name of a storage as listed in pvesm status.
qm importdisk 120 someImage.img someStorage
qm importdisk adds the image as unused disk to the virtual machine. Thus, making it the bootdisk is still necessary.
qm set 120 --scsi0 someStorage:vm-120-disk-0
Move OpenVZ containers to Proxmox VE
You can move existing OpenVZ containers (container=VE=VPS) with vzmigrate or vzdump:
- Use vzmigrate offline migration to move your container to Proxmox VE
- Use vzdump to restore from a backup
After you moved your container you need to add the following line to the corresponding config file (see /etc/vz/conf/xyz.conf):
Add/edit the following line:
Now you can manage resource settings on the Proxmox VE management interface.
Physical server (or KVM, VMware, XEN or other) to Proxmox VE OpenVZ Container
Linux Installation to Linux Container
Migrating a Linux install into a Proxmox VE LXC container.
Log into the machine you want to migrate into a PVE container as root and first stop any running services such as web servers or databases eg `systemctl stop apache2`, `systemctl stop mysql` etc. You need to be root (or run with sudo) so that tar can access and archive all files correctly using commands such as:
# cd / # tar -cvpzf backup.tar.gz --exclude=/backup.tar.gz /
The tar -p switch is critical for preserving file permissions. Copy this tarball into the container templates cache directory on the PVE server which defaults to /var/lib/vz/template/cache . You may then create a new container using this tarball as a template via the web UI or using pct. If you choose to use the PVE web UI to create the new container, be sure to uncheck the 'Unprivileged Container' option (under the General options tab) else you are likely to run into file ownership issues. Creating a new privileged i386 container on ZFS storage with container ID 101 using pct would look something like this:
# pct create 101 local:vztmpl/backup.tar.gz -arch i386 -hostname your.hostname.here -onboot 1 -rootfs local-zfs:300 -memory 4096 -cores 2
Note this command doesn't configure networking. I enable networking after creating the container via the proxmox web interface.
Convert Windows to use SCSI (KVM)
This requires a 2.6.24 or 2.6.32 kernel. SCSI will not work on 2.6.18. This procedure is needed to get Windows to load and active the SCSI drivers, once active you can switch the disk and it shoudl Just Works. Tested with Windows 2003 SP1 on Proxmox VE 1.5 with the 2.6.32 kernel installed. I have not yet tested it for performance or reliability but it theoretically will be better, use at your own risk.
- With the Virtual Machine powered off, add a new temporary SCSI virtual disk
- Boot the Virtual Machine and make sure the drivers load for the new disk, You do not need to format it, just make sure you can see it in Device Manager
- Shut down the Virtual Machine, then remove the new disk and any IDE disks, do not delete the LVM or disk image file.
- Add the disks you just removed back as SCSI disks and boot the Virtual Machine.
Physical (running) Windows server to Proxmox VE (KVM) using VMware Converter
Physical Windows server to Proxmox VE (KVM) using VMware vCenter Converter Standalone Client (V5)
Tested on an HP ProLiant ML350 G5 and G6
VMware vCenter Converter Standalone Client
- Download here(version 5.x is Free Software and also free of charge but you need to create an account and login before download)
- Execute mergeide.reg (File:Mergeide.zip)
Prepare location to save local image
This guide is using an external USB Hard Drive. You may also save to a mapped network share.
NOTE Although the final image will be around the same size as the actual amount of data on the server, the Proxmox server should have enough free space to fit the total physical disk of the server unless you plan to shrink the windows disks. once migrated to Proxmox.
VMware vCenter Settings
Launch VMware vCenter and use the following settings:
- Source type: Powered-on machine
- Specify the powered-on machine: This local machine
- Select destination type: VMware Workstation or other VMware virtual machine
- Select VMware Product: VMware Workstation 8.0.x
- Name: Enter the desired name for the image
- Select a location for the virtual machine: Browse to the USB or Network drive where the image will be saved.
The next screen shows the settings for the virtual machine.
Click on Advanced options, select the Post-conversion tab and make sure ‘Install VMware Tools on the destination virtual machine’ is NOT check. We do not want to install VMware tools.
Click next and Finish.
It will now convert your physical machine to a .vmdk file.
NOTE: Depending on your hardware, you may need to boot the .vmdk file using VMware Workstation or Player before moving the file to the Proxmox server. This allows windows to install additional drivers for the disk controller. If promoted to convert the disk to Workstation 9.x compatibility, say Yes. You won't know if you need this step until starting the Windows VM in the final step. If you get a blue screen during boot, you should try this step.
Prepare the VM on Proxmox
Create a new KVM virtual machine. You’ll want to use similar CPU and memory as the physical system. In the Hard Disk menu, leave everything as default. We won’t be using the disk created by Proxmox. Finish creating the VM. Make note of the vmID. For this guide, we’ll be using 100 as an example.
Once the VMware converter has completed, disable all of the networks adapters on the physical server and shut down. Disabling the network adapters will avoid potential IP conflicts if you will start the physical server back into Windows after you have your new virtual server running.
Move the image to the Proxmox Server
Using a USB Hard Drive
Plug the USB Hard Drive into the server
From the Proxmox command line:
mount /dev/sdc1 /mnt/usb/
You should see the contents of the USB drive. In my case, the vmdk file was located in /mnt/usb/windows-server/
Converting to qcow2
We want to convert the .vmdk image file to qcow2. To do this, use the following command:
qemu-img convert -f vmdk /mnt/usb/windows-server/windows-server.vmdk -O qcow2 /var/lib/vz/images/100/windows-server.qcow2
This can take a while depending on the size of file and speed of your system.
Once the conversion is complete, we need to edit the conf file for the VM.
In the line with ide0: we want to change vm-100-disk-1.raw,size=32G to windows-server.qcow2
You may delete the empty disk created by proxmox when you created the VM.
Start the VM and open the console. Windows should boot up normally. It’ll take a few minutes to detect the hardware changes. If the Windows system had a static IP address, you'll have to reconfigure the settings.