Virtualise physical Linux server

renss78

Member
Aug 26, 2015
26
1
23
I'm virtualising physical Linux servers to a ProxMox 4.2 environment. Currently i have completely rebuild the partition scheme and synced all the data via rsync on a virtual hard disk file in a ".raw" container.

My next step is that i want to create a new Virtual Machine and boot it from the .raw virtual hard disk file. In the old version i know the .raw files were located at :
/var/lib/vz/images/

Via the VM configuration files located at:
/etc/pve/nodes/pm01/qemu-server/

There was a link to the location of the raw file. I altered this configuration file to change the harddisk file of the virtual machine. But now the location var/lib/vz/images/ is empty and in the configuration file is only some kind of symbolic link available which refers to for example "vm-101-disk-1" which refers to a disk zd176.

I just want to start a Virtual Machine right off a .raw file, can you please help me?

Thank you for your time.
 
Since PVE4.2 the default imageformat is lvm thin. So must copy your rawfile to an lvm with dd. Or you can start an livemigration with clonezilla. We do this way easily. So first boot the pysical maschine with clonezilla and choose copy from local to remote disk. Then boot the new created VM with clonezilla too, start the livemigration, edit the fstab if required, boot in the new VM and ready :)
 
Hi,

Sorry for the late reply.

We use ZFS storage.

Correct me if i'm wrong but lvm thin is a different technique than lvm and you cannot combine those....
 
The situation is:
  • I have a raw file on my ZFS volume
  • I want to attach the raw file to a new virtual machine and boot from it.
You say i must copy the rawfile to an lvm with dd.

Can you please provide me some detailed instructions? I would really appreciate that, of course i will post the results here.

Thank you for your time!
 
You do not need LVM, just create a new VM with a ZFS disk with the exact same size of your raw file. Then you'll get a block device like

Code:
/dev/zvol/<poolname>/[filesystem/]/vm-<vmid>-disk-1

which then can be used to copy your raw file to it:

Code:
 dd of=/dev/zvol/<poolname>/[filesystem/]/vm-<vmid>-disk-1 if=/path/to/raw/file bs=1M

Afterwards, you should create a snapshot BEFORE starting the VM, so that you can always return to the initial state.
 
Hello LnxBil,

Yes, after some lookup i finally found out how to populate a ZFS disk.

Our command is slightly different tho:

Code:
dd if=<raw_file>.raw of=/dev/zvol/<poolname>/vm-<vmid>-disk-1

Another problem; the size of the ZFS volume is much larger than the actual raw file.. has this something to do with the BlockSize? (bs=1M), we do NOT define it as you can see.
 
  • Like
Reactions: linkstat
Since PVE4.2 the default imageformat is lvm thin. So must copy your rawfile to an lvm with dd. Or you can start an livemigration with clonezilla. We do this way easily. So first boot the pysical maschine with clonezilla and choose copy from local to remote disk. Then boot the new created VM with clonezilla too, start the livemigration, edit the fstab if required, boot in the new VM and ready :)
We cannot use clonezilla because the physical machine need to stay online. I'm using the following tutorial:

http://blog.unicsolution.com/2015/05/clone-live-linux-server-to-kvm.html

I'm not sure how to fully clone the partition table.
 
RAW and ZVOL has to be the same size, otherwise, something is wrong.
Yes okay but what can be wrong. I just do aa DD from the raw file to the ZVOL volume......... it is configured as Virtio Device with a larger size than the actual raw file. So when i have a raw file of 90GB i create a VM with a harddisk of 100 GB (to be sure) and i configure it as Write Back.

SO:

Virtio, WriteBack disk.
 
Depending on the guest OS, you cannot easily resize the disk. It the OS uses GPT, then it won't work. The chances of getting a working migration, please stick to physical hardware as close as possible. If you don't you're on your own. You can change everything AFTERWARDS you have a working 1:1 copy, yet not in the beginning. It can work, but more can go wrong.
 

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!