How to migrate a virtual machine image into local-lvm.

Debjit Biswas

New Member
Aug 14, 2016
6
0
1
36
Q: How to migrate a raw image and a virtual box machine to a proxmox Enviornment ?
A:- Not yet found.

Well i googled and usued search tab but not enought info for a newbee using proxmox and linux.

I am using linux for a week for my development purpose and i want to migrate a raw image and a virtual box image to proxmox.
I have tried and copied the image file to "/var/lib/vz/images/" and found there was no image and vm folder.
So i made one and replace the file from iso to raw(its a raw image).

then i looked at it and found all my images are at local-lvm partition but could not have access to it. Please help me to mount a kvm machine to it. I could not install it from an iso.

here is my partition for entire machine.

vm   Proxmox Virtual Environment.png




Installed packages
proxmox-ve: 4.2-48 (running kernel: 4.4.6-1-pve) pve-manager: 4.2-2 (running version: 4.2-2/725d76f0) pve-kernel-4.4.6-1-pve: 4.4.6-48 lvm2: 2.02.116-pve2 corosync-pve: 2.3.5-2 libqb0: 1.0-1 pve-cluster: 4.0-39 qemu-server: 4.0-72 pve-firmware: 1.1-8 libpve-common-perl: 4.0-59 libpve-access-control: 4.0-16 libpve-storage-perl: 4.0-50 pve-libspice-server1: 0.12.5-2 vncterm: 1.2-1 pve-qemu-kvm: 2.5-14 pve-container: 1.0-62 pve-firewall: 2.0-25 pve-ha-manager: 1.0-28 ksm-control-daemon: 1.2-1 glusterfs-client: 3.5.2-2+deb8u1 lxc-pve: 1.1.5-7 lxcfs: 2.0.0-pve2 cgmanager: 0.39-pve1 criu: 1.6.0-1 zfsutils: 0.6.5-pve9~jessie
 
Can anyone have this problem ?
Atleast share how to replace the hdd image file in "local-lvm" file.
Please help.
 
Hello, I was running through your same problem
I solved it this way

1- use scp or sftp to copy your vm.img into proxmox, let's say to "/tmp/foo/vm.raw"
2- Create a VM on your proxmox with an extra 1G of space:
- on the "CD/DVD" tab, choose "do not use any media"
- on the "Hard disk" tab, choose the Format according to your needs, in my case I chose "Raw disk image
this will create a VM with an ID & puts its "img" file in "/var/lib/vz/images/ID/"

make sure your machine is shutdown before you procede

3- all you have to do now is to rename the file in "/var/lib/vz/images/ID/" which supposed to be "vm-$ID-disk1.raw" to any other name
mv /var/lib/vz/images/$ID/vm-$ID-disk1.raw /var/lib/vz/images/$ID/old_vm.raw
or you can just delete it
rm /var/lib/vz/images/$ID/vm-$ID-disk1.raw

4- move your file in "/tmp/foo/vm.raw" to the correct location
mv /tmp/foo/vm.raw /var/lib/vz/images/$ID/vm-$ID-disk1.raw
this will "cut & paste & rename" the file

5- start your machine from the GUI
 
  • Like
Reactions: Redtoast
by default, we now use an lvm thin pool for vm disk storage. (for details see http://pve.proxmox.com/wiki/LVM2)
if you change the storage local to accept the "images" content (in datacenter -> storage -> local)
you can do the following:

create a vm with a disk in storage local (not local-lvm)
if you want to import a raw file then also choose raw as format

replace the raw file in /var/lib/vz/images/<VMID>/
if you want to have the disk in the local-lvm storage
go into the gui and press "move disk" and select local-lvm as target
 
But when I am trying the only thing in storage is the local-LVM.
Please share how to "change the storage local to accept the "images" content".
Will be very helpfull.
 
i already wrote where you can do this:
datacenter -> storage -> local
 
Nice!
I added images to the part dir: and now it is working :-)
now it looks like this:

nano /etc/pve/storage.cfg

dir: local
path /var/lib/vz
content iso,vztmpl,backup, images


lvmthin: local-lvm
thinpool data
vgname pve
content rootdir,images

in the old proxmox "dir:" was not in the config at all