Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

IVdsVolumeShrink::Shrink fails when provided value returned from QueryMaxReclaimableBytes


View products that this article applies to.

Source: Microsoft Support

↑ Back to the top


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.

↑ Back to the top


Summary

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

↑ Back to the top


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

↑ Back to the top


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.

↑ Back to the top


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.

↑ Back to the top


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.

↑ Back to the top


Keywords: kbrapidpub, kbnomt, KB976436

↑ Back to the top

Article Info
Article ID : 976436
Revision : 2
Created on : 10/8/2009
Published on : 10/8/2009
Exists online : False
Views : 769