authority July 1, 2012 at 00:01

Installing Windows 8 on a VHD disk

  • Lumber room *

The other day I wanted to install and test the Windows 8 Release Preview OS without damaging the existing one without unnecessary actions, such as changing the partition structure on the disk. Previously, I was unable to install Windows 8 RP on VirtualBox, and had to look for an alternative. As it turned out, the solution is extremely simple; Windows 8 supports installation on a VHD virtual disk. Support for this technology has been built-in since Windows 7 and Windows Server 2008. I think it is unnecessary to delve into the theory; a VHD virtual disk is a file that is created in an already existing file system of one of the current partitions. In simpler words, the current OS will treat the VHD file as a separate disk with its own partitions.
Installation:
All that is needed to install Windows on a virtual disk is, of course:
1. image recorded on a disk or, best of all, on a USB flash drive (speeds up the installation process).
Next, we reboot the computer with the prepared image and run the Windows 8 installation wizard.
2. In the Windows 8 installation wizard, we reach the option to select an installation mode and select a custom installation. The next step will ask you to select the drive where you want to install Windows 8.
3. At this step, press the key combination SHIFT+F10 and a command mode window will open, in which we will create a VHD file for installation.
4. This is an important step because in the Windows 8 Setup Wizard the drive letters will not be the ones you are used to. Commands DIR C: , DIR D: etc. will help you find the letter of the required partition for the future VHD disk - navigate by the free space on the disk, which is displayed by the DIR command.
5. Run the DISKPART utility. Run the command CREATE VDISK FILE=”D:\w8.vhd” type=FIXED maximum=40000 (where D: is the letter of your free disk determined in step 4)
6. Execute the command SELECT VDISK FILE=”D:\w8.vhd”
7. ATTACH VDISK – the created virtual disk is mounted.
8. Exit command mode with EXIT
9. In the Windows 8 Setup Wizard disk selection window at the bottom left, click the “Refresh” button.
10. Select the new disk that appears as the installation disk and click “Next”
11. The wizard will continue installing Windows 8 into the virtual disk without affecting the structure of existing disks and data.
Conclusions:
By installing Windows 8 on a VHD virtual disk, the most important thing is that we did not damage anything, and we can use two (or more OSes) at the same time. The only disadvantage of installing the OS using this method is, as you may have guessed, the decreasing performance of disk operations. But the advantages still outweigh the disadvantages:
1. The possibility of peaceful coexistence of several Windows operating systems on one disk, or even installation of several copies of Windows 8 - for testing and development.
2. Windows 8 installed in this mode on a virtual partition will see it as a regular C drive.

Tags: Windows 8, installation, vhd, virtual, disk,

