This is generally caused by a hidden or un-moveable file. An event should be logged in the event viewer under the application log that gives the details of the file that caused the problem. Here is an example of one of these logs:
Note: These events are only logged in Windows Server 2008 R2 and Windows 7. You will not see them on Server 2008 SP2.
Log Name: Application
Source: Microsoft-Windows-Defrag
Date: MM/DD/YYYY HH:MM:SS PM
Event ID: 259
Task Category: None
Level: Information
Keywords: Classic
User: N/A
Computer: test
Description:
A volume shrink analysis was initiated on volume (D:). This event log entry details information about the last unmovable file that could limit the maximum number of reclaimable bytes.
Diagnostic details:
- The last unmovable file appears to be: \$BitMap::$DATA
- The last cluster of the file is: 0xbffda
- Shrink potential target (LCN address): 0x3e0a
- The NTFS file flags are: -S--D
- Shrink phase: <analysis>