Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: resize vhd

08 Feb 2014   #1
jonnyhotchkiss

Windows 7 Ultimate 64bit
 
 
resize vhd

Hi, I'm trying to reclaim space, after shrinking my (native) V-OS Windows 7 VHD (from 90GB to 30GB, still 3.5 free space)

the (diskpart) shrink worked, leaving me with a nice healthy, active 24g partition... and 75g unallocated.

The consensus seems to be vhdresize, but I (currently) have to complete the 'final step' of the resize vhd (file) operation outside the V-OS (it seems... VHDresizer won't ... I'm guessing vhdresizer 's GUIs gonna crashNburn from a pureDOSesque startup/recovery console {currently win7 boot disc is my method, looking for a lightweight boot entry to add to bootmenu, for 'vhd mgmt', ie vhd resizer..}

read all on diskpart, still no clue on 'direct method' on handling unallocated space, ie to enable vhdresize to "finish it's task" (25g VHD "volume" is still actually a 99g VHD file on a 200 gig partition)

Closest I've got is ref to compact command in PowerShell-context, re 'dual-command' to shrink then compact...


My System SpecsSystem Spec
.
08 Feb 2014   #2
jonnyhotchkiss

Windows 7 Ultimate 64bit
 
 

found this

Quote:
Steps to Shrinking VHD File
There are a number of steps to shrinking the VHD. The script performs these steps, but for clarity I will list them here as well. You could perform these steps manually as well, if you choose to do so.
Mount the VHD file (Windows Disk Management Console)
Defrag the mounted drive
Optimize / Consolidate the mounted drive – This part is key. Defraging will group file bytes together, which is very helpful. What’s important to note is that consolidation / optimization features will actually move files toward the center of the disk, or in our case to the beginning of the VHD file. Furthermore, some optimizers will zero out bytes on the disk that are not used. This is a necessary component for us to be able to shrink the file.
Detach the VHD
Re-mount the VHD in read only mode – not exactly sure of the reasoning behind this part, but through my testing I’ve found that it makes a difference
Shrink the VHD using DISKPART or Hyper-V Management Console
Detach VHD
Voila, size of file is reduced

PowerShell Script
The following PowerShell script can be used to perform the steps mentioned above. The command is run like so:
PS C:\Users\myers_000\Desktop> .\Shrink_VHD.ps1 -filePath "E:\Hyper-V\Base\Windows7_Ultimate_64\BizTalk 2010.vhd"
...
I have almost zero PS experience: does it work from "windows install boot media's command prompt" (startup console?!)

I've seen diskpart /s enables scriptology - is it a different language of script?

THANKS!
My System SpecsSystem Spec
Reply

 resize vhd




Thread Tools




Similar help and support threads
Thread Forum
Taskbar - Resize
How to Resize the Taskbar in Vista and Windows 7 This will show you how to resize the taskbar by changing it's height or width on the desktop in Vista and Windows 7. Here's How: 1. Unlock the taskbar.
Tutorials
How can I resize the start orb?
I want to make my start orb bigger, I know I can do it with an image editing program but is thier any software I can download that has the ability to do it? Google searches are being difficult so does anyone on here already know of a program that can do this? Even though my name is techpro...
General Discussion
W7 Areo resize lag
Hello, I use a translator. The problem in the next, when you resize the window toolbar is rendered with a noticeable delay. Particularly noticeable in google chrome. Latest video drivers, gtx260 216, i5-2500, p8z68-v, W7 x64. Images attached
Performance & Maintenance
resize wallpaper in 7
Hi,I am fairly new with windows 7, can someone tell me how to stretch,or resize or make smaller backgrounds in win 7? I made a photo as wallpaper but its too large and cuts off all the heads! cannot seem to find how to alter it , I have win 7 ultimate..appreciate all your help . oops !!! should...
Customization
Resize Partition?
My core hard drive has 3 partitions.. 1 for hidden 7 at 100mb, 1 for core windows C: at 120gb, and another at 356gb for my profiles// docs etc.. I am starting to run a bit low on the C: partition. Programs, games, etc.. I need to pull some space from the D: to C:. I have tried Disk...
General Discussion


Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 20:45.
Twitter Facebook Google+ Seven Forums iOS App Seven Forums Android App