Everyone enjoys the new Windows 7 ( at least even because it's not Vista, just kidding), and one of its new features is the ability to mount VHD (Virtual Mount Disk) files. The beauty is that all the experiments take place with a regular virtual disk file on your hard drive, so you don’t have to create a new partition or format an existing one, or use dual boot. For the operating system, the VHD file looks like the most common partition from which you can boot the OS.

Let's see how you can install and boot Windows 7 from a VHD file. There is no need to create new partitions for this as the files will be located in the VHD file, but with the support of your computer's hardware, hence Aero will work to its full potential.

First of all, make sure that there is free space on your hard drive for the file, especially if the virtual image as a VHD file was created as a dynamically sized image.

We need two files: a new download manager bootmgr, which supports booting from VHD, and bcedit.exe, which allows you to edit boot entries. program bootmgr can be taken from the Windows 7 installation disk, and the file bcedit.exe from an installed Windows 7 system (for example, get it from the same VHD image). For the lazy, just download the bootmgr and bcedit files .

We need to overwrite the file c:\bootmgr. In turn, the file c:\windows\system32\bcdedit.exe You don’t have to rewrite it, but run it from another location. In any case, it is better to save the old versions of the files, out of harm's way.

Now open the console ( Start>Run>CMD in XP or Start>CMD in Vista) and create a new entry:

bcdedit /copy (current) /d "Windows 7"

As a result, we get the GUID of the new entry. Now you need to specify the address with the VHD file to download:

bcdedit /set (GUID) device vhd=\vhd\win7b.vhd

bcdedit /set (GUID) osdevice vhd=\vhd\win7b.vhd

If you want Win 7 to be the last OS in the list when you boot your computer, run the following command:

bcdedit /displayorder (GUID) /addlast

As a result, the entry with the required GUID is moved to the end of the list.

And this is how you can change the name of the operating system when loading:

bcdedit /set (GUID) description "Winda 7 v VHD"

To force Windows to detect a drive through the HAL, use the following command:

bcdedit /set detecthal on

Normal, reboot. After loading, Win 7 will begin installing drivers, another reboot and away we go, Windows 7 with Aero!

As a result of our in-depth manipulations, a 16 GB virtual disk and a second 200 MB virtual disk partition containing system files are created. The size of 16 GB was obtained because the VHD image was automatically converted into an image with a fixed size and immediately occupied the entire area allocated for it.

The resulting VHD file, by the way, can be loaded without problems in the Virtual PC virtual machine.

How to remove Windows 7 installed in VHD

If you have already messed around with installing in VHD and decided to get rid of it, you can do it as follows. In fact, we just need to remove the mention of Windows from the boot menu.

Before installing the system, you need to create a virtual machine for it - Windows will treat it as a full-fledged computer. This is what VirtualBox is designed for.

  1. Launch VirtualBox Manager and click on "Create".
  2. In field "Name" enter "Windows XP"- the remaining fields will be filled in automatically.

  3. Select how much RAM you want to allocate for the OS you are installing. VirtualBox recommends using a minimum of 192 MB of RAM, but if possible, use 512 or 1024 MB. This way the system will not slow down even at high load levels.

  4. You will be prompted to select a virtual drive that can be attached to this machine. We don't need this since we are going to install Windows using an ISO image. Therefore, there is no need to change the settings in this window - we leave everything as it is and click on "Create".

  5. Leave the selected disk type "VDI".

  6. Select the appropriate storage format. Recommended to use "Dynamic".

  7. Specify the number of gigabytes you want to allocate for creating a virtual hard disk. VirtualBox recommends highlighting 10 GB, but you can choose a different value.

    If in the previous step you selected the “dynamic” option, then Windows XP will initially occupy only the installation volume on the hard drive (no more than 1.5 GB), and then, as you operate within this OS, the virtual drive can expand to a maximum of 10 GB .

    With a “fixed” format, 10 GB will immediately be occupied on the physical HDD.

This stage ends when creating a virtual HDD, and you can proceed to setting up the VM.

Setting up a virtual machine for Windows XP

Before installing Windows, there are a few more tweaks you can make to improve performance. This is an optional procedure, so you can skip it.


After setting up the VM, you can begin installing the OS.

Installing Windows XP on VirtualBox

  1. In the left side of VirtualBox Manager, select the created virtual machine and click on the button "Run".

  2. You will be prompted to select a boot disk to run. Click on the folder button and select the location where the operating system image file is located.

  3. The Windows XP installation utility will launch. It will perform its first actions automatically, and you will need to wait a little.

  4. The installation program will greet you and prompt you to proceed with the installation by pressing "Enter". Hereinafter, this key will mean the key Enter.

  5. The license agreement will open, and if you agree with it, then press the button F8 to accept its terms.

  6. The installer will ask you to select the drive where the system will be installed. VirtualBox has already created a virtual hard disk of the size you selected in step 7 when creating the virtual machine. So click Enter.

  7. This area is not yet marked, so the installer will prompt you to format it. Choose from four available options. We recommend choosing the option "Format partition in NTFS system".

  8. Wait while the partition is formatted.

  9. The installer will automatically copy some files.

  10. A Windows installation window will open and the installation of devices will begin immediately, please wait.

  11. Check that the system language and keyboard layout settings selected by the installer are correct.

  12. Enter your username; you do not need to enter your organization name.

  13. Enter your activation key if you have one. You can activate Windows later.

  14. If you want to delay activation, select in the confirmation window "No".

  15. Enter your computer name. You can set a password for your account "Administrator". If this is not necessary, skip entering the password.

  16. Check the date and time and change this information if necessary. Specify your time zone by selecting a city from the list. Residents of Russia can uncheck the box "Automatic changeover to daylight saving time and back".

  17. Automatic installation of the OS will continue.

  18. The installer will prompt you to configure your network settings. For regular Internet access, select "Regular Settings".

  19. You can skip the step of setting up a workgroup or domain.

  20. Wait until the system finishes the automatic installation.

  21. The virtual machine will be rebooted.

  22. After the reboot, there are a few more settings you need to make.

  23. A welcome window will open, in which click "Further".

  24. The installer will prompt you to enable or disable automatic updates. Choose an option based on your personal preference.

  25. Wait while your internet connection is checked.

  26. Choose whether the computer will be connected to the Internet directly.

  27. You will be prompted again to activate the system if you have not already done so. If you don’t activate Windows now, you can do it within 30 days.

  28. Create an account name. It is not necessary to come up with 5 names, just enter one.

  29. This step will complete the setup.

  30. Windows XP will begin loading.

After downloading, you will be taken to the desktop and can start using the operating system.

Installing Windows XP on VirtualBox is very simple and does not take much time. In this case, the user does not need to look for drivers compatible with PC components, as would be necessary to do during a regular installation of Windows XP.

The performance of such a system will be higher than when using virtual machines. Because When using virtualization, two systems run simultaneously on a computer. And in the case of VHD, there is only one and all computer resources are allocated to it.

Windows 7 and higher can be used as the main system. Using this method, you can install an operating system from Windows Vista and higher on a virtual disk.

Attention!

Booting from VHD disks in Windows 7 is supported only by the Ultimate and Enterprise editions.

In Windows 10, booting from VHD is supported by the Professional edition and higher.

So, let's begin.

Creating a virtual hard disk (VHD)

There are two ways to create a VHD in Windows 7 - using the Diskpart utility (using CMD), or through the visual interface of the Disk Manager. The second method is simpler and more visual, so we use it.

Open Disk Manager. This can be done in the following way: Start -> Control Panel -> Administration -> Computer management -> .

Specify the location of the VHD file.

The file size must be large enough so that it is enough to deploy the operating system, install updates, necessary programs and store various files. At the same time, the file size should not be larger than the free space on the disk where it is located.

I prefer to select the virtual hard disk format " Dynamic expansion", because this mode saves space.

Click OK, a VHD file is created.

After this, the created virtual disk appears in the "" console. But it is not initialized.

It is initialized through the context menu:

As a result, we created a virtual hard disk, it is located on drive D: ( D:\MyDisk.vhd) and is visible in the operating system. You can deploy another “OS” on it.

Deploying Windows Operating System on VHD

To do this you will need a utility imagex.exe from the Windows AIK or Windows ADK. I have already prudently taken this utility from WADK and attached it to the article. Download imagex for x64 and x86 you can at the bottom of the page.

You will also need the file install.wim from the Windows distribution. In the distribution it is located in the folder Sources. Let's assume that we have an installation DVD inserted into the drive and the path to install.wim looks like this - E:\Sources\install.wim.

Deploying the OS from the install.wim file to disk is performed as follows.

Since one WIM file can contain several OS images, we will first determine the index of the image we need:

imagex /info E:\sources\install.wim

Let's assume that the required Windows is located under index 1.

We deploy 1 operating system from the index onto our VHD:

imagex /apply /check E:\sources\install.wim 1 Z:\

where Z: is the letter assigned to our VHD.

After you finish deploying the operating system, you can go to the VHD disk and make sure that its directory structure matches the Windows system disk.

If everything went well, then we proceed to adding information to the OS bootloader that it is also possible to boot from our VHD.

Changing information in the Windows boot loader

Launch the command line with administrator rights.

We create a copy of the current operating system in the bootloader and give it the description “Windows 7 VHD”:

bcdedit /copy (current) /d "Windows 7 VHD"

Running this command will also display the GUID of the new entry. Write it down or copy it - we will need it.

If you forgot to write down the GUID, you can find it out by running the command bcdedit without parameters.

bcdedit /set (GUID) device vhd=\MyDisk.vhd

bcdedit /set (GUID) osdevice vhd=\MyDisk.vhd

Don't forget to change the drive letter and path of the VHD file to your own.

Some x86-based systems require you to change the boot configuration setting for the kernel to find specific hardware information and successfully perform a native boot from the VHD:

bcdedit /set (GUID) detecthal on

where GUID is the identifier of our new entry in the loader.

Completion

Now you can reboot your computer.

When you start the computer on a black background, you will be asked within 5 seconds to select an operating system. Choose your newly created system.

Disabling boot from VHD and returning to original state

To return your computer to its original state, you must complete the following steps (in any order):

  • Remove entry from bootloader.

    To do this we run the command bcdedit without parameters. She will show us all the records. We find our added entry and its GUID in the list.

    To remove it, run the command:

    bcdedit /delete (GUID)

  • Delete the virtual disk from the console "".
  • Delete VHD file.

P.S. Describe in the comments for what purposes do you use the technology of booting from a VHD virtual disk?

VHD is a file format used, for example, by the Microsoft Virtual PC virtual machine to emulate a hard drive. I have written repeatedly about the support of this format by the Windows 7 operating system. It's time to tell you how you can make Windows 7 run directly from a virtual hard disk and run on physical hardware, without using a virtual machine. The Windows 7 boot loader can work with VHD files and launch the OS from them, as if from a regular hard drive.

What is it for

  • On physical hardware, the system runs much faster than in a virtual machine, and uses all the “delights” of this hardware. So, if your graphics card supports Aero, then you will get it.
  • You will have full access to your PC's data, since the physical hard drive will be "visible" from the system booted from the VHD.
  • The system in VHD is stored in one file, which means you can:
    -easy to clone by simply copying the VHD file
    -you can test beta versions of software without worrying about the system
    -you can study the system, experiment with the registry, without fear of “dumping” it.

Where to begin

We will need:

  1. Installed operating system Windows 7
  2. VHD file
  3. Bootable DVD with Windows 7
  4. DiskPart utility (it is included in the system)

There are two ways to create a VHD file:

  1. via Windows 7 interface;
  2. via the command line directly while booting from DVD.

Working from an installed operating system

Launch Disk Management: by clicking on "Computer" on the menu "Start" right click, select "Control", and on the left click "Disk Management":

Execute menu item "Action"-"Create a hard drive". This window will appear on the screen:

Set the hard drive location and size options. In this example, I create a new Win7.vhd file on drive F: with a size of 30 Gigabytes of dynamic type.

The virtual hard disk is ready for use. Insert the Windows 7 installation disc into the DVD drive, reboot your current OS, boot from the DVD and wait for this window to appear:

Click Shift+F10 Diskpart and press Enter.

Enter the following commands:

Select vdisk file="F:\win7.vhd" attach vdisk

Replace F: on the right path in your system.

Close the command prompt window and begin installing the operating system. When selecting a partition, ignore this warning:

Working with DVD media

Insert the Windows 7 installation disc into the drive, boot from it and wait for this window to appear:

Click Shift+F10. This keyboard shortcut will give you access to the command line. Type in it Diskpart and press Enter.

Print in DISKPART the following command:

Create vdisk file="G:\win7.vhd" type=expandable maximum=30000

It means creating a win7.vhd file of an expandable type, limiting the maximum size to 30 Gigabytes. Replace G: to the name of the drive where you want to store the created file.

Mount the VHD file so it is available to the installer:

Select vdisk file="G:\win7.vhd" attach vdisk

You can then close the Command Prompt window and install to the VHD partition as if it were a regular logical hard drive partition. When selecting a partition, ignore this warning:

Download options

The installation program itself will write a new entry in the boot option, however, it will call it “Windows 7”. Most likely you will want to change the name. This is easy to do using a standard utility bcdedit.exe. Launch the command line interpreter cmd.exe on behalf of the administrator, click "Start", in the search field enter cmd.exe and press CTRL+ENTER. If you have a "new" system booted from a VHD, enter:

Bcdedit /set (current) /d "Windows 7 from VHD"

Otherwise, you can similarly rename the current system, or find the VHD OS ID in the output bcdedit by running it without parameters:

In my case the entry has an ID (default) and I will run the following commands:

Bcdedit /set (default) description "Windows 7 From VHD" bcdedit /default (current)

They mean:

  1. Set the system (default) description to "Windows 7 From VHD"
  2. Boot the current OS by default. I was running Windows 7 from physical media, i.e. "native".

conclusions

This article described the basic techniques for organizing the boot of Windows 7 using virtual hard drives. The steps described are enough to install Windows 7 in a VHD file and boot it from it. You can get more information about VHD from the article


Close