124

I have just bought an HP laptop with Windows 7 (64 bit). It has a 500 GB HDD with three partitions: a small hidden system partition, a 12 GiB HP recovery partition, and a 450 GiB C: boot partition.

I would like to split this large C: partition into two partitions, leaving only 100 GiB for the system, and giving the rest to a new data partition.

Although the Windows built-in Disk Management utility has an option to shrink the bootable partition, it only allows me to shrink it roughly by half, even though only 20 GiB on the partition is used. As far as I understand, system unmovable files lie in the middle of the partition, preventing Disk Management utility to do what I want.

And since new HP laptops don't come with OS installation disks (they only allow you to create recovery disks yourself), I can't just repartition HDD and then reinstall OS.

So, is there a way to shrink the C: bootable partition and preserve Windows 7 working?

P.S.: I have tried to use the third-party GParted utility, and after shrinking the partition, Windows 7 stopped booting, with a BSoD. System recovery didn't work, and I had to do factory recover. Since this is a long process, I would like to avoid doing it again :) So, please, suggest only proven solutions.

Peter Mortensen
  • 12,090
  • 23
  • 70
  • 90
Alex Che
  • 2,751
  • 3
  • 17
  • 13
  • duplicate of https://superuser.com/questions/1017764/how-can-i-shrink-a-windows-10-partition – masterxilo Dec 19 '18 at 20:37
  • 1
    @masterxilo, that question targets Windows 10 and is asked 6 years later than mine. – Alex Che Dec 20 '18 at 10:17
  • I agree @AlexChe. But I think people coming here will be looking for a windows 10 solution, and probably most instructions are interchangeable. I should have said it is related/for windows 10. – masterxilo Dec 22 '18 at 21:07

7 Answers7

108

TL;DR

  1. Try to shrink the partition in the Windows Disk Management snap-in. Proceed to the step 2, if the shrink fails.
  2. Find the event with ID 259 in the Windows Event Log and see its details.
  3. For even more details, optionally, run the fsutil command with the appropriate parameters given on step 2.
  4. Given the details from the steps 2 and 3, determine what component, program or feature is locking your partition.
  5. Temporarily disable or uninstall it.
  6. Go to the step 1.

Possible culprits: Virtual Memory, System Restore and/or Windows Search Index (System Volume Information folder), Hibernation, Internet Explorer temporary files.

Detailed version:

In the low-level tasks, like working with an HDD system partition, I prefer to use native tools as much as possible, and switch to third-party tools only as a last resort, if none of native tools worked. So, directed by harrymc, I gave Windows Disk Management another try.

I first turned Virtual Memory and System Restore off, removed System Volume Information folders, and after that Disk Management utility allowed me to shrink the C: partition as much as I needed. After that I turned the features back on.

The following instructions may help you to identify what application or component is preventing your partition to shrink. First you need to find the latest event with ID 259 in the Windows Event Log (see Event Viewer / Windows Logs / Application). The event is generated when the system analyses a partition, and if you have already tried to shrink a partition via right-clicking on it in the disk management snap-in, then the event should be there. Another way to make the system analyze a partition is to run the Windows built-in defragmentation utility. The event tells you the last unmovable file or just the number of the last cluster of such a file. It also tells you the complete command to run from the command line to get more details about the last unmovable file. (Alternatively, you can probably also try to calculate the cluster number as min allowed partition size divided by cluster size, and then run the fsutil command with the appropriate parameters).

The filename will give you a hint to guess, what program or feature is locking your partition. And then you can turn it off or uninstall, and see if it helped. In my case turning off Virtual Memory and System Restore was enough. Sometimes it is also necessary to turn off hibernation, etc. And sometimes partition defragmentation may also help. Also, as stated in the WindowsITPro article, Windows Search Index files and Internet Explorer temporary files can also be "unmovable". Sometimes just disabling the System Restore and Windows Search Index will automatically remove unmovable files from the System Volume Information folder, and sometimes you may need to remove the folder manually after that.

P.S.: Thanks everyone for answers. Probably third-party tools would also work in my case, and probably they are easier to use, but as I have already told, for such kind of tasks I prefer to use native tools as much as possible. Also, personal thanks to harrymc for the important hint.

