mirror of
https://github.com/MicrosoftDocs/windows-itpro-docs.git
synced 2025-06-15 02:13:43 +00:00
optimized procedure to expand disk size
This commit is contained in:
@ -249,36 +249,20 @@ The lab architecture is summarized in the following diagram:
|
||||
```
|
||||
### Resize VHD
|
||||
|
||||
The second Windows Server 2012 R2 VHD needs to be expanded in size from 40GB to 60GB to support imaging tools.
|
||||
The second Windows Server 2012 R2 VHD needs to be expanded in size from 40GB to 60GB to support imaging tools.
|
||||
|
||||
1. To add available space for the partition, type the following commands at an elevated Windows PowerShell prompt on the Hyper-V host:
|
||||
|
||||
```
|
||||
Resize-VHD –Path c:\VHD\2012R2-poc-2.vhd –SizeBytes 60GB
|
||||
Mount-VHD –Path c:\VHD\2012R2-poc-2.vhd -passthru | Get-Disk | Get-Partition | Get-Volume
|
||||
$x = (Mount-VHD –Path c:\VHD\2012R2-poc-2.vhd -passthru | Get-Disk | Get-Partition | Get-Volume).DriveLetter
|
||||
Resize-Partition -DriveLetter $x -Size (Get-PartitionSupportedSize -DriveLetter $x).SizeMax
|
||||
```
|
||||
|
||||
2. Note the drive letter of the mounted VHD in the output of the second command. In the example below, the drive letter of the mounted VHD is E:
|
||||
2. Verify that the mounted VHD drive is resized to 60 GB, and then dismount the drive:
|
||||
|
||||
```
|
||||
DriveLetter FileSystemLabel FileSystem DriveType HealthStatus OperationalStatus SizeRemaining Size
|
||||
----------- --------------- ---------- --------- ------------ ----------------- ------------- ----
|
||||
E NTFS Fixed Healthy OK 32.66 GB 40 GB
|
||||
```
|
||||
|
||||
If the Hyper-V host you are using has a single hard drive assigned the letter C, and a DVD drive assigned the letter D, then drive E is probably also assigned to the mounted VHD as shown above. The size of the partition for drive E is still 40 GB, but since the VHD was resized to 60 GB in the first step, there is an additional 20 GB of unallocated space available. This additional space will be allocated in the following step.
|
||||
|
||||
3. Replace **E** with the drive letter displayed in the previous command output, and type the following at an elevated Windows PowerShell prompt:
|
||||
|
||||
```
|
||||
$MaxSize = (Get-PartitionSupportedSize -DriveLetter E).SizeMax
|
||||
Resize-Partition -DriveLetter E -Size $MaxSize
|
||||
```
|
||||
|
||||
4. Verify that the mounted VHD drive is resized to 60 GB, and then dismount the drive:
|
||||
|
||||
```
|
||||
(Get-Disk -FriendlyName "Msft Virtual Disk").size/1GB
|
||||
Get-Volume -DriveLetter $x
|
||||
Dismount-VHD –Path c:\VHD\2012R2-poc-2.vhd
|
||||
```
|
||||
|
||||
|
Reference in New Issue
Block a user