Resizeing User Profile Disk UPD VHDX file without Hyper-V tools

Resizeing User Profile Disk UPD VHDX file without Hyper-V tools

Hi!
Today i faced an issue. We have a customer with a server running as a Remote Desktop Session Host. The customer has leveraged User Profile Disks for their RDS User profiles. We ran in to errors saying that the disk space was running low. Even tough the C: had plenty of GB of free disk space.

After some troubleshooting we saw that it was the User Profile Disk that was running out of space.

When the customer set up the RDS Server the user had the UPD max filesize set to 20 GB. By design you cant increase this number after it has been deployed and the option is greyed out.

So, off to google. What did i find there?
Most of the sudgestions was to run the Resize-VHD Powershell CMD-let. But when i ran that command (after installing the Hyper-V Powershell module) i just get the below error message.

SO. How to solve this issue then? Well turns out diskpart can do exactley this. So now, in to the world of CMD and Diskpart :)

First, we go in to diskpart by running CMD as administrator and then write the command below, press enter.

C:\users\user DISKPART

Inside diskpart. We want to select the User Profile disk we want to extend. Do this by running the below command.

DISKPART> select vdisk file=Z:\UserDisks\UVHD-x.vhdx
DiskPart successfully selected the virtual disk file.

Now confirm that the right disk is selected by looking for the * before the vdisk:

DISKPART> list vdisk

------------

VDisk ###  Disk ###  State          Type       File
---------  --------  -------------  ---------  ----
* VDisk 2  Disk ---  Added          Unknown    Z:\UserDisks\UVHD-UVHD-x

As you can se, i have the * before VDisk 2 and the path is the same as when i selected the vdisk in the “select vdisk” cmdlet.

As mentioned in my case the disk was 20 GB, and my goal was to increase it to 30GB. So now we run the extend vdisk, command: (note that the maximum value is in MiB, so for 30 GB you chose 30720)

DISKPART> expand vdisk maximum=30720
 100 percent completed

Then we attach the vdisk

DISKPART> attach vdisk
 100 percent completed

Now its time to figure out what volume we need to extend.

DISKPART> list volume

--------

Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
   ----------  ---  -----------  -----  ----------  -------  ---------  --------
   Volume 0     D                       CD-ROM          0 B  No Media
   Volume 1         System Rese  NTFS   Partition    500 MB  Healthy    System
   Volume 2     C                NTFS   Partition     99 GB  Healthy    Boot
   Volume 6     G   User Disk    NTFS   Partition     19 GB  Healthy

In my case it was Volume 6. So lets select it.

DISKPART> select volume 6
 Volume 6 is the selected volume.

Now lets extend it:

DISKPART> extend
 DiskPart successfully extended the volume.

Now the disk and volume are extended to 30 GB of data. Lets open disk management to verify that the new size is 30GB:

IMPORTANT! Now, dont forget to detach the disk

DISKPART> detach vdisk
 DiskPart successfully detached the virtual disk file.

Done, Job well done :)