In this video, learn to create VHD and VHDX files, which are used for creating virtual machines in Hyper-V.
- [Instructor] We can use PowerShell to create VHD and VHDX drives in order to use for our Hyper-V server. Let's go ahead and click on Add Roles and Features and from here we'll need to add the Hyper-V role first and then we can use the PowerShell commands to create our VHD and VHDX files. Let's go ahead and check the Hyper-V box and we'll install. Once Hyper-V is installed we will need to reboot and then wait for Server Manager to finish its configurations before we can get into the PowerShell commands. As we see the feature installation install, you can see there's a special Hyper-V module for Windows PowerShell and that's what we need in order to run these commands. And we were successful. We'll go ahead and click Close and we'll restart. Our server has been rebooted. Let's go ahead and get into PowerShell and run our commands. Let's start with the NEW-VHD command and we're going to choose dynamic which means that it will expand dynamically rather than fixed which will use all of the space at the front end. Now, the difference between the two is, besides not using up all the space on the dynamic side, dynamic will run more slowly because it needs to expand as it needs to. Now, the fixed size will use up all your data all at once that you choose to allocate however it will run more quickly because it doesn't have to go through that expansion. Now we're creating a VHD rather than a VHDX to start with. A VHD file is used for Generation 1 virtual machines. That's typically going to be older virtual machines such as Windows 2003, 2000, also you could do it with 2008 as well. You can even create a Generation 1 2012, 2016, 2019 server if you want, but you don't have all the same tools and abilities with a Generation 1 that you have with a Generation 2. Let's go ahead and hit enter and we see our VHD file has been created. Let's go ahead and clear the screen and let's do the same thing with a VHDX file. We see it's virtually the exact same command except for we made a couple of changes. One is, instead of being VHD, it says VHDX as far as the file name goes. The other is, we've changed it from dynamic to fixed. We say now that it's going to be a fixed 10 GB file. Go ahead and hit enter. And this does take a little bit longer because it needs to create the full 10 GB file. Let's take a look at those two files in Windows Explorer. Inside our VHD folder, we now see the Virtual1 file is only 28 KB. That's because it's dynamically created and it's going to be expanding as it needs to. Whereas Virtual2 which is our VHDX file, that one is 10 GB. It went ahead and created the entire amount all at once. You can now use these files to create virtual machines either in PowerShell or through the graphical user interface. PowerShell can play a big role in your storage creation needs as demonstrated by creating a drive for virtual machines in Windows Server 2019.
- Working with the Computer Management interface
- Formatting disks and editing files from the command line
- Configuring advanced file services
- Using PowerShell to create VHD and VHDX files
- Implementing Storage Replica
- Configuring tiered storage
- Data deduplication
- Storage on Hyper-V
- Creating a RAID mirror in Storage Spaces Direct