Internet Windows Android

Organization of switching between the VirtualBox hypervisor and Hyper-V. How to speed up VMWare, Oracle VirtualBox and Microsoft Hyper-V virtual machines Improving performance inside a virtual machine


Hello.

1. Getting started with the transfer, first we’ll convert the .vdi hard drive from VirtualBox into a .vhd Hyper-V drive

In the VirtualBox directory we execute the command to convert the .vdi image to .raw
VBoxManage.exe internalcommands converttoraw d:\project\project.vdi d:\project.raw

We search for and install WinImage, launch it, select Disk -> Convert Virtual Hard Disk Image,
file type *.*, open .raw image, save as dynamically expanding image.vhd

2. We create a new virtual machine in Hyper-V, using a Legacy network card, since the synthetic network card will not work until Linux Integration Services is installed.

3. Remove VirtualBoxAdditions from CentOS
in the /etc/init.d/ directory
team
chkconfig --del "vboxadd"
chkconfig --del "vboxadd-service"
chkconfig --del "vboxadd-x11"

Then we delete these files from the /etc/init.d directory (vboxadd, vboxadd-service, vboxadd-x11)

4. Go to the Hyper-V settings, set a static mac address for the network card
Then in Linux we follow the path
/etc/sysconfig/network-scripts/
edit the file ifcfg-eth0 (or ifcfg-seth0) and write by analogy:
DEVICE=eth0
BOOTPROTO=static
BROADCAST=10.10.10.255
HWADDR=00:01:02:03:04 (taken from hyper-v settings)
IPADDR=10.10.10.10
NETMASK=255.255.255.0
NETWORK=10.10.10.0
ONBOOT=yes

Or we do it even simpler, run it in the console system-config-network-tui and configure eth0 (physical adapter) or seth0 (synthetic adapter).
Reboot Linux.

5. Update CentOS, type in the console:
yum update
yum groupinstall "development tools"
reboot

6. Download Linux Integration Services v2.1 for Windows Server 2008 Hyper-V R2, unpack and mount the iso into a virtual machine in the hyper-v window.

Installed Linux Integration Services gives us:
- Driver support for synthetic devices - synthetic ethernet adapter, faster than legacy erhernet
- Fastpath Boot Support for Hyper-V - faster boot of the virtual machine
- Timesync - time synchronization with the host machine
- Integrated Shutdown - the ability to turn off Linux from the hyper-v snap-in
- Symmetric Multi-Processing (SMP) Support - support for up to 4 processors
- Heartbeat - ability to monitor the state of the guest OS
- Pluggable Time Source

From the unrealized:
- Integration Services: Data Exchange, Volume Snapshot Backup
- Networking: Jumbo Frames and TCP Offload
- Storage: Hot Add/Remove (VHD‟s and Passthrough Disks)

7. Mount Linux Integration Services v2.1 ISO:
mkdir -p /mnt/cdrom
mount /dev/cdrom /mnt/cdrom

