To install Ubuntu alongside Windows 7, I have to shrink Windows 7 partition C:. But due to some unmovable files, I cannot shrink as much as I plan by using Windows own shrinking tool. I guess many of you who have both OSes on the same hard drive must have similar experience. How to solve this problem?

Any reference that can help is also appreciated!

Thanks and regards!


I have identified what unmovable file currently stop further shrinking:


If I understand correctly, the file belongs to Windows Search. Can I set up somewhere in Windows system settings to temperately eliminate the file and similar ones (because there are many similar files under the same directory which I guess will also stand in the way of shrinking and unmovable by defrag)?

  • Turn off Windows Search and delete the file (and the ADS attached to it). Or use Safe Mode. The file will be created again.
    – user8290
    Feb 19 '11 at 16:10
  • I am in the same situation. How did you find out which file is locked?
    – Gravity
    Oct 23 '15 at 20:01
  • Use this disk-partition.com/articles/…
    – masterxilo
    Dec 19 '18 at 20:08

Just had the same problem, but the instructions in Working around Windows' "Shrink Volume" inadequacies worked well for me. (The title mentions Vista, but it worked well for Windows 7 too.)

It's a bit long to repeat here, but the main points are

  • Close every program you can (any file currently in use is treated as unmovable, including browser cache files)
  • Run the Windows Disk Cleanup Wizard
  • Disable pagefile, kernel memory dump, system restore and hibernation (the primary system level unmovable files)
  • Run a defragmenter that can move files to the start of the disk

On a 60 GB SSD with about 35 GB free space, "Shrink Volume" in Windows 7 initially freed a paltry 100 MB, but following the steps in the article it was able to free the whole 35 GB.

See also the ubuntuguide.org documentation on multiple OS installation.

  • You can use Gparted tool for solve the problem. The problem and the solution is here: howtogeek.com/howto/windows-vista/… and the steps using Gparted here: howtogeek.com/howto/windows-vista/… Mar 15 at 4:25
  • You can use Gparted tool for solve the problem. The problem and the solution is here: howtogeek.com/howto/windows-vista/… and the steps using Gparted here: howtogeek.com/howto/windows-vista/… I had the same problem with my Windows 10 installation and I was able to solve it with Gparted. Previously I've tried with PerfectDisk and UltraDefrag (boot time defrag) without succesful. Mar 15 at 4:31
  • ^ regarding Rogelio Prieto's note about UltraDefrag above: After going through the rounds with several defrag utilities and still having unmovable files (I think it was some MFT related stuff such as $MFTMirr and $LOG which don't have actual file paths). Of these, I had tried windows defrag, defraggler, and auslogics without luck. Using the boot timescan option in ultradefrag-7.1.4.bin.amd64.exe & commenting out the script lines for UD_IN_FILTER + UD_EX_FILTER per this ticket fixed and let me shrink C:\
    – zpangwin
    Mar 28 at 5:41
  • ^^ also note that per that ticket, it was recommended to use the installed version rather than the portable version of UltraDefrag as the portable version supposedly does not support boot time defragging. I was really happy that worked as I prefer FOSS options (UltraDefrag is open source if you missed the SF link) and doing defrag then letting window's compmgmt.msc > Disk Management do the resizing is - at least IMO - way safer tan 3rd party tools and doesn't risk expired trial periods (i had apparently used perfect disk at some point in the past and it was a no-go as for me)
    – zpangwin
    Mar 28 at 5:43

The old fashioned way before Windows finally came up with their own resize tool: gparted. Best done from the live cd.

  • 1
    Defrag before shrinking
    – Takkat
    Feb 8 '11 at 7:08
  • 1
    gparted do not move files when shrinking. @Takkat: windows defrag tools respect unmovable files, so the OP problem remains.
    – enzotib
    Feb 8 '11 at 8:00
  • @enzotib: Thanks for telling others! You know what I was asking about!
    – Tim
    Feb 8 '11 at 12:11
  • 3
    @enzotib: not true. From the ntfsresize man page ( which gparted uses ): Defragmentation is NOT required prior to resizing because the program can relocate any data if needed, without risking data integrity.
    – psusi
    Feb 8 '11 at 18:56
  • 2
    you are right, according to man page, but this differ from my experience.
    – enzotib
    Feb 9 '11 at 12:00

There's a great defrag utility for Windows that can move all the files to the front of the disk, as well the little bit of space used between files (interstice problem): dirms (dirms-cl).

Running the defrag in safe mode may help with the unmovable file. Of course, what will certainly help is to make sure the filesystem is not in use before defragmenting (by booting Windows from CD/DVD or by using another computer for the defrag operation).

Does not work with Windows 7.

  • 1
    Unfortunately, the link to dirms is broken (there's a new website about another topic). I would recommand MyDefrag (formerly JKDefrag) that works well under all versions of Windows. Sep 19 '17 at 14:52

if you plan to dual boot with partitions on the same physical drive I recommend you use the Windows partition method as detailed here but you should always defrag the hard drive first.

While gparted is an excellent partition tool it does not take into consideration the fragmented data on the drive.

Trust me - from past experience once you make the mistake of not defragging the Windows partition using Windows tools you will screw up the windows install and will end up having to re-install it as well.

  • THanks! But I do know defrag and I defrag everytime before attempt to shrink. I was asking about unmovable Windows system files that now stop me from further shrinking. Any idea?
    – Tim
    Feb 8 '11 at 12:10
  • You don't say what the immovable files are and probably the question to ask how to move them should not be asked here. Try "pagedefrag" can do lots, also delete the page file and then recreate it this is one way to move it.
    – robin0800
    Feb 8 '11 at 12:52
  • @robin0800: I have updated my post with the file that stands in the way. Thanks!
    – Tim
    Feb 8 '11 at 13:06
  • 1
    The files are probably in use, so you can't move them. I think you may need to do a defrag before windows is up and running. I don't think the bundled version that comes with windows probably does not support that (in XP and older it was a defeatured commercial product), but there are some commercial ones that do. Diskkeeper and PerfectDisk come to mind, but there are others.
    – jwernerny
    Feb 8 '11 at 15:37
  • 1
    This is FUD. Fragmentation does not matter at all to gparted. It simply adjusts the length of the filesystem after relocating any files that are beyond the new end point ( if you are shrinking it ).
    – psusi
    Feb 8 '11 at 19:01

Kill the explorer.exe using task manger and reload it. Then try to shrink the partition



Well, I've just spent a day trying to get various defraggers to move the (extremely stubborn) unmovable metadata which Win7 puts in the middle of the drive for safety. None worked (Raxco, Ultradefrag, Win7 defragger). Finally I used MiniTools Partition Wizard (free for home use) which 'knows' about Win7 and does not mess up the Win installation. From what I have read, GParted (which I know and love) seriously risks screwing things royally, and I could not take the risk. Partition Wizard seems a very slick program, BTW. I used the CD version - much safer.

Not the answer you're looking for? Browse other questions tagged or ask your own question.