- Trim characters from strings in PowerShell - Tue, Mar 14 2023
- Set Chrome, Firefox and Edge as default mail client (mailto handlers) - Mon, Mar 6 2023
- Show or hide users on the logon screen with Group Policy - Thu, Mar 2 2023
In Hyper-V Manager, you can enlarge a VHD(X) with the Virtual Hard Disk Wizard. In VMware Workstation, the corresponding option can be found in the settings of a VM by selecting the respective drive. The disk utilities then appear in the right section, including the one labeled Expand.
Disk layout prevents expansion of OS partition
If you restart the guest OS after successfully expanding the drive and open Disk Management inside the guest to expand the Windows partition to the new space, you will see that the recovery partition blocks this attempt.
In the standard disk layout, it is to the right of the OS partition, and the unallocated space comes after it at the end of the drive. So, you have to move the recovery partition all the way to the right before you can enlarge C:.
Limited functionality of onboard tools
Disk management can enlarge and shrink partitions but not move them. Therefore, you need a separate tool for this.
The procedure suggested by Microsoft for this purpose uses DISM. First, you capture the recovery environment using this tool, then the partition is deleted with diskpart.exe, and finally, you recreate the partition and restore its contents with DISM. This procedure is cumbersome, time-consuming, and error prone.
Deploy GPartedG
It is much easier to use the GNOME Partition Editor (GParted). You do not need any of the major Linux distributions for it; rather, you can just download a slim live CD.
You attach the ISO to the virtual machine and boot it from the virtual DVD drive. If you want to move the partition on a physical machine, you first have to write the ISO to a USB stick with Rufus and boot the PC from it.
On the startup screen, confirm the preselected (and barely readable) GParted Live (Default settings).
In the next step, confirm the already marked entry ("Don't touch keymap"), and, if necessary, select a language other than the default English.
For the mode option, leave it at (0), so that the graphical interface is started and GParted appears automatically. The tool then automatically loads the partition table.
Now, it is a matter of identifying the recovery partition in the list since GParted uses different names than Windows. The easiest way to find the partition is to note the size of the partition in disk management. It is usually about 500 MB.
Then open the context menu of the respective partition and execute the command Resize/Move. In the dialog that appears, enter the value 0 in the Connecting free space field. The tool then automatically allocates the available space to the area in front of the partition.
After confirming the dialog with the Resize/Move button, nothing will happen. Instead, you first have to apply the changes using the Edit menu. Since the partition is quite small, moving it should happen quite quickly.
Finally, reboot the VM, and start Windows. In disk management, you can see that the recovery partition has moved to the far right.
Subscribe to 4sysops newsletter!
Therefore, you can now expand the system volume so that it also gets the previously unallocated space.
The functionality of the recovery partition is maintained that way? I doubt that. Please read and compare to http://woshub.com/extend-volume-blocked-by-windows-recovery-partition/ which suggests that a lot of additional steps need to be completed.
The article you are refering to doesn’t describe how to move the WinRE partition. Instead it explains how to delete and recreate the partition and how to restore the content in the new partition. This of course involves many more steps than just moving the recovery partition.
You are right, just confirmed it by trying.
In case someone is interested: you may of course do completely without 3rd party tools and you still do not need to use the bunch of commands that the woshub article suggests:
make a backup of just the recovery partition using wbadmin start backup
delete it with diskpart
extend c:
create a new partition at the end and quick format it
boot from a setup stick
use
wbadmin start recovery
to overwrite the end-placed volume with your backup of the recovery partition.
That’s it. No 3rd party tools, still quite easy.
I used to do it with the help of bootable live disk as described in this post but you approach looks even more interesting. Will definitely try this. Thank you for sharing these steps.
I tried this procedure on an old laptop running Windows 10 and I can confirm it works great.
Just followed the same procedure on Windows Server 2022. It works.
I’d just get rid of it completely. Windows recovery tools are pretty useless, cumbersome, badly documented and generally unreliable. You’re better off keeping a single cold snapshot with clear labeling, replaced occasionally, of your system, Windows should never run bare-metal (or be online for that matter) or anyway, since it’s practically malware.
It’s not that much of a performance impact—specially on things like vSAN. Enterprise CAs would be another important VM but since (1) they have just as sensitive information as DCs and (2) depend on the latter, use DFS replication on system folders and group the CA with the DCs and you’ll get least three additional copies of the data in near-real time. You can take it even further by making the DCs an IIS cluster (or three standalone IIS with shared config on DFS and centralized certs) crossing off another role needing backup.
I know you’re not supposed to make DCs available on the Internet, but if DCs have no outbound connectivity anywhere except to other DCs each on their own DMZ via strict firewall policies between them, there’s not much that can happen.