Alex Che
  • 2,751
  • 3
  • 17
  • 13
  • 4
    I couldn't quite follow the `fsutil` comments. But after I read a post on shrinking NTFS (http://windowsitpro.com/storage/q-im-trying-shrink-ntfs-volume-shrink-value-possible-far-less-my-free-space-whats-wrong), it became clearer. Don't try fsutil first, attempt a defrag and then look in the Event Viewer Application Log for defrag events (Event ID 259 as noted above). The log message actually gives you the instructions for which fsutil command to run. – icc97 Jun 29 '14 at 14:07
  • How do I search for defrag events in Event viewer? – To Do Oct 20 '14 at 09:40
  • I read that removing system Volume Information folders for your Windows partition is NOT recommended. – To Do Oct 20 '14 at 09:41
  • System Volume Information folder contains restore points data, i.e. the data necessary to restore system files on the partition to some earlier point in time. Deleting the folder makes it impossible to restore system files by means of the System Restore feature. Since this was a clean Windows installation, I had nothing meaningful backed up yet. That's why it is preferable to define system partition as early as possible. But if you already have some apps or updates installed, then you can create a back up by some other means, like creating the partition image, etc. – Alex Che Oct 22 '14 at 07:04
  • 1
    Also have a look at WindowsITPro (http://windowsitpro.com/storage/q-im-trying-shrink-ntfs-volume-shrink-value-possible-far-less-my-free-space-whats-wrong) for hints as to what could prevent shrinking a disk: System Restore, IE temporary files index, Windows Search Index, Pagefile. – Pierre Arnaud Oct 31 '14 at 05:29
  • 1
    Disabling hibernation was the key ingredient in my case. Regarding freeing up some more additional space, here is a good guide for Win 8.1 (with a link to Win7 version inside) http://www.hanselman.com/blog/GuideToFreeingUpDiskSpaceUnderWindows81.aspx – jakub.g Sep 12 '15 at 20:54
  • 2
    @icc97 's comment nails it!!! Using the [link](http://windowsitpro.com/storage/q-im-trying-shrink-ntfs-volume-shrink-value-possible-far-less-my-free-space-whats-wrong) s/he shares, I was able to narrow down that the file preventing me from shrinking was a bloody Norton file!!!! Thanks for that link. – Jet Blue Oct 21 '15 at 05:03
  • My last unmovable file is \ProgramData\Microsoft\Diagnosis\events10.rbs$DATA that I guess is some file for Windows installer, but I don't know how to get rid of it. – jarno Oct 31 '15 at 20:43
  • 1
    @jarno, try to disable the DiagTrack service and reboot the system. – Alex Che Nov 02 '15 at 08:13
  • @ToDo, just click on the header called Source and it will sort the events by source, then scroll to see the Defrag events. – jarno Nov 03 '15 at 18:36
  • 2
    It is not necessary to run the defragmentation utility to identify what application or component is preventing your partition to shrink: If you go to the disk management and choose to shrink a partition via right-clicking on the partition, the system analyzes the partition and after that the Defrag event of ID 259 can be found in the log. – jarno Nov 03 '15 at 18:41
  • After disabling DiagTrack service and Search function, the limiting file is \$Secure$::$ATTRIBUTE_LIST. [This](http://answers.microsoft.com/en-us/windows/forum/windows_7-performance/cannot-shrink-drive-below-50-because-of-a-blocking/918a5a85-d099-452d-a1e2-43b46d36cbe8) page hints to use a third party partition tool to overcome the issue. – jarno Nov 03 '15 at 22:06
  • @jarno Seems like Windows build-in defragmentation utility does not use [Windows Defragmentation API](https://msdn.microsoft.com/en-us/library/windows/desktop/aa363911%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396) to defragment NTFS attribute lists. There are [several 3rd party defgarmenters](http://superuser.com/questions/316003/how-do-you-defragment-the-mft-on-an-ntfs-disk) which do, but in this case it seems easier to just use a 3rd party partition tool to shrink the partition right away. – Alex Che Nov 04 '15 at 07:18
  • @AlexChe, Wow, how did you know about the event id 259? – Pacerier Jan 15 '16 at 19:08
  • Great, thanks! In my case it was enough to only disable System Restore (the 2 restore points were the blocking unmovable files) – YakovL Mar 12 '17 at 16:24
  • 1
    And I probably have to provide more insight which I got since the answer was a little misleading for me. Namely, when one disables System Restore, restore points files in System Volume Information are removed and one doesn't have to remove System Volume Information itself (at least in my case). This is important because `fsutil` tells that the file is inside System Volume Information, but I suggest everybody to try to turn off the listed options first and only then try to remove some files manually. – YakovL Mar 12 '17 at 17:01
  • 1
    I think this answer is technically fully accurate, but involves way too much steps and understanding for the average user that just wants a smaller C: partition. Automatic tools are the way to go IMO. We cannot expect everyone to learn such complicated stuff just to get some more space. It would have been entirely in Microsofts hands to automate this for us but they didn't. The solution is to rely on a free implementation of a good solution (AOMEI for example) rather than hack something like this suggests. Hence the - 1. – masterxilo Dec 22 '18 at 21:12
  • @masterxilo Thanks for the honest opinion. The problem with 3rd party tools in this particular case is that they try to cope with Microsoft's specific software and technologies, which is mostly not open sourced or standardized. So, there is always a potential chance of some change on Microsoft side, which will break the tool. This may cause partition corruption, which may mean data and/or time loss. Actually this is what I've experienced with another recommended 3rd party tool, and it was a reason to fallback to Microsoft native tools. – Alex Che Dec 26 '18 at 07:47
  • Deleting a restore point was enough for me to shrink the windows down by more than 400 GB on a new laptoo with 500 GB ssd – darxtrix Jan 21 '19 at 08:44
  • Thanks a lot, thanks to your procedure of looking through the Event Log I was able to find the issue. In my case it was the antivirus which was keeping some files locked (Eset Nod32). I solved by uninstalling it, shrinking and re-installing it. – hellter May 03 '21 at 12:18
  • 1
    This is a great answer (still works on Windows 10). For anyone looking, `powercfg.exe /hibernate off` in cmd or powershell to turn off hibernate. I think virtual memory and system restore can probably be turned off in an admin powershell prompt as well, which would make this process much simpler (in my case, running those commands with the command to turn off hibernate would have instantly allowed me to shrink the volume). – Kraigolas Mar 25 '22 at 01:33
9

If I was you, I would give Gparted another try, it can be used as a Linux boot disk and can resize disks very well.

If you take a look at the download page, there is a warning with a bug relating to NTFS disks so you may want to try a previous version.

WARNING: Recently there have been several reports of problems when resizing file systems using gparted-live-0.5.0-3. In the case of the NTFS file system, The error message seen after the partition is resized is:

  ERROR: Current NTFS volume size is bigger than the device size!

The problem appears to be related to the combination of packages, Linux kernel, and patches used in the GParted Live image. We are investigating to find the root cause of the problem. Until this problem is solved we recommend GParted Live 0.4-6-1 for resizing all file systems.

William Hilsum
  • 116,650
  • 19
  • 182
  • 266
8

First, I would backup the system partition (for example, with Symantec Ghost v11 Enterprise). And for good measure, also image the ENTIRE drive (you can restore much faster than with HP's restore facility).

Then delete the C: drive and create two new partitions to your likings with a partitioning tool of your choice. Then deploy the image of the former C: drive to the first partition.

Peter Mortensen
  • 12,090
  • 23
  • 70
  • 90
  • 1
    This sounds reasonable. Do you think Ghost will cope with unmovable clusters in the way that will not break Windows? – Alex Che Dec 28 '09 at 10:22
  • yes, Ghost 11 from a BartPE disk will do the job. –  Dec 28 '09 at 12:10
  • 1
    I don't believe it will cope with partition size that is **less than** the original. – harrymc Dec 28 '09 at 14:12
  • 2
    believe me, Ghost WILL cope with target drives that are smaller than the source drive (unless the ammount of data exceeds the available disk space, that is).say, you have a 450 GB partition and 435 GB are free, then you can clone that partition to a 15 GB partition, no problem. –  Dec 28 '09 at 14:37
  • 1
    @Molly: As this is the system drive, do you know from experience that Ghost can move these unmovable Windows files? – harrymc Dec 28 '09 at 19:27
  • 2
    yep, cloned a 750 GB drive (single partition + reserved) to a 320 GB drive because i needed the big drive elsewhere, no problem. i'm not using bitlocker though, that would a different story altogether. –  Dec 28 '09 at 19:43
6

Some Windows files are unmovable and are unhelpfully allocated by Windows at the end or middle of the disk, so that one can only shrink C up to a limit. Which is exactly what you have discovered: The disk cannot be further reduced without destroying Windows.

The only solution is to reinstall Windows in a smaller partition. In your case, you will need to delete the existing system partition and divide it into two partitions via a third-party tool, then restore Windows into the first partition on the disk. Do not touch the restore partition!

I suggest using Paragon Partition Manager 2010 Free Edition as having a good user interface. Otherwise you can use any other tool such as GParted.

Peter Mortensen
  • 12,090
  • 23
  • 70
  • 90
harrymc
  • 455,459
  • 31
  • 526
  • 924
  • 1
    Thanks for the answer. But after I'd shrunk the partition with GParted, I was not able to do system restore on it for some reason. The only option I had was to do factory restore, which restored the whole HDD image. I'm afraid that your solution may lead to the same. – Alex Che Dec 28 '09 at 10:29
  • 3
    Yes, it certainly will lead to factory restore, but there's no other solution. I only ever found one partition manager that claimed to be able to move these Windows files, and it also destroyed my disk. The best try you can do is turn off the pagefile and system restore and clear the Recycle bin, defragment your disk so as to consolidate free space, and retry resizing. Please note that the Win7 Disk Manager is as good for resizing as any other product - if it can't do it then no other product will without destroying the disk. – harrymc Dec 28 '09 at 10:52
  • @harrymc, Hmm, this is weird, why would some Windows files be unmovable? What would the logic be for that decision? – Pacerier Jan 15 '16 at 19:12
  • 1
    @Pacerier: For example, the page file - swapping memory to disk is done by the hardware, which does not know anything about NTFS, so this has to be done by physical disk addresses and page file sectors must even be contiguous sequentially on the disk. The page file cannot move, because Windows must be able to swap at all times. – harrymc Jan 15 '16 at 19:50
4

I've been banging my head for several days in an attempt to shrink a Windows 7 primary partition that hosts the OS. The problem was a set of system files located in the middle of the partition that were excluded during the defragmentation process. Various attempts with several disk partitioning programs, some of which touted their ability to relocate all system files, succeeded in creating only more frustration.

The solution:

Turn off System Recovery. The files that would not relocate during defragmentation were created by that utility and contained all the restore points. When you turn off System Recovery, these files are deleted. Once deleted, Windows 7's Disk Management utility was able to shrink my 259GB C: partition to a bit over 40GB.

Gaff
  • 18,569
  • 15
  • 57
  • 68
Spok
  • 49
  • 1
  • 1
4

GParted solved my problem! After struggling with unmovable files in the standard Windows Disk Manager I finally used GParted from the Ubuntu 10.04 (Lucid Lynx) live CD. It worked like a charm!

Peter Mortensen
  • 12,090
  • 23
  • 70
  • 90
Laurynas
  • 141
  • 2
4

For a bitlocked drive I have successfully used the tool Raxco Perfect Disk 12 (evaluation version).

It contains a defragmentation tool with a 'shrink drive' profile. It can move many unmovable files on the fly. In my case, I needed to schedule it at boot anyway and it did the job. After that, I was able to shrink the drive from the Disk Management console in a standard way.

Advantages:

  • It worked despite the fact that my system drive was bitlocked. Bitlocker would prevent Linux tools I suppose.
  • It did not upset my bitlocker setup. Some tools that do mess with the boot sequence turn on bitlocker recovery mode.
  • It did not require disabling, uninstalling or removing any files.
Peter Mortensen
  • 12,090
  • 23
  • 70
  • 90
user377178
  • 474
  • 2
  • 8
  • I'm not using bitlocker, but for me this was absolutely the simplest solution, worked perfectly first time on a frewsh install of Windows 7 pro. I used the 30-day evaluation of Raxco PerfectDisk v14 Select Drive Preferences, Default optimisation method to "Prep for Shrink" and it moved the tail fragments such that I could have shrunk the drive down to 42Gb. Thanks. – Ed Randall Jul 30 '15 at 20:33
  • Thanks for suggesting this. The version I used, 14, has a "consolidate free space" function, which does the moving of files from the end of the disk. Prepare for shrink didn't actually do the job you'd expect, possibly because it's an evaluation version? – kristianp Apr 25 '20 at 03:36