Migration of virtual machines from XenServer to Hyper-V. Migrating virtual machines from XenServer to Hyper-V Migrating a real machine to virtualbox

There are several ways to convert an installed Windows OS into a virtual machine image. The created image can be used, for example, for testing, to check the stability of the system after installing an update, or to record the state of an old machine before making changes.

Most virtualization programs support the function of converting installed Windows OS into virtual machine images. Some solutions already come with built-in functionality, but in some cases you may need to use third-party products for the same purpose.

This guide provides instructions for converting Windows installations to Microsoft Hyper-V, VirtualBox, and VMware virtual images.

Migrating Windows OS to a Microsoft Hyper-V virtual machine is easy with Disk2vhd from Sysinternals.

The program is portable, it can be launched from any location on the disk after unpacking the archive. The application requires administrator rights to operate. The program can be used to create a virtual machine from one or more volumes on a computer.

Note: The program can be run in command line mode using the format:

The main application window displays the destination path and file name, and just below it displays the available volumes. Please note that you need to select a target location with sufficient free storage space, otherwise the image creation process will be aborted.

The user must select the target path and file name (vhdx extension), as well as the volumes to include in the virtual image.

You can select just the Windows partition or even convert non-system partitions to VHD images without selecting the Windows partition.

Disk2VHD comes with two additional options that are specified at startup. The first sets the output format to VHDX. You can disable this option to use VHD.

VHDX has several advantages such as support for larger virtual disks (64 TB vs 2 TB), better protection against corruption, remote online resizing, etc. VHD is needed mainly for compatibility purposes, such as when a product does not support VHDX, and also when you want to convert the image to Virtualbox.

The second option allows you to use a shadow copy of the volume.

Disk2VHD processes the selected volumes and turns them into virtual disk images that are saved in the selected location.

Once you have the VHD image, you can use the vboxmanage command line tool that comes with VirtualBox to clone the media and save it in a different format.

  1. Press the Windows key, enter cmd.exe, hold Ctrl + Shift and press Enter to launch Command Prompt with administrator rights.
  2. Go to the VirtualBox folder on the system, for example, C:\Program Files\Oracle\VirtualBox using the cd command.
  3. Use the vboxmanage clonemedium disk command to convert a VHD disk image to VDI format. For example: vboxmanage clonemedium disk o:\source.vhd o:\output.vdi

The conversion may take some time depending on the size of the image and your computer's available resources.

You can create virtual Windows machine images for VMware using VMware vCenter Converter. You can download the program from the official VMware website, but it requires an account. On our website the utility is available for download without registration.

Note: The program creates a virtual image of the full machine. There is no option in the GUI to exclude hard drives or partitions.

The installer size is approximately 170 megabytes. During installation, you will be asked to join the Customer Experience Improvement Program.

To convert a running Windows system into a virtual image for VMware, select the “Convert Machine” option in the main interface of the program to get started.

After loading the wizard, make sure that the source type is set to “enabled” and “this local computer” is selected. You can also create virtual images of remote computers, but this requires you to provide the device name or IP address, as well as credentials.

Select the VMware virtual machine in the Target Type section on the next page and select the target folder to save the image.

Creating the image may take some time, depending on the number of volumes, their sizes, and device resources.

I have always liked the free hypervisor Xenserver and used it often. But recently I decided to gradually switch to another hypervisor. Which one exactly has not yet been finally decided. I’ll tell you more about the reasons for abandoning Xenserver and general thoughts about modern hypervisors below. In this article I will consider in detail the issue of transferring virtual machines from Xenserver to Hyper-v.

If you have a desire to learn how to find and exploit vulnerabilities in information networks, I recommend getting acquainted with online course “Workshop on Kali Linux” in OTUS. The course is designed for those who do not have experience in information security; they must pass it for admission.

