How to migrate a physical system to a KVM virtual server with only network access?
Solution 1
Assuming you don't have remote console access, or it's through some crappy horrible useless Java applet:
- ssh to the remote system and shut down as many services as possible. Basically everything but the ssh server itself.
-
From your local system, capture a copy of the running disk image back to your local system:
ssh [email protected] "dd if=/dev/sda bs=1024k" > p2v.img
Wait several hours. Depending on the size of the hard disk and your available bandwidth, this may take a very long time.
You will end up with a file
p2v.img
. Mount this to a KVM virtual machine as a raw disk image andfsck
it, as there will be errors.
Since you do have remote console access to the server, I would do something like this:
- From the remote console, bring the system to single-user mode (
init 1
as root, or reboot with1
added to the boot command line). - Bring up the network manually, e.g. with the appropriate
ifconfig
androute
commands. -
P2V it to the remote hypervisor (or a storage server):
dd if=/dev/sda bs=1024k | ssh [email protected] "cat > /path/to/p2v.img"
Create a new KVM virtual machine using
p2v.img
as the disk, start it up and make any necessary changes.
The virt-v2v tool can also P2V a Linux server to a KVM virtual machine.
Solution 2
All major hypervisors have a native P2V tool. Pick a hypervisor and use its tool.
Related videos on Youtube
Comments
-
mr-euro almost 2 years
I have an obsolete linux app-server running which I would like to migrate to a KVM virtual server with greater specifications.
I do not have physical access to the machine itself or its harddisks.
I only have access to the server across the network.
If it can be used for anything, I already have an empty spare HD installed in the server. This 2nd HD is about three times larger than then one where the data resides on.
Please ask for any other details you may need.
-
Chopper3 over 11 yearsWhich hypervisor?
-
Dan over 11 yearsThis is called "Physical to Virtual" or "P2V" for short. Nearly every hypervisor has tools to do this, such as XenConvert or VMWare Converter
-
mr-euro over 11 years@Chopper3 I am open to any if I could get it migrated successfully. Preference is KVM or OpenVZ (Proxmox).
-
mr-euro over 11 years@gravyface Please ask for what details you need. Thank you.
-
mr-euro over 11 years@Dan Thank you. I will have a look for those terms.
-
Michael Hampton over 11 years@mr-euro Please remember to edit your question with the additional details, since many people will not see the comments.
-
mr-euro over 11 years@MichaelHampton Thx, I have completely rewritten the question now.
-
-
mr-euro over 11 yearsThx MDMarra, I prefer KVM. Do you have any references on how to accomplish this with no physical access to the harddisk?
-
gravyface over 11 years+1
nc
is probably quicker, but likely both hosts are not on the same private network. -
Michael Hampton over 11 years@gravyface I don't worry too much about one-hour differences on 10-hour jobs, since in either case I'm going to look at it the next day anyway.
-
mr-euro over 11 years@MichaelHampton I do have access to a rescue system (via SSH) so I can entirely stop the system and still work on it. In which way could this change your suggested approach? Thank you.
-
Michael Hampton over 9 years@mr-euro I don't know if you ever saw my edits. From a rescue system the process would be about the same, except that you would connect to the rescue system instead of to your live system.