Transferring KVM guest from one host to another

14 posts / 0 new
Last post
#1 Thu, 12/13/2012 - 18:28
yngens

Transferring KVM guest from one host to another

Trying to figure out how to migrate a guest system from one CentOS 6.3 KVM host to another CentOS 6.3 KVM host. Two setups are identical except their locations. Search gives http://www.virtualmin.com/documentation/cloudmin/devel/cli/move_system, but I couldn't understand where how that command connects one system to another. Tried it all the different ways - no joy.

I have manually copied the following files form one host to the other:

-rw-r--r--. 1 root root         150 Jan  8 12:34 base.mysite.net.console
-rwxr-xr-x. 1 root root         236 Jan  5 08:13 base.mysite.net-eth0.sh
-rw-r--r--. 1 root root           6 Jan  8 12:33 base.mysite.net-eth0.tap
-rw-r--r--. 1 root root 32212254720 Jan  8 12:20 base.mysite.net.img
-rw-r--r--. 1 root root          28 Jan 13 11:08 base.mysite.net.monitor
-rw-r--r--. 1 root root  1610612736 Jan  5 08:10 base.mysite.net.swap

but really don't know how I can add them into the system. Should I try creating empty system and then add the image file or there is another more elegant solution to my task?

Thanks!

Fri, 01/25/2013 - 00:48
tpnsolutions
tpnsolutions's picture

Hi,

While not specifically the Cloudmin way, here's some information on KVM migration from their site.

http://www.linux-kvm.org/page/Migration

Hope this helps!

Best Regards,
Peter Knowles
TPN Solutions

E: pknowles@tpnsolutions.com
P: 604-782-9342
W: http://www.tpnsolutions.com
Best Regards,
Peter Knowles | TPN Solutions
Email: pknowles@tpnsolutions.com | Skype: tpnassist
Fri, 01/25/2013 - 01:00
yngens

Thanks for the suggestion, tpnsolutions. I've just realized Jamie had provided his comment on similar situation on http://www.virtualmin.com/node/23438:

Try copying the .serv file into the /etc/webmin/servers directory on the Cloudmin master system. This should make it show up in the left menu - and you can then start up the VM.

I did and my instance came up. So this question can be considered resolved, unless there is more elegant way of doing this, for example with CLI "move_system" command.

Fri, 01/25/2013 - 01:02
JamieCameron

The simplest way to do this if you have two Cloudmin GPL systems is to backup a VM on the first one, copy across all backup files to the new system, and then restore. This should re-create the VM with its original settings.

''

Fri, 01/25/2013 - 01:05 (Reply to #4)
yngens

Of course, that's even better way! Thanks Jamie, going to try right away.

Fri, 01/25/2013 - 01:07 (Reply to #5)
JamieCameron

Also, if you have the pro version of Cloudmin you can manage multiple KVM hosts, and move VMs between them either via the UI (on the Move System page), or using the move-system API command.

''

Fri, 01/25/2013 - 02:11 (Reply to #6)
yngens

Jamie,

I have successfully backed up a guest system from first host to the second host remotely through SSH. Now, I can't figure out where should I place the files to get the guest system backup listed on Restore Backup page on the second guest.

There is and empty narrow frame on that window which does not allow me to point the path to the copied files as shown on the attachment.

I also tried to find Backup log in "Backup Logs" windows pointing tho the directory where imported files are located. Unfortunately, the system could not see them. I have these four files that were generated and uploaded by the remote Cloudmin host:

-rw-r--r--. 1 mysite mysite        966 Jan 24 15:20 base.mysite.net.disks
-rw-rw-r--. 1 mysite mysite 1791886773 Jan 24 15:19 base.mysite.net.gz
-rw-r--r--. 1 mysite mysite          0 Jan 24 15:20 base.mysite.net.gz.1
-rw-r--r--. 1 mysite mysite       1806 Jan  8 12:37 base.mysite.net.serv
Fri, 01/25/2013 - 15:27 (Reply to #7)
JamieCameron

You don't need the backup logs - all you need to do is transfer the files matching base.mysite.net.* to the new system, and put them in a directory like /tmp . Then run the command :

cloudmin restore-systems --source /tmp --host base.mysite.net

''

Fri, 01/25/2013 - 02:17 (Reply to #8)
yngens

Seems like Backup log has been stored on the first host, but never was transferred to the second host. At least I can see the logs output in the first Cloudmin UI.

If this is how it is done by design, then I believe it should be changed since if a user backups to remote Cloudmin server, then he has no chance to restore it without the log file.

Now how can I find the log file itself to copy it manually? And then will the log file on originating server work on the destination server?

Fri, 01/25/2013 - 03:40
yngens

My journey has continued this way. I found the backup log files on the originating server in /etc/webmin/server-manager/backuplogs directory, which contained several logs for local and one for remote backup for the very guest that is now copied over to the destination host. Of course, the log file wouldn't work because it was about remote backup. So comparing it with logs for local backups I have manually created a file /etc/webmin/server-manager/backuplogs/1359068536_135740162899670 with the following content:

owner=
msg=
dests=master:/home/backup/base.mysite.net.gz
dest=master:/home/backup/base.mysite.net.gz
time=1359068536
base_dest=
size=1791886773
host=base.mysite.net
ok=1
id=1359068536_135740162899670
server=135740162899670
empty=
backup=135906846959640

And now finally Backup Logs page on the second server was able to see my backup. However on attempt to restore it it has given the error: System to restore has been deleted, and no system details were included in the backup Apparently, because there was such a system before on this host. Now I am lost again as don't know how to overcome this obstacle.

Going to create the guest manually and try to restore the backup over it. Not sure if it will work...

Fri, 01/25/2013 - 03:47
yngens

I have created an empty system, changed its hostname to base.mysite.net and now finally it started restoring it.

This was long way of experimenting and too much of a headache. I am fine with GPL version for now, however probably just to have a single move-system feature of Pro version of Cloudmin I might consider to purchase its licence. But then, I wonder, will I have to purchase two licences to be able to move guest systems between the two hosts? How much it will be?

Fri, 01/25/2013 - 04:25
yngens

No, it didn't work unfortunately. After restore accomplished Graphical Console shows kernel pani message in the attachement. So my problem of migrating a guest system from one host to another is still there and there seems no easy way to resolve it :(

Fri, 01/25/2013 - 08:35
andreychek

to have a single move-system feature of Pro version of Cloudmin I might consider to purchase its licence. But then, I wonder, will I have to purchase two licences to be able to move guest systems between the two hosts? How much it will be?

Cloudmin Pro is designed so that you can install it on just one system, and from there, it can manage any number of VPS's and/or Virtualmin servers.

So in order to do what you described, you need a total of one Cloudmin license.

Regarding that error... that's an odd one. Are you able to access the system using single user mode (or rescue mode)? Or is it completely inaccessible?

-Eric

Fri, 01/25/2013 - 08:48 (Reply to #13)
yngens

Eric,

Thanks for explanation, that sounds good. But then it seems that with minimal Cloudmin 10 Instance Annual License I will have ability to create only 10 guest systems. That limitation is a main obstacle for me. Or I am misunderstanding something here?

As for the system I don't know how to login to a guest system in a single user mode, since it is not attachable. I need to transfer several running guest systems from one host to another and after Jamie advices I though that the best way is backing them up in the first system and restoring on the second, however as described above the second host simple doesn't see the uploaded files because there is no log file.

Now I am confused what is the best strategy to migrate guest systems between two hosts.

Topic locked