In Windows Server 2012 R2, we can now resize VHDx files without taking them offline.
Not applicable to VHD files
Works with Fixed, Dynamic, and Differencing VHDx files
Operation can be cancelled without loss of data
Shrinking depends on unallocated space at the end of the VHDx
NOTE:? Applies to both Generation 1 and Generation 2 VMs.