I have a few systems I want to shrink the primary (and only) partition to about half of the disk and then create a new partition in the newly available space. The disks are 500GB. I want to script it, so I am using diskpart; however, I have issues with using desired=[n] and minimum=[n] with the diskpart command.
Follow the progression below to get an understanding of what I am talking about.
DISKPART> shrink
Will shrink the partition by about 230GB. Which would work, however, I want to ensure that I have enough space on partition 1 (I don't want it to shrink more than half). So I run the following command:
DISKPART> shrink desired=250000
I receive an error about shrink size is too big. After reading Microsoft's guide on diskpart, I decide to add the minimum=[n] option to the same command and receive the exact same error.
DISKPART> shrink desired=250000 minimum=100000
Virtual Disk Service error:
The specified shrink size is too big and will cause the volume to be
smaller than the minimum volume size.
We already know that the partition is capable of shrinking by 230GB, which means the minimum command isn't working. According to Microsoft documentation, it will attempt the desired size and if that fails, adjust to at least the minimum size. However, the minimum statement does not seem to be working as intended as 100GB is less than 230GB. If I use the minimum=[n] option without the desired=[n] option it will shrink by the number specified.
DISKPART> shrink minimum=100000
Gives me ~100GB shrink.
What am I doing wrong? I want it to shrink by 250GB and if can't make 250, then shrink by anything else as long as it is larger than 100GB.