Initially I wanted to write an article on the topic of installing Xenserver 7 on mdadm raid1. I always liked xen precisely because it was possible to install it on mdadm. This made it possible to use the hypervisor on any hardware with two hard drives, providing simple fault tolerance at the disk level. It's convenient and budget-friendly. The same can be done on kvm, but personally I prefer xen’s management snap-in as an application for Windows. You can conveniently connect many servers to it and manage everything from one place. As a plus, in comparison with kvm, it is easier and faster to install and configure for operation, and transfer it to someone else for control.

Actually, I prepared and tested a draft article on installing Xenserver on a software raid. At first glance, everything works. The problems started when I started checking fault tolerance and disconnecting one hard drive. As it turns out, xenserver cannot boot normally if the mdadm raid goes into the degreaded state. I was very upset by this fact and spent almost a day continuously trying to understand the situation and try to solve the problem. But I didn't succeed. I also didn’t find a recipe on the Internet to solve the problem, but I found confirmation of this problem.

It looks like XenServer as of version 7 no longer supports running on mdadm. This is even mentioned in the official FAQ:

— Does XenServer support a software-based RAID implementation?
— No, XenServer does not support software RAID.

I checked on version 7.0 and 7.1. The result is the same - the system does not boot if the raid collapses. Moreover, there are articles on the Internet that tell you how to transfer a clean installation of xen 7 to mdadm. It looks like these people simply did not test for the failure of one of the drives. Until you check this, everything seems fine. The problem here is that Xenserver 7 switched to CentOS 7. And there are many innovations, in particular systemd. I couldn't pinpoint exactly what the problem was. There is some incompatibility in the loading modules, the xenserver kernel and the mdadm version. CentOS 7 had a similar bug when it was released, but it was quickly fixed. But on XenServer, the developers gave up on this, since they did not promise mdadm support. As a result, the hypervisor was left without the ability to install on mdadm. This is unacceptable for me, since I actively use mdadm. If any disk fails, the system hangs endlessly at boot time with the message:

A Start Job is running for dev-md0.device

I still have many virtual machines running CentOS 5. The peculiarity of this version is that for normal operation on XenServer, a special kernel-xen kernel was installed on the system. As a result, when the system was transferred to another hypervisor, it refused to work. It takes some serious file work to get it going. It was important for me to work out this point, since in my work I will have to gradually move away from Xenserver towards either Hyper-V or KVM. I haven’t decided yet, because I haven’t been able to create virtual machines with xen on KVM, but I have succeeded on Hyper-V. I’ll tell you about this.

Transferring a virtual machine from xenserver to kvm

The transfer of a virtual machine itself is a simple copying of a disk from one hypervisor to another. For Xenserver backup I use the free version of the program Alike Free. Unfortunately, it is no longer available in the free edition. The developers have closed the free project, there is only a trial version of the paid one. But I still have the distribution kit and the keys for the free version. I continue to use it. A simple and convenient program that allows you to make incremental backups of virtual machines. She also knows how to upload backups to vhd format. All you need to do to transfer a virtual machine is to create the same machine on hyper-v and specify the transferred vhd image from xenserver as the disk. But if you just start the virtual machine after that, you will get an error.

Error 13: invalid or unsupported executable format

There is nothing surprising in this; the modified kernel for xen only works on the hypervisor itself. To work in another environment, you must install a standard Linux kernel. This is what I will do next. The task turned out to be very difficult; we had to tinker with various nuances a lot. First of all, in order not to forget the experience gained, I am writing this article. Although I understand that few people will benefit from such experience. It is unlikely that there will be many people who will move the already discontinued CentOS 5 system from the Xen hypervisor somewhere else. In a good way, the systems need to be rearranged, and I will gradually do this. But you still need to have ready-made instructions on hand in case of any surprises.

The method described below to restore the boot of a virtual machine is a universal tool for solving problems with booting a Linux server. If for some reason your Linux server does not boot, the bootloader is broken, or problems arise after updating the kernel, the methods described below for updating and replacing the kernel and bootloader can help solve this problem.

