Home Useful properties of fruits How to transfer a virtual machine image. Migrating virtual machines from XenServer to Hyper-V. Linux server boot recovery

How to transfer a virtual machine image. Migrating virtual machines from XenServer to Hyper-V. Linux server boot recovery

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

Most virtualization programs support the function of converting the installed Windows operating system 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 to a Microsoft Hyper-V virtual machine is a breeze with Sysinternals' Disk2vhd software.

The program is portable, you can run it from any location on the disk after unpacking the archive. The application requires administrator rights. 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 the available volumes. Please note that you need to select a target location with sufficient free storage space, otherwise the imaging process will be interrupted.

The user must select the target path and filename (with a vhdx extension) and the volumes to be included in the virtual image.

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

Disk2VHD comes with two additional parameters 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 (64TB versus 2TB), better protection against corruption, remote online resizing, etc. VHD is needed mainly for compatibility purposes, for example, when the product does not support VHDX, and when you want to convert an image to Virtualbox.

The second parameter 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've got 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, type cmd.exe, hold down 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 the 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 the resources available on your computer.

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

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

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

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

After loading the wizard, make sure 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 the name or IP address of the device, as well as credentials.

Select the VMware virtual machine under Target Type on the next page and select the destination folder for saving the image.

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

I've always liked the free Xenserver hypervisor and used it a lot. But recently I made the decision to gradually switch to another hypervisor. Which one - has not yet decided finally. I'll tell you more about the reasons for abandoning Xenserver and general thoughts about modern hypervisors later. 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 search for and exploit vulnerabilities in information networks, I recommend that you familiarize yourself with Kali Linux Workshop online course in OTUS. The course is designed for those who have no experience in information security, for admission you need to pass.

I originally wanted to write an article on the installation of Xenserver 7 on mdadm raid1. I have always liked xen precisely for the ability to install it on mdadm. This allowed the hypervisor to be used on any hardware with two hard drives, providing simple disk-level fault tolerance. It's convenient and budget friendly. The same can be done on kvm, but personally I like xen's management snap-in as an application for windows. You can conveniently connect multiple 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 it for work, transfer it to someone for management.

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 turning off one hard drive. As it turns out, xenserver cannot boot normally if the mdadm raid goes into degreaded state. I was very upset by this fact and spent almost a day continuously trying to sort out the situation and try to solve the problem. But I didn't succeed. And on the Internet I also did not find a recipe for solving the problem, but I found confirmation of this problem.

It looks like XenServer from version 7 no longer supports running on mdadm. It's 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 describe how to transfer a clean installation of xen 7 to mdadm. It looks like these people just haven't tested one of the drives for failure. Until you check it, it seems that everything is in order. The problem here is that Xenserver 7 has switched to CentOS 7. And there are many innovations, in particular systemd. I couldn't pinpoint exactly what the problem was. There is some kind of incompatibility in the boot modules, the xenserver kernel and the mdadm version. There was a similar bug on CentOS 7 when it was released, but it was promptly fixed. And on XenServer, the developers gave up on this, since they did not promise support for mdadm. 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 the time of boot with the message:

A Start Job is running for dev-md0.device

I still have a lot of 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. You need to do some serious work with a file to start it. It was important for me to work out this moment, since in my work I will have to gradually move away from Xenserver towards either Hyper-V or KVM. I haven’t decided yet, since I didn’t manage to create virtual machines with xen on KVM, but I did manage to do it on Hyper-V. I'll tell you about this.

Moving a virtual machine from xenserver to kvm

The transfer of a virtual machine itself is a simple copy of a disk from one hypervisor to another. To backup Xenserver, I use the free version of the Alike Free program. Unfortunately, it is no longer available in the free edition. The developers have closed the free project, there is only a trial version from 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 a disk. But if after that you just start the virtual machine, you will get an error.

Error 13: invalid or unsupported executable format

