Moving VM machines

wilsonjc

New Member
Sep 5, 2011
10
0
1
Hi all.

I've searched the forums and found a couple of mentions of this but not a way to do it.

I have stupidly created 3 of my 10 virtual machines to use local storage.

this obviously means I cant do the migration.

Would anybody care to let me know how to move the storage from local to my VM store which is an LVM between the two boxes.

I give you permission to mock me if it would make you feel better :)

Regards
John
 
Well it's "easy".

1- stop the vm
2- move the folder containing the vm files into your shared storage at the correct place
3- manually edit /etc/qemu-server/xxx.conf where xxx is your vm id
4- find lines containing local:xxx/vm-xxx-disk-n..... and replace local by the name of your shared storage

If your shared storage is a LVM, this means step 2 won't work :)
You have to manually create LVM disks, and move each file based disk data into a distinct lvm space.
There is an article which may give you some commands needed to do this using "dd".
http://forum.proxmox.com/threads/3729-LVM2-migration

So for each file:
1- Create a lvm space which size matches the file size (overgrow it by 1G to be sure) using the commands in the linked post.
Don't forget the "tag", it is the same for all files of the same vm.
2- Use "dd" with your disk file as source and the created lvm space as destination.

That's all :)
 
also a backup/restore will help moving a vm to a new location, e.g. if you have *.raw images in local storage you can restore this to a LVM storage, just use the --storage option with qmrestore. (for full details, see 'man qmrestore')
 
Thanks to both.

I'm going to try the backup and restore option. partly because after one (or more) slight issues with DD ( again being an idiot!) it does worry me slightly in a live enviroment :)


I do have a couple of question with regard to qmrestore.

it asks for a storage id, the manual states this is the id of the storage. however I have 3 "drives" local, VM1 (lvm) and VM2 (lvm) is the storage id a name (ie vm2) or the /dev type id?

also if I restore to the secondary box, (so I can turn of the machines which are on the master box) can I bring it up as DNS server 1/2 with a different ID so the original is still there and ready to go incase of failure? (of the process I mean)

regards

John
 
Thanks to both.

I'm going to try the backup and restore option. partly because after one (or more) slight issues with DD ( again being an idiot!) it does worry me slightly in a live enviroment :)


I do have a couple of question with regard to qmrestore.

it asks for a storage id, the manual states this is the id of the storage. however I have 3 "drives" local, VM1 (lvm) and VM2 (lvm) is the storage id a name (ie vm2) or the /dev type id?

the storage ID is the name of your storage, see Configuration/Storage: Storage Name

also if I restore to the secondary box, (so I can turn of the machines which are on the master box) can I bring it up as DNS server 1/2 with a different ID so the original is still there and ready to go incase of failure? (of the process I mean)

regards

John

I do not get the second question.
 
Thanks Tom.

basically both of the machines i need to move are mission critical. (you know customers can't have 5 minutes of downtime even at 2 in the morning)

I'd like to do a restore of machine 1, but with out it overwriting the original, (the original would be disconnected from the network).

so at the start
machine 1 on local storage with ip 8.8.8.8

machine 1 gets disconnected from the network

Backup of machine 1 gets restored but to the shared LVM storage. with the 8.8.8.8 ip address.

if it works original machine 1 on local storage is deleted, if not network is re-enabled.

I hope that made more sense?

Regards

John