Today, I experimented with shrinking Windows Server 2008 disk volumes. Very quickly, one realizes that you can only shrink a volume up to 50% of its original size when using Windows 2008 Disk Management and/or Diskpart. Diskpart used for this post and it has the handy command line option shrink querymax that returns the maximum number of bytes that the volume can be reduced.
I read that diskpart can only shrink a volume up to the value of “the largest free space extent”. This value can be obtained by running the command defrag <drive letter> -a; the output for the command being shown below:
So, they were right, whoever they were, sorry I can’t remember. We from the output of the diskpart and defrag commands that the maximum number of reclaimable bytes and the largest free space extent are equal.
At this point I wondered what was stored on the 50th GB disk sector? To begin my search, I started with NTFSInfo. A disk utility from Microsoft which can provide you with the following:
• The size of the volume in megabytes
• The total number of sectors and clusters
• The free space available
• The starting cluster and size of the Master File Table (MFT)
• The starting cluster of the MFT Mirror
When I ran NTFSInfo, I saw the output below and was, at that moment, very interested in the MFT Mirror:
As you can see, the total number of clusters on my volume is 26213887. The MFT Mirror started on sector 13106943, the 50th GB.
I did some more searching and finally came across an HP document entitled Technical overview of Windows Server 2008 with Microsoft Exchange Server 2007 on the HP EVA array family. In it, I found the next two paragraphs (and Figure 11) which explain why you cannot shrink a volume by more than 50% of its original size.
“You cannot shrink a volume behind 50 percent of the original volume size. This limitation is by design and is caused by the NTFS structure and the most important key system (metadata) file that defines an NTFS volume: The Master File Table (MFT). The MFT is the place where information about every file and directory on an NTFS volume is stored, and is, in essence, a relational database table that contains various attributes about different files. It acts as the “starting point” and central management feature of an NTFS volume − sort of a “table of contents” for the volume.
A mirror copy of the MFT vital records exists for reliability and is stored exactly in the middle of the logical disk (see Figure 11). The MFT mirror copy cannot be moved and is the root cause of the shrink limitation of 50 percent of the original volume size; simply put, where the copy of the MFT resides on the logical disk.”
I too have experiemented with this, and found the HP comment to be not totally correct. Here is what I did:>>Create a 200GB partition on a 400GB drive during install. The MFT dutifully installs at around the 100GB mark. Shrink the disk to slightly over 100GB using the built-in utility. Next expand the partion to 400GB. Then try to shrink the disk again to 100GB. <>IT CAN’T BE DONE!<> The maximum allowable reduction is to 200GB. I checked the location of the MFT, and it’s still at 100GB.>>I don’t know the exact cause, but I speculate that the minimum size is set not by the actual location of the MFT, but rather by an <>indirect<> marker storing the 50% location of the largest size to which the partion has ever been set … likely a registry entry.
I managed to get past this using Perfect Disk, which can defragment and move system files such as the MFT.
I was able to reduce the system drive from 250G to 40G.
To fix this I used Bootit NG. Worked fine