Restoring Linux server boot

In order for the virtual machine to work on hyper-v, as I already said, you need to install a standard kernel. To do this, boot into the virtual machine from the CentOS 7 boot disk and select the mode.

To select this section, you must select in the main menu Troubleshooting. We wait for the download and select the first proposed option.

We immediately jump into our restored system. The first step is to update the system and install the standard kernel. Most likely, you won’t be able to do anything through yum, since the links to the centos 5 repositories became inactive after system support ended on March 31st. File needs to be modified /etc/yum.repos.d/CentOS-Base.repo, editing the paths of the relevant sections to the following:

Baseurl=http://vault.centos.org/5.11/ osupdates/$basearch/ baseurl=http://vault.centos.org/5.11/ addons/$basearch/ baseurl=http://vault.centos.org/5.11/ extras/$basearch/ baseurl=http://vault.centos.org/5.11/ centosplus/$basearch/ baseurl=http://vault.centos.org/5.11/ contrib/$basearch/

All lines with mirrorlist should be commented out, and baseurl should be changed to the specified ones. After this, you need to start updating the system.

# yum clean all # yum update

Now let's install the standard Linux kernel and remove xen.

# yum remove kernel-xen # yum install kernel

Now we check the version of the existing kernel libraries in the system.

# ls -l /lib/modules/

We take the latest version and build the initrd image.

# mkinitrd -v -f /boot/initrd-2.6.18-419.el5.img 2.6.18-419.el5

Editing the bootloader config /boot/grub/grub.conf so that it selects this particular kernel version when loading.

Parameter default=1 corresponds to the second line of the menu, since the countdown starts from 0. That is, the desired updated kernel will be selected. We update the bootloader on the disk.

# grub-install /dev/sda

If you get an error:

/dev/sda does not have any corresponding BIOS drive.

Use this command:

# grub-install --recheck /dev/sda

In theory, this could be the end. We actually performed a complete recovery of a broken Linux server boot. But since we are talking about xenserver, there is one more nuance. If you try to boot a virtual machine now, everything will go smoothly almost until the very end of the boot, and then an error will appear.

Init: Id ‘co’ respawning too fast: disabled for 5 minutes

It will hang there forever. Associated with access to the virtual machine console on xenserver. In another environment, the parameter must be changed. To fix the error, you need to edit the file /etc/inittab. Find the line in it

Co:123457:respawn:/sbin/agetty xvc0 9600 vt100-nav

Comment it out and uncomment the line instead

1:123457:respawn:/sbin/mingetty tty1

Now you can reboot the virtual machine. It should boot safely. At least that's how it was for me.

Unfortunately, the above method could not force the same virtual machine to boot on the KVM hypervisor. I do not know why. After selecting the kernel version in the bootloader, the system simply hangs in this position.

And then nothing happens. There are no errors. I don’t even have any idea why this could be and what direction to move in order to launch the virtual machine. If anyone has any ideas on how to do this, please advise. I would really like to migrate virtual machines from centos 5 to kvm. I tried to transfer already restored virtual machines from hyper-v to kvm, converted the disk from vhd to qcow2, but to no avail. They still freeze in the same way as if I transferred them directly from xenserver.

Conclusion

Transferring virtual machines works well within the same hypervisor. If you transfer from one to another, you are likely to get some problems. I often encounter this, especially with linux and freebsd. Most often, problems begin with disks and the bootloader. Either the drive letters change, you have to edit fstab, or the bootloader does not start. Sometimes the network may not work. Everywhere you have to figure it out locally and solve problems that arise.

Kali Linux Workshop

