I was getting ready to upgrade Windows from 2019 to 2022 on my SQL Server and I noticed that my OS drive only had about 9 GB of space left on it. I decided to add a little more space to this drive. It is a virtual server running on HyperV, not that the hypervisor is important. You can easily add space to a virtual drive whether you are running Hyper-V, VMware, VirtualBox, or other hypervisors. However, after I expanded the virtual disk and rebooted my server, I noticed that the Windows Recovery partition was in the way and preventing me from extending the volume.
Luckily, there is an easy way around this with a great utility that has been around forever, GParted (GNOME Partition Editor).
First, I had to download the GParted Live CD so that I could boot my server into the GParted utility.
After the download, I attached the Live CD to my virtual server in the Hyper-V settings.
I made sure the CD drive was set as the first boot device in the virtual server settings and booted the server. On reboot, I was presented with the GParted boot menu. I selected the first item, GParted Live (Default settings).
And then I was in the GParted partition editor utility. Now, my server has 3 disks. One is the OS drive and the other two are disks for SQL server data and log files. For some reason, the GParted utility picked up the SQLData disk on startup.
So, I had to change to the OS disk by selecting the GParted menu and then select devices and switch to OS disk (/dev/sdb). The GParted Live CD is a Linux OS so the drives are labeled as they would be in Linux OS.
Ah, now that I had the correct disk selected in the utility I could get to work moving the Windows Recovery partition to the end of the volume.
To do this I selected the small Windows Recovery partition and then right-clicked it to get the context menu. Then I selected Resize/Move from the menu.
That brought up the Resize/Move dialogue.
Then I just slid the partition to the far right of the partition table.
And click the Resize/Move button. This brought the partition dialogue back up and showed the partition table with the unallocated space next the OS volume and the Recovery partition at the end of the volume.
Not done yet! You have to click the green checkmark in the utility ribbon menu to confirm the change and acknowledge the dialogue that asks if you are sure you want to make the change.
Once you click apply GParted gets to work moving the partition. And if all goes well, you get dialogue letting you know that the operation was completed successfully.
Next, quit the GParted ulility.
And shutdown GParted by selecting the red ‘Exit’ icon and confirming the shutdown.
There will also be a window upon shutdown to confirm that the GParted Live CD is unmounted. You can check this in your Hypervisor settings. Below you can see that the GParted Live CD is removed from the virtual server settings. If the Live CD is still attached, it will prevent the server from booting into its OS and it will just reboot back into GParted.
Now I just reboot my server into Windows Server and open Disk Manager to see that I can now successfully extend the OS volume into the unallocated space.
From here it is just clicking next on the to extend volume wizard dialogues to extend the volume.
After clicking Finish, the volume has been successfully grown.
SUCCESS! That is all there is to it. Thank you, GParted.