Wednesday, June 27, 2012

Virtualization using Proxmox VE

Proxmox Virtual Environment is an open source virtualization platform for running virtual machines with a web UI to manage the VMs and view resource usage. It allows 32/64 bit Windows, Linux and more.
I would like to share some information about Proxmox and a few common actions I learned on a previous project. Although I used an earlier version, I just installed version 2.1, here is an installation video. I found that the UI completely changed and more features were added, below a sample screen of the management UI showing the services of the host and another one with the VM guest console.



Location of VM and config files

VM images:
proxmox:/var/lib/vz/images# ls
101 102

VM configurations:
proxmox:/etc/pve/openvz# ls

proxmox:/etc/pve/qemu-server# ls

Previous version:


The backup tool used for OpenVZ containers and KVM is called vzdump; if you are using the UI, first create a backup directory on Datacenter->Storage (using the new UI), and select 'Backup' as content for that storage. If you don’t have a storage created, you will get “Can’t use storage for backups – wrong content type” error.

There are other options to backup an image with no downtime for example using the snapshot mode.

Create a vm image

You can create a vm via command line or using the web UI.

The following example creates windows 2003 vm with 3G of ram and using 1 core/socket CPU.

qm create 101 --name BuildSlave01 --vlan0 virtio=DA:28:61:58:71:5B --ide2 none,media=cdrom --bootdisk ide0
--ostype w2k3 --memory 3072 --sockets 1 --onboot no --cores 1 --virtio0 local:100,format=qcow2

Make sure to assign a new mac address every time a vm is created.

Restore from a backup

To restore use vzrestore for OpenVZ containers or qmrestore for KVM machines.


Copy VM image

It is also possible to copy the vm disk image from one virtual machine to another, doing this will keep each vm configuration separate.
proxmox:/var/lib/vz/images# cp 101/vm-101-disk-1.qcow2 106/vm-106-disk-1.qcow2 

Extend vm disk size

The following example will add 20G to the vm.
qemu-img resize vm-101-disk-1.qcow2 +20G

You can use gparted to make this space available on windows server 2003 c:\ drive. First, upload the iso image on proxmox and then boot the vm from cd using uploaded gparted iso image.

Converting image formats

The qemu-img program can be used to convert images from one format to another. For example:
qemu-img convert -O qcow2 MyVmwareImage.vmdk MyProxmoxImage.qcow2

No comments:

Post a Comment