The course is for those who are interested in conducting penetration tests and want to practically try themselves in situations close to real ones. The course is designed for those who do not yet have experience in information security. The training lasts 3 months, 4 hours per week. What this course will give you:
  • Search for and exploit vulnerabilities or configuration flaws in corporate networks, web sites, and servers. Emphasis on pentesting of Windows OS and security of the corporate segment.
  • Learning tools such as metasploit, sqlmap, wireshark, burp suite and many others.
  • Mastering the Kali Linux tools in practice - any information security specialist should be familiar with it.
Test yourself on the entrance test and see the program for more details.

Hello friends! Today, Vladimir has prepared some amazing material for fans of virtual machines!

Hello admin, please tell me how to transfer the VirtualBox virtual machine to a regular computer?

A few months ago Windows 10 came out and I was afraid to install it directly on my computer, but installed it on a virtual machine, then installed all the programs I needed into the operating system: browsers, free OpenOffice, Skype and so on, after a while I began to notice that the tenth I liked Windows and even had the idea of ​​transferring it to a regular computer! Is this possible? I couldn't find such information on the Internet.

How to transfer a VirtualBox virtual machine to a regular computer. Or how to transfer Windows 10 from a virtual machine to a desktop PC using the Vhd2disk program

Hello friends! It is possible to transfer the VirtualBox virtual machine to a regular computer, and this need often arises among system administrators, developers of various software and other computer specialists; it may also be necessary for an ordinary PC user.

  • Note: There is a website created specifically for virtual machine lovers.

For transfer, you can use a still little-known program Vhd2disk- designed specifically for transferring virtual operating systems to physical hardware, or in other words - to create an exact copy of a virtual VHD disk on a regular hard drive.

So, we have a VirtualBox virtual machine with Windows 10 installed on it.

Disk management

Disk 0, this is a virtual disk with installed Windows 10.

When creating the virtual disk, I specified the size as 250 GB. The operating system is installed on the drive (C:), and various files are located on the drive (E:).

First of all, we convert the virtual disk of the VDI format belonging to the virtual machine into the VHD format.

File -->Virtual Media Manager.

Select with the left mouse the VDI virtual disk belonging to the operating system that we want to transfer to a regular computer and click on the button Copy.

Mark the item VHD (Virtual Hard Disk).

Next.

Mark the item Dynamic virtual hard disk.

Next.

Left-click on the explorer button.

We select the location to save the future copy of the virtual hard disk, I will select the disk ( G:), since there is a lot of free space.

Copy.

There is a short process of converting the VDI virtual hard disk to the VHD format.

At the end of the process, click on the button Close.

A copy of it appeared on the disk (G:) next to the VDI virtual hard disk, only in VHD format.

Disk management

You need to deploy a copy of the virtual disk onto a completely blank physical hard disk without partitions.

Open the Disk Management snap-in.

I will choose Disc 1.

I delete all partitions on it.

Vhd2disk

It's time for the Vhd2disk program. Download it from the official website:

https://docs.microsoft.com/en-us/sysinternals/downloads/disk2vhd


Let's launch the program. In the main window, left-click on the explorer button.

In the explorer that opens, find a copy of our VHD virtual disk, select it with the left mouse button and click Open VHD.

In field Target drive we must indicate the serial number of the hard drive to which we will deploy a copy of the virtual disk. Click on the arrow.

Select from the drop-down list PhysicalDrive1, since we will expand the contents of the VHD virtual disk on Disc 1.

Click on the button Vhd to disk.

The process of copying the contents of the VHD virtual hard disk to a regular hard disk begins.

The process has completed successfully.

Status: VHD dumped on drive successfully!(VHD successfully copied to hard drive!).

Go to Disk Management, click Action-->Update.

As you can see, the hard disk (Disk 1) is an exact copy of the VHD virtual hard disk from the virtual machine and Windows 10 installed.

Trying to boot into Windows 10.

We restart the computer and enter the boot menu, select our hard drive (a copy of the VHD virtual disk with Windows 10).

Preparing devices

Windows 10 is loaded!

Disk management.

There are several devices in the task manager without drivers, but this is not a problem for us; we install the drivers using .