Deploying Operating System(OS) using Virtual Hard Disk (VHD) Or VHD to Physical by command

Deploying Operating System(OS) using Virtual Hard Disk (VHD) Or VHD to Physical by command

If you are spending a lots of time for practicing different server role and you need  a fresh OS every time or you want to deploy a virtual machine then this will be helpful to you. you can make a fresh installation or a base OS with all your favourite software installed on your Windows 7/8/8.7/10 or Server 2012/2016/2019 and re-use it in future time …

At first we have to know what is Virtual Hard Disk (VHD)

1.      What is Virtual Hard Disk (VHD)

Virtual hard disk (VHD) is a disk image file format for storing the complete contents of a hard drive. The disk image, sometimes called a virtual machine, replicates an existing hard drive and includes all data and structural elements.

2.      Create a Virtual Hard Disk (VHD)

The process will start from creating a Virtual Hard Disk (VHD) and installing an operating system by Hyper-V. You can install any software or make change to this Operating system and this will be copied to all PC's.

  1. Open Hyper-V manager
  2. Action menu > New > Virtual Machine
  3. Next
  4. Name of the Virtual machine Windows 10 Pro
  5. Generation 1
  6. Startup Memory  minimum 512 Mb I am giving 4 GB as Dynamic memory
  7. Not Connected by default
  8. Create a VHD size 20 Gb or any size then Next
  9. Install an operating system from a bootable CD/DVD-ROM
  10. Image file iso : Now we have to choose the image.Iso
  11. Next > Finish

Now make any changes in this operating system by installing your favourite softwares. All the changes will be deployed or copied.

3.      Locating VHD of any Virtual Machine(vm) Optional

These steps are optional incase you are not sure where the VHD file is located of a particular virtual machine.

You can go to hyper-v virtual machines > Selecting target machine then > settings > IDE Controller > Hard Drive

Locating VHD of any Virtual Machine(vm)

4.      Mount Virtual Hard Disk (VHD)

  1. We have to go to the Virtual Hard Disk location and the .vhdx file.
  2. We have to select the .vhd file >mount
  3. This mount command will make the VHD file attached with our computer.
  4. Make sure that there is sufficient space available from where the VHD will mount. This will be mount mount as a fixed disk while working as a physical machine but dynamic feature will work in the hyper-v machine.
  5. Check The Mounted Disk

We can Check The Mounted status in Disk Management.

Check The Mounted Disk

5.      Add the Virtual Hard Disk (VHD) file in the boot entry

This VirtualDisk.vhdx can be used as a second boot (OS) by using a simple command!

To add this file as a boot entry we have to go to:

  1. Command Prompt(Run as Administrator)
  2. BCDBOOT H:\Windows

(Note: This H is the second partition Drive letter which includes the operating system files.)

BCDBOOT  H:\Windows:This designates the VHD partition as a bootable drive by copying critical files required to boot.

  1. Then We have to restart the computer.  This will make this VHD OS as Default.
  2. Reboot the host machine.
  3. When computer will starting we will get two option with NewOperatingSystem

6.      Change the OS Description of the entry (Optional):

  1. BCDEDIT /Set {default} Description NewOperatingSystem

Md. Masud Rana Suman

Md. Masud Rana Suman

I am Microsoft Certified Trainer(MCT), MCSA : Windows Server 2012 and MCP. Providing IT support from the year 2013, Which includes Operating System(Windows) support, Networking Services, WHM (Web Hosting Manager) support, WEB Hosting and Domain Name Registration services, Email Server configuration, Information Management Services, Data Recovery, Social Media Marketing, Trainer and many more ...

Comments 0

There are no comments yet.
Your message is required.