There is nothing surprising in this, the modified kernel for xen works only on the hypervisor itself. To work in a different environment, you need to install the standard linux kernel. This is what I will do next. The task turned out to be very difficult, I had to poke around a lot in various nuances. First of all, in order not to forget the experience gained, I am writing this article. Although I understand that very few people will benefit from such an experience. There are hardly many people who will move the already discontinued CentOS 5 system from the Xen hypervisor somewhere else. In an amicable way, the systems need to be rearranged, and I will gradually deal with this. But you still need to have ready-made instructions at 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 has broken or you have problems after updating the kernel, the following methods of updating and replacing the kernel and bootloader can help in solving this problem.

Linux server boot recovery

In order for the virtual machine to work on hyper-v, as I said, you need to install the 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 Trouble... We are waiting for the download and choose the first proposed option.

Immediately we go to our recoverable system. The first step is to update the system and install the standard kernel. Most likely, through yum, you will not succeed, since the links to the centos 5 repositories became inactive after the system support ended on March 31st. The file needs to be changed /etc/yum.repos.d/CentOS-Base.repo by editing the paths of the corresponding 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 that, you need to start the system update.

# yum clean all # yum update

Now we will install the standard linux kernel, and remove from xen.

# yum remove kernel-xen # yum install kernel

Now we check the version of the available kernel libraries on the system.

# ls -l / lib / modules /

We take the most recent 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 chooses this kernel version when loading.

Parameter default = 1 corresponds to the second line of the menu, since the countdown starts from 0. That is, the required 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 a command like this:

# grub-install --recheck / dev / sda

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

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

It will hang indefinitely. Connected with access to the virtual machine console on xenserver. In a different environment, the parameter must be changed. To fix the error, you need to edit the file / etc / inittab... Find a string in it

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

Comment it out, and instead remove the comment from the line

1: 123457: respawn: / sbin / mingetty tty1

Now you can restart the virtual machine. It should boot up safely. At least it was like that 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 choosing the kernel version in the loader, the system simply hangs in this position.

And then nothing happens. There are no mistakes. I don't even have any ideas about what it might be and in what direction to move to launch the virtual machine. If anyone has any ideas on how to do this, I ask for advice. 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 qсow2, but all without result. They still freeze in the same way as if I were porting them directly from xenserver.

Conclusion

Migrating virtual machines works well within a single hypervisor. In case you transfer from one to another, with a high degree of probability you will get some problems. I run into this a lot, especially with linux and freebsd. Most often, problems begin with disks and the bootloader. Then the drive letters will change, you have to edit fstab, then the bootloader will not start. Sometimes the network may not work. Everywhere we have to sort it out and solve the problems that arise.

Kali Linux Workshop

A course 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. Training lasts 3 months, 4 hours a week. What this course will give you:
  • Search and exploit vulnerabilities or configuration flaws in corporate networks, web sites, servers. Emphasis on Windows penetration testing and corporate security.
  • Explore tools like metasploit, sqlmap, wireshark, burp suite and many more.
  • Mastering the Kali Linux toolkit in practice - any information security specialist should be familiar with it.
Test yourself on the entrance test and see the details of the program on.

Hello friends! Today, for fans of virtual machines, Vladimir has prepared just awesome material!

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

Several 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 in the operating system: browsers, free OpenOffice, Skype, and so on, after a while I began to notice that the tenth I liked the Windows and even had the idea to transfer it to a regular computer! Is it possible? I did not 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 Vhd2disk

Hello friends! It is possible to transfer a VirtualBox virtual machine to a regular computer, and often such a need arises from system administrators, developers of various software and other computer specialists, and an ordinary PC user may also need it.

  • Note: There is a site created specifically for fans of virtual machines.

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

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

Disk management

Disc 0, this is the virtual disk with the installed Windows 10.

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

First of all, we convert a VDI virtual disk belonging to a virtual machine to 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.

We mark the item VHD (Virtual Hard Disk).

Next.

We 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:) as it has a lot of free space.

Copy.

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

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

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

Disk management

You need to expand a copy of a virtual disk onto a completely clean physical hard disk without partitions.

Open the Disk Management snap-in.

I will choose Disc 1.

I delete all sections on it.

Vhd2disk

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

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


We launch the program. In the main window, left-click on the explorer button.

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

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

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

Click on the button Vhd to disk.

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

The process completed successfully.

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

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

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

Trying to boot into Windows 10.

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

Preparing devices

Windows 10 is loaded!

Disk management.

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

New on the site

>

Most popular