IVdsVolumeShrink::Shrink fails when provided value returned from QueryMaxReclaimableBytes

Article ID: 976436 - View products that this article applies to.
Expand all | Collapse all
Source: Microsoft Support

RAPID PUBLISHING

RAPID PUBLISHING ARTICLES PROVIDE INFORMATION DIRECTLY FROM WITHIN THE MICROSOFT SUPPORT ORGANIZATION. THE INFORMATION CONTAINED HEREIN IS CREATED IN RESPONSE TO EMERGING OR UNIQUE TOPICS, OR IS INTENDED SUPPLEMENT OTHER KNOWLEDGE BASE INFORMATION.

Summary

IVdsVolumeShrink::QueryMaxReclaimableBytes() can return more reclaimable bytes than actually is available for a given volume.

Symptoms



A user of third party applications to resize (shrink) a volume encounters an error and following event is logged in the event viewer.  This symptom can also occur using Windows tools, such as diskpart.

Log Name:      Application
Source:        Microsoft-Windows-Defrag
Date:          9/21/2009 3:21:19 PM
Event ID:      257
Task Category: None
Level:         Error
Keywords:      Classic
User:          N/A
Computer:      <compter name>
Description:
The volume (X:) was not defragmented because an error was encountered: This shrink size
specified is too big. (0x89000021 => DF_E_SHRINK_SIZE_TOO_BIG)


IVdsVolumeShrink::Shrink will fail with VDS_E_SHRINK_TOO_BIG

Cause



The application may be using IVdsVolumeShrink::QueryMaxReclaimableBytes() method to find the maximum number of bytes which can be reclaimed from the current volume. However, this method can return more reclaim-able bytes than what is actually available. When
IVdsVolumeShrink::Shrink() is provided (as first parameter for ullDesiredNumberOfReclaimableBytes) with the value returned above, it is possible that IVdsVolumeShrink::Shrink() will fail as with above event log.

IVdsVolumeShrink::QueryMaxReclaimableBytes() relies on underlying Defrag APIs to determine the amount of volume space that can be recovered. This is because the shrink operation needs to account for immovable files on the volume, as the file system extent must be adjusted along with the volume length. Although this API has been substantially improved in Windows 7, there are still immovable files that are not properly detected.

Resolution



The application should call IVdsVolumeShrink::Shrink() with following parameter values for maximum shrinkage:

ullDesiredNumberOfReclaimableBytes ==> Set to value of reclaimabl bytes obtained from IVdsVolumeShrink::QueryMaxReclaimableBytes()
ullMinNumberOfReclaimableBytes     ==> set to Zero


With these parameters, Virtual Disk Service (VDS) shrinks the volume as much as it can.  Also, because some files are temporarily immovable, the application may be able to recover additional space if it calls IVdsVolumeShrink::Shrink() with same set of parameters a second time.

DISCLAIMER

MICROSOFT AND/OR ITS SUPPLIERS MAKE NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY, RELIABILITY OR ACCURACY OF THE INFORMATION CONTAINED IN THE DOCUMENTS AND RELATED GRAPHICS PUBLISHED ON THIS WEBSITE (THE “MATERIALS”) FOR ANY PURPOSE. THE MATERIALS MAY INCLUDE TECHNICAL INACCURACIES OR TYPOGRAPHICAL ERRORS AND MAY BE REVISED AT ANY TIME WITHOUT NOTICE.

TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, MICROSOFT AND/OR ITS SUPPLIERS DISCLAIM AND EXCLUDE ALL REPRESENTATIONS, WARRANTIES, AND CONDITIONS WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO REPRESENTATIONS, WARRANTIES, OR CONDITIONS OF TITLE, NON INFRINGEMENT, SATISFACTORY CONDITION OR QUALITY, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, WITH RESPECT TO THE MATERIALS.

Properties

Article ID: 976436 - Last Review: October 8, 2009 - Revision: 1.1
APPLIES TO
  • Microsoft Hyper-V Server 2008 R2
  • Windows Server 2008 R2 Datacenter
  • Windows Server 2008 R2 Enterprise
  • Windows Server 2008 R2 Standard
  • Windows Server 2008 Standard
  • Windows Server 2008 Enterprise
  • Windows Server 2008 Datacenter
Keywords: 
kbrapidpub kbnomt KB976436

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com