Shrink an oversized hard disk

Discussion in 'Parallels Desktop for Mac' started by Elisabeth, Sep 1, 2006.

  1. Elisabeth

    Elisabeth Bit poster

    Messages:
    1
    Have allocated 20 GB to my virtual Windows hard disk, but need actually just 10 GB.
    Tried to shrink the HDD file by first converting the plain disk into an expanding and then back again to a plain disk, but the size ist still 20 GB.

    Does anyone know of a way to reduce the size???
     
  2. joem

    joem Forum Maven

    Messages:
    1,247
    There's really no need to reduce the size unless you are trying to use the size limit as a quota. the expanding disk only takes up as much space on your physical HD as it needs for the actual data you put in it, and Parallels Compressor (release version) will make sure the data is mostly at the beginning of the physical file and truncate the physical file to release the unused space.

    So it's not surprising that there's no simple way to do the unnecessary.

    Of course, you could always create a new .hdd and move all your files to it (including the MBR) or start over and reinstall everything, but that seems like major overkill to me.
     
  3. kiere

    kiere Bit poster

    Messages:
    2
    Joem, you have mentioned the same thing in two posts but what you are saying doesn't make any sense. I had a 20 GB hdd file. It took up 18 GB. I uninstalled about 6 GB worth of stuff and shut down. The hdd file did not shrink. It still says it is 18 GB. So, the question stands...how do you shrink the hdd file?
     
  4. peterwor

    peterwor Hunter

    Messages:
    140
    Kjere,
    To me that means you set up the HDD as a non-expanding disk. If you had set it up orriginally as an expanding disk it would only take up as much space as it physically needed once PD started and uncompressed the disk image.
    Right now you may be stuck. If its that important check out the instructions for expanding an HD image and use them the same principle shoudl work in reverse. You would first have to defrag the entire disk so that it mad everything contigious then you could change the partition size and shrink it.
    Next time just set up the HD image as an expanding image and it shoud grow and shrink as needed. Check the fragmentation like I mentioned you may have files fragments at the end of the disk image that is allowing it not to shrink. You never did mention if the image was expanding or 'normal' so its hard to know how to advise.

    HTH,
    Peter
     
  5. BenInBlack

    BenInBlack Pro

    Messages:
    372
    Have you tried going in to the guest configuration and clicking on the Hard Disk you want to shrink and then click on the advanced tab and at the bottom of screen click on compact.
     
  6. kiere

    kiere Bit poster

    Messages:
    2
    Super Job

    BenInBlack,

    NOW THAT IS AN ANSWER!!! That is exactly what I was looking for. I completely missed the Advanced tab.

    However, that tab showed that the actual size of my file was 3049 MB. It also tells me that the type of disk that i have is "Expanding". When I clicked the "Compact" button, it ranfor a few minutes and then told me the size of my file was 3014 MB. However, in the finder the hdd file is still showing 18.64 GB.

    I am having a problem with disk space and I need to know if this is a Finder "trick" or is this hdd file really blocking out 15 more Gigabytes than it needs to.

    Thanks again,
    Kiere
     
  7. pljimmy

    pljimmy Bit poster

    Messages:
    2
    I had exactly the same issue. I allocated 20G to parallels for some temporary work. After the files were deleted, there was 3G used (as reported by Windows) but 15G taken up on the disk. After shrinking, it still only got down to 13G. I'm assuming that windows was leaving old data on the disk which was stopping the disk image shrinker from working correctly. If there is a way to "zero out" unused blocks on the disk image, I'm guessing that this would allow the image shrinker to work correctly. However, I used another method and managed to shrink the disk spaced used by parallels to under 4G. You will need extra space on your disk and a copy of a disk partitioning program. I used my copy of Partition Magic 8 for windows (PM8) which has paid for itself several times over since I started using it.
    1. Create a new disk in the parallels configuration editor for the new size.
    2. Start the Virtual machine and boot XP.
    3. Fire up PM8 and shrink the OS disk as much as possible but leave some space for swap etc. PM8 wont let you shrink it too far anyway. Don't hit "apply these changes" yet.
    4. Now copy the newly shrunk image to the 2nd disk you created earlier. Resize the copied disk to full use all of the space on the 2nd disk drive. These three steps can be combined into one in PM8 and then executed in one batch. You will need to allow PM8 to reboot your virtual machine for these steps to take place correctly.
    5. When PM8 has completed the copying, it will reboot back into XP. Start up PM8 again to check that everything looks fine. You should have 2 disks, 1 parition on each disk and some spare space on the booted hard disk. The 2nd disk should be taken up with the newly copied partition.
    6. Shutdown the XP instance in the parallels virtual machine.
    7. You now need to find where the two disk images that you are using for the disks in parallels are stored. This is shown on the console view of the machine under "Resources". On my machine it was under "/Users/myname/Library/Parallels/winxp/winxp.hdd" and hd1.hdd.
    8. You now need to set hard disk 1 to be hard disk2. e.g in my case I renamed winxp.hdd to oldwinxp.hdd; renamed hd1.hdd to winxp.hdd and then renamed oldwinxp.hdd to hd1.hdd.
    9. Restart XP and start up PM8 again. You should see the 2 disks have changed places. You can now shutdown XP, and change the configuration to no longer use the old disk (the newly renamed hd1.hdd) and can delete it.

    After I performed the above, I had changed the disze of the disk used by paralles from 20G to 6G and the actual spaced used on my MAC drive had falled from 13G to 2.9G. It took some time to perform all of the steps most of which were waiting for PM8 to copy data around but at the end of it I have the disk size that I want without having to re-install XP and all of my apps and data in the XP virtual machine.

    As you can see, the process isn't trivial, but it is possible and the extra 10G I now have on my Macbook Pro can be put to better use.
     
  8. schuhmab

    schuhmab Bit poster

    Messages:
    9
    Gparted instead of Partition Magic

    I had the same issue, the size reported by PD wasn't the size the Finder showed me for the .hdd file. And the compacting process lasts on my 2 Ghz MBP for hours for a 16000 MB image file, reducing the size with Gparted to 8000 MB didn't last much longer. After that however, your disk image file will never get larger than the max size. While with the compressor you would have to compact your image file every other day.

    Instead of Partition Magic, I used Gparted, version 0.3.1-1 worked for me.

    The process is not much different from the one with PM, you only have to boot Gparted to play with the disk images and you need additional diskspace on osx.

    1. Download the live CD image from Gparted.
    2. Create a new VM for Gparted which bots from the live CD and add a new disk image of the size you want for the shrinked win xp disk image (in my case I created one with the default size of 8000 MB).
    3. Boot the VM to test that it works. Gparted is based on linux. During boot time you will be asked several options. Afaik accepting all option worked on my MBP.
    4. Backup your oversized .hdd image (winxp.hdd, the size of mine was 16000 MB).
    5. Add the copy of winxp.hdd to the Gparted VM and boot again.
    6. Reduce the size of the large winxp.hdd inside of Gparted to something less than 8000 MB so that it fits into the new disk image. This changes the partition size of the NTFS partition, but not the size of the disk image! You have to finish this step before Gparted allows you to copy the now smaller partition!
    7. Now copy the NTFS partition to the new disk. Gparted allows to also enlarge the copied partition so that it fits into the new disk. You can do the copy and enlarge step together.
    8. After Gparted has finished the copy and enlarge step without errors, you can stop Gparted.
    9. Remove the new disk image from the Gparted VM and exchange the old (large) one with the new smaller, 8000 MB in my case) one in the Win XP VM. PD should be able to read the disk image and report the smaller size now.
    10. Boot Win XP again. XP does a chkdisk and boots again.
    Make sure the Win XP VM is properly shut down before you start. It might work as well with a paused VM but you will loose the safed state.

    Hth

    Bernhard
     
    Last edited: Oct 5, 2006
  9. imaffett

    imaffett Bit poster

    Messages:
    9
    Mbr

    What about the MBR for gparted? I've spent atleast 15 hrs trying to do this...it doesn't copy the MBR, so it never boots up.
     
  10. Grandpa Jim

    Grandpa Jim Junior Member

    Messages:
    18
    Better still use built in Parallels Tool Ctr method

    I discovered that you can make significant reductions quite easily using this as the 2nd step. The Help documentation that Parallels installed on your Mac explains clearly a 2 step process: 1. a preparatory stage in which unused space is "cleaned", then 2. a compacting stage (same as that described in quote). You can do all in one process starting from Parallels Tools Center and clicking on "Disk Compacting Tool" tab.

    Takes awhile to run but cut my 14.6 GB file to 4.6GB.
    For those less-techie, this is very user-friendly method.
     

Share This Page