Installing Win 7 to a virtual disk with a VHD file

  
        

After the release of Windows7 beta1, many friends hope to experience it. However, it is only a beta version after all. After the experience is over, how can it be installed and not affect the existing XP or Vista system? The method is yes, we can use the new VHD file provided by Windows7. Windows 7 is installed to a virtual disk. Come with me below.

First, understand VHD

What is a VHD file? In fact, VHD files are no stranger to us. After creating a virtual computer with Microsoft Virtual PC software, VHD will be generated. file. In addition, under Windows 7, if you click "Start → All Programs → Maintenance → Backup and Restore", and then click "Create Backup Mirror" in the dialog box that opens, you can back up the selected partition and generate it after backup. Also the VHD file. In addition, under the "Operation" menu of the Windows 7 Disk Manager (Figure 1), you can also find options such as "Create VHD".

VHD is a file, but in the Windows 7 Disk Manager, we can virtualize a VHD file into a disk partition via the "Operate → Add VHD" menu. Disk 2 in Figure 1 is the disk partition virtualized by the VHD file. In Windows 7, we can use virtual disk partitions like normal disk partitions without any difference.


Using VHD virtual disk partitions, we can hide and protect important files and even install operating systems.

Second, virtual installation Windows7

VHD files can be used on the server, virtual multiple hard drives, so that the client can access the same server installed on multiple virtual hard disks A file in a system or virtual hard disk. On the one hand, hardware costs can be saved. On the other hand, different clients can enjoy different services. In addition, it is also good for backup, maintenance and security - on the server side, technicians only need to manage the corresponding VHD files.

Below, we will demonstrate the virtual installation of Windows 7. Assuming that the operating system Windows XP (although other systems) is already installed on the computer, Windows 7 is now installed in a VHD file on the computer. When booting, Windows XP or Windows 7 can be selected through the menu. The entire architecture is shown in Figure 2. In order to complete this operation, please prepare a partition with at least 10GB of free space on the computer. In this case, the D drive is selected, and the free space is 20GB.


1. Installation Process

Step 1: Start the Installation Wizard

Start the computer with the Windows 7 installation CD, when the installation wizard runs to the language setting interface Press the "Shift+F10" key combination to bring up the command prompt window, as shown in Figure 3.


Step 2: Load the virtual hard disk

Enter the following commands in turn. Note that each input of a command must press the Enter key to confirm.

Command 1: Diskpart

Command: Run the partition management command.

Tip: In the past, the partition management command provided by Windows system was Fdisk. Since Windows XP, Fdisk was replaced by Diskpart. Diskpart is powerful enough to provide almost all the features of a partitioned magician, and more importantly it supports scripting.

Command 2: Creste vdisk file=e:ls.Vhd type=fixed maximum=12000

Command: Create a virtual hard disk. The hard disk is simulated by a file (file=e:ls.Vhd) stored in the root directory of the D drive. The maximum space of the hard disk is 12GB. The type=fixed in the command indicates that the capacity of the virtual hard disk is fixed.

It should be noted that it may take about 10 minutes to execute this command. At this time, except that the hard disk indicator on the computer is blinking, there is no reaction on the screen. Please be patient, don't worry. Think of the crash. If the command is executed successfully, the screen returns the prompt "Diskpart successfully (created) the virtual disk file".

Command 3: Select vdisk file=e:ls.Vhd

Command: Select the VHD file you just created (file=e:ls.Vhd) to act as a virtual hard disk (vdisk).

If the command is executed successfully, the screen will return "Diskpart successfully open the virtual file".

Command 4: Attach vdisk

Command Function: Activate the virtual hard disk.

If the command is executed successfully, the screen prompts: "Diskpart successfully attached the virtual file".

Command 5: Exit

Command Action: Exit Diskpart.

Tip: The key to this installation method is to create a VHD file by using Diskpart and virtualize it as a hard disk. The actual test shows that to complete this operation, the version number of Diskpart must be 6.1.7000, which is provided by Windows 7. Although Windows XP and Vista also provide the Diskpart command, but the version is lower than 6.1.7000, you cannot install Windows XP or Vista in this way. In addition, the original operating system of the C drive can also be Vista or Windows 7.

Step 3: Format the virtual hard disk

Close the command prompt window and click “Next” to let the installation wizard continue to run until the interface shown in Figure 4 appears. Please note the information here: On my computer, there is a hard disk, marked as Disk0, and there are 3 partitions below it. The virtual hard disk flag just added is Disk1, followed by the word "Unallocated Space", indicating that it has not been partitioned and formatted. It will now be partitioned and formatted.


First, select Disk1 and click "Drive Options (advanced)". Next, click “New” in the next interface. At this point, the program will ask us to enter the size of the first partition. The default is the maximum value (12GB in this example). Please click "Apply" to create a unique partition with the maximum space of the virtual hard disk. Then, click on "Format" to format the partition of the virtual hard disk. Finally, click "Next" to return.


Step 4: Finish the installation

In Figure 4, select the installation location for the partition of the virtual hard disk you just created, and then click “Next” to continue. get on. Once completed, you can select which system to enter through the boot menu, as shown in Figure 5. In Figure 5, the former is Windows XP and the latter is Windows 7.


2. Effect display

On the surface, the partitions that can be observed are different after booting into two systems. On my computer (there are only two real hard disk partitions), as shown in the following table (√ indicates that it can be observed, × indicates that it cannot).


After booting to WindowsXP, you can observe all the partitions of the real hard disk under "My Computer", you can find the VHD file created by the command prompt, but you can't pass the normal method. Convert it to a virtual hard disk so you can't see the content.

After booting to Windows 7, you can also observe two partitions, one is the logical partition of the real hard disk (ie Disk 0) that stores the VHD file, and the other is the hard disk virtualized by the VHD (ie Disk 1) ) partition, as shown in Figure 6.


In Figure 6, the author has marked the partitions that can be displayed under Windows XP with dots, and the partitions that can be displayed under Windows 7 are marked with a five-star symbol. Under Windows 7, the C partition is virtualized by the VHD file. However, the operation is completely the same as the real system.


Tip: Under Windows 7, the partition for installing Windows XP can also be displayed by setting it: right-click on Disk Manager and select "Change drive letter and path", then Click "Add" and follow the default options all the way.

Compared with the ordinary dual Windows system, the advantage of this installation method is:

● The two systems are isolated from each other, avoiding the destruction of another system due to misoperation under one system. Important files for the system.

●Maintaining Windows 7 has become easier. Just backup the VHD file under Windows XP.

●To maintain Windows XP under Windows 7, just display the partition where it is installed.

Three, why VHD was introduced into Windows7

Maybe Microsoft has realized that experiencing new systems and installing new software is what many people need. The virtual disk technology allows users to achieve these requirements most securely. Install the operating system into a file. In fact, Linux systems such as Ubuntu already have this feature.

Copyright © Windows knowledge All Rights Reserved