Copy files to your hard drive:
mkdir /opt/linux_ic
cp -R /mnt/cdrom/* /opt/linux_ic
umount/mnt/cdrom

Install Linux Integration Services,
cd /opt/linux_ic
make
make install

Until we reboot. If you have RedHat5.5 (and we have CentOS 5.5), then you need to go to
/boot/grub/grub.conf file and change hda=noprobe hdb=noprobe on ide0=noprobe ide1=noprobe. If we don't fix grub, we'll get a kernel panic after a reboot:

We reboot in the console and enjoy the correct operation of CentOS 5.5 under Hyper-V.

PS:
Underwater rocks:
1. At first I couldn’t understand why Linux didn’t connect to the network card from hyper-v when loading, googling suggested that I first need to use a legacy network card.
2. According to the instructions that came with Linux Integration Services v2.1, nothing worked until I googled the magic command yum groupinstall “development tools”, the package lacked these developer tools, and at the same time a fresher kernel.
3. Finally installed LIS, a joyful reboot and... kernel panic. Thoughtful reading of the documentation suggested that grub needs to be edited.

VirtualBox and Hyper-V are very powerful virtualization tools. Each of them has its pros and cons, and sometimes you need to be able to use both hypervisors on the same computer. This is real, despite the fact that when Hyper-V is activated, starting the VirtualBox virtual machine is impossible. It just ends with this error.

However, with one trick you can force them to coexist. To do this, you need to create a bat file with the following content:

MS DOS

@echo off cls echo. echo Select Hyper-V hypervisor options when booting Windows. The computer will automatically restart after selection. echo. echo 1. Enable hypervisor. echo 2. Turn off the hypervisor. echo 3. Exit. echo. set /p choice= Your choice: if "%choice%"=="1" goto 1 if "%choice%"=="2" goto 2 if "%choice%"=="3" goto 3 if not " %choice%"=="" echo "%choice%" is an invalid item echo:1 cls echo Turning on the hypervisor... bcdedit /set hypervisorlaunchtype auto shutdown -r -f -t 10 -c exit:2 cls echo Turning off the hypervisor.. . bcdedit /set hypervisorlaunchtype off shutdown -r -f -t 10 -c "The computer will restart in 10 seconds." exit:3 exit

@echo off

echo .

echo Select Hyper-V hypervisor options when booting Windows. The computer will automatically restart after selection.

echo .

echo 1. Enable the hypervisor.

echo 2. Turn off the hypervisor.

echo 3. Exit.

echo .

set/pchoice = Your choice:

if "%choice%" == "1" goto 1

if "%choice%" == "2" goto 2

if "%choice%" == "3" goto 3

if not "%choice%" == "" echo "%choice%" is an invalid item

echo

echo Enabling the hypervisor...

bcdedit /set hypervisorlaunchtypeauto

shutdown -r -f -t 10 -c "The computer will restart in 10 seconds."

exit

echo Turning off the hypervisor...

bcdedit /set hypervisorlaunchtypeoff

shutdown -r -f -t 10 -c "The computer will restart in 10 seconds."

exit

exit

This batch file works very simply. With its help, you can temporarily disable or enable the Hyper-V hypervisor without touching Hyper-V itself, its files and settings. Virtual machines created in Hyper-V will also remain safe and sound. If necessary, you need to run the bat file we created on behalf of administrator, select the desired option and your computer will automatically restart. Unfortunately, you can’t do without a reboot, but it’s still easier than tearing down and installing Hyper-V again every time. One, two, and as you can see, VirtualBox works great even with Hyper-V.

If necessary, simply turn on the Hyper-V hypervisor and use it again. Enabling or disabling is enough to do once; on subsequent starts, Windows will use the previously installed setting.

4289

To date VirtualBox is the most popular free virtualization platform, but even its adherents may at some point want to try other virtual machines, in particular the built-in platform Hyper-V. Only the user who turns it on will very soon discover that virtual machines are on his favorite VirtualBox no longer launch, and the platform gives an error "Could not open a session for the virtual machine" with code E_FAIL (0x80004005) .


The error may be caused by a failed state write VM to file VBOX, crooked cumulative update of Windows itself, disabling virtualization in BIOS, but in this case the reason lies in the conflict VirtualBox With Hyper-V. You can restore normal operation of Virtualbox by removing components Hyper-V from the system, but what to do if you still need the machines installed on this platform? Launch VM on one PC with enabled VirtualBox And Hyper-V This is not possible, but you can temporarily disable the standard virtualization component without removing it.

This is done simply. Run a command prompt or console as an administrator and run the command bcdedit /set hypervisorlaunchtype off , and then restart your computer.

Virtual machines VirtualBox will start up without errors. To return Hyper-V to working state, run the command bcdedit /set hypervisorlaunchtype auto and reboot again.

For convenience, you can create batch files with commands and place them on your desktop.

In addition, you can add a system operating mode with Hyper-V and without it to the boot menu.

To do this, in a command line running with elevated rights (not PowerShell) run the command bcdedit /copy (current) /d "Hyper-V disabled" . This will create a new item in the boot menu, and its identifier will be displayed in the console (32 character string) . Copy it to the clipboard, replace the element with it GUID in a team bcdedit /set (GUID) hypervisorlaunchtype off and run the command.

Reinstalling the operating system or changing a computer device does not mean the end of working with installed guest OSes in the program. True, an exception may be the case when the virtual machine hard drive files are located on the computer’s system drive, and the system itself cannot be restored after a critical failure. To continue working with existing guest OSes while maintaining their state, but on a reinstalled Windows or on another computer, the VirtualBox program has a tool for exporting the configuration of existing virtual machines for importing it later. Another option to continue working with existing guest OSes is to add new virtual machines based on existing files on their hard drives. We will consider all these processes below.

1. Universal virtual machine export file format

The configuration of an existing VirtualBox virtual machine is exported to the file " .ova" An “.ova” (Open Virtual Appliance) file is a universal virtual machine data storage file that can be used in various programs for virtualizing operating systems. This , . The virtual machine exported to this file can then be imported by either VirtualBox, VMware Workstation or Microsoft Hyper-V within the guest systems supported by these programs.

Let's take a closer look at the process of exporting and importing the configuration of the VirtualBox virtual machine in the main Windows system.

2. Export a virtual machine

In the VirtualBox window, select a specific virtual machine to export, click the menu “ File" and select " Export configurations».

In the next window, click " Next».

Exporting a configuration is only possible when the virtual machine is powered off, and if it is paused, VirtualBox will prompt you to reset the saved state to continue the process.

Next, the export options window will appear. We leave the preset format, but change the export file folder “.ova”, which is located on the system drive by default, to a folder, for example, as in our case, specially created on the non-system drive D.

In the next window, click " Export».

We are waiting for the export process to complete.

The exported virtual machine in the “.ova” file will be located in the specified folder, from where it can be moved to another computer, removable media, or to a cloud service. Or you can leave it, as in our case, in place - on a non-system drive, where this file will be stored during Windows reinstallation.

3. Import a virtual machine

After installing VirtualBox on a new Windows or on another computer, open the program and in the menu “ File» select « Importing configurations».

In the next window, specify the path to the “.ova” file with the exported virtual machine. Click " Next».

At the very end of the window, the path will be indicated where the “.vdi” hard disk file will be placed after import. By default, this is the system drive, and in order not to clutter it and prevent the loss of the “.vdi” file in the event of a system failure, you can change the path by specifying the storage folder on a non-system drive. Click " Import».

We are waiting for the import process to complete.

After which we will see the imported virtual machine in the list of VirtualBox machines. All that remains now is to start the car.

The guest OS will start in exactly the state it was in at the time the virtual machine was exported.

4. Adding a new machine from an existing VirtualBox hard disk file

An alternative to exporting and importing a virtual machine is to add a new machine from an existing VirtualBox hard drive file. .vdi" This method is in no way inferior to the procedure for exporting and importing a virtual machine. Moreover, if the “.vdi” file is located on a non-system drive, when you reinstall Windows on a physical computer, you don’t even have to waste time exporting the configuration. We can simply transfer the “.vdi” file stored on the system disk to a non-system disk. By and large, the process of exporting and importing a virtual machine benefits only by saving the space taken up by the “.ova” file. For example, in our case, we exported a virtual machine with the Windows XP guest OS installed, and the weight of the “.ova” file at the output was 4,11 GB While the size of the hard disk “.vdi” file of the same system is 10 GB.

This space-saving benefit may be relevant if you transfer a virtual machine to another computer using cloud storage or removable media with a limited size. In our case, when we are talking about reinstalling Windows, the method of adding a new machine from an existing VirtualBox hard disk file is quite suitable.

Launch VirtualBox and click " Create».

We set the RAM indicator. Click " Next».

In the hard drive selection window, select the option “ Use an existing hard drive", using the browse button, specify the path to store the ".vdi" file. Click " Create».

The virtual machine will appear in the VirtualBox list, we can launch it.

The guest OS will start exactly in the state in which it was saved the last time you worked with it.

Adding a new virtual machine from an existing “.vdi” file is also a way to move the guest OS hard disk file to a non-system drive of the computer if it was originally created on the system drive, and over time the space it occupied began to reduce system performance. To do this, you need to remove the virtual machine from the list in the main VirtualBox window. On the selected machine, call up the context menu and select “ Delete».

Then in the window that appears, click “ Remove from list».

After this, you can search for the hard disk “.vdi” file on the system drive (usually the default path C:\Users\Username\VirtualBox VMs), move it to a non-system disk and add the virtual machine again.

Did this article help you?

Hello again! This article will be useful for developers who use Xamarin, as well as those who develop applications for Windows and Android devices using emulators and native development tools. We will talk about how to easily and fairly quickly switch between the VirtualBox hypervisor and Hyper-V.
A short introduction. When developing applications, there is almost always a need to test them on emulators, since, for example, there are a lot of Android devices with different form factors and you want to make sure that the application will look acceptable on all devices. But with the launch of emulators, various problems begin; the emulator for Android devices out of the box (standard from Google) is very, very slow, so it is recommended to use a third-party one, for example Genymotion, which pleased me with its speed, and is probably not inferior to real devices in terms of responsiveness. To use it, you need a virtual machine (Oracle VirualBox), which in turn uses its own hypervisor. Hypervisor– this is the software necessary to run several operating systems simultaneously on one computer. To develop for Windows Phone, a third-party emulator is not required; the standard one is quite fast, but for it to work you need to use the Hyper-V hypervisor from Microsoft. Two hypervisors cannot run on a computer at the same time, hence the problem. On the blog of an English-speaking developer, I found a way to solve this problem, which I now use myself, and decided to translate it on my blog.

So, now let’s talk about how to organize switching between two hypervisors. First, you need to open a command prompt as an administrator and write the following command in it:

C:\>bcdedit /copy (current) /d "No Hyper-V"

C:\> bcdedit /copy (current) /d "No Hyper-V"

After successful execution, a message should appear containing the key we need. Next, we enter another command with the key that we got after executing the first command:

After successful execution, a message should appear informing you that the command was executed correctly. Here's how everything looks visually:

In principle, everything is ready, now you can switch between two modes, but this requires restarting the computer, which of course is not very convenient, i.e. To enable or disable Hyper-V you need to restart your computer. When the system boots, there will now be a page on which you need to select in which mode to start the system: with or without the Hyper-V hypervisor (i.e., you can use the VirtualBox hypervisor). The same page appears if you have two systems on your computer:

It may be that the selection page will not be displayed when you restart the computer, this can be configured, or you can simply click on the restart button in the windows menu while holding down the Shift key.
That's all for me, I think this article helped you, bye everyone!