Decrease Image Size

Discussion in 'Parallels Desktop for Mac' started by afrenier, Apr 28, 2006.

  1. afrenier

    afrenier Bit poster

    Messages:
    1
    So if the hdd image can grow, can it shrink too? My linux distro installs tons of packages I don't need. I'd like to uninstall them to free up some disk space on the host. Is there a way I can get the hdd image to shrink? Maybe zero out the slack space? Will the hdd image still store the blocks if they contain all zeros? Thanks...

    -Ansel.
     
  2. constant

    constant Forum Maven

    Messages:
    1,010
    .
    If you're using a dynamic vdisk then as you delete stuff the disk size will decrease. If you're using a static vdisk then it can be done with a bit of work.
    .
     
  3. Andrew @ Parallels

    Andrew @ Parallels Parallels Team

    Messages:
    1,507
    1. For Windows guests you could use built-in compacting tool from Parallels Tools or Parallels VM Compressor.
    2. For Linux guest you could somehow zero all empty spaces (for example using dd in guest) and then click on VM configuration->Hard Disk->Advanced->Compact button.
     
  4. mcornes

    mcornes Junior Member

    Messages:
    12
    This dynamic drive solution I've read about over the past few days, how do I activate that exactly ? must i do it by creating a new VM, or can I add it to me old now from beta 3 VM, now i'm in beta 6 ?
     
  5. coolvik

    coolvik Bit poster

    Messages:
    1
    Hi,

    I've a similar problem. The image file is about 50GB but Im only allocating about 30GB. I've used the compressor but the file size won't go down.


    Any tips?
     
  6. Andrew @ Parallels

    Andrew @ Parallels Parallels Team

    Messages:
    1,507
    Why compressor wasn't work for you? Does it fail with some error message?
     
  7. Anthony Medici

    Anthony Medici Bit poster

    Messages:
    4
    To compress, you need to run the prepare to compress in the local box and then compress it on the host. If you only run from the host, it will not go down in size.
     
  8. Andrew @ Parallels

    Andrew @ Parallels Parallels Team

    Messages:
    1,507
    Anthony Medici,

    Yes - it could be done this way. But by default Compressor should execute the second phase automatically. If not - it is probably some bug.
     
  9. cmayaud

    cmayaud Junior Member

    Messages:
    12
    actually this doesn't seem to be true for the VM Compressor for the Mac ...

    I am running a MacBook Pro and set up a WinXP VM that was too small originally (default size) and I wasn't able to increase it once it filled ...

    then I built another but this time set it to 80gig max so that it wouldn't max out ... well , the compacting says my disk image is 2gigs BUT it it is using up a full 80gig on the Mac which is squeezing me alot ... It is set up as a dynamic hard disk and is supposed to grow to 80 (not static) ... but it has grown to 80 and it will NOT compact .... I am using only about 30 gigs on the XP side so there should be 50 free but it seems to have disappeared ....

    Any suggestions on how I can decrease the size of a WinXP VM on a MacBook Pro????
     
  10. eblot

    eblot Junior Member

    Messages:
    15
    Hi,

    I've been looking for reducing my virtual disk image that contains a ReiserFS 3 partition, without any luck: none of the proposed methods from Parallels led to actually shrink down the image file. Compressing the hard disk image from the VM configuration/hard drive/Compact page took a long time, but the resulting image file ended up with the same size as before compressing the disk.

    This is too bad, as my image file was about 6.5GB while the actual disk content (df command from the guest OS) was only about 1.55GB in my environment.

    I nevertheless find a quite simple way to reduce the image file size from Linux: I've simply duplicated the image file from the guest OS, that is copy all the Linux files in a new virtual expanding hard drive (so that the new image file contains only the existing file and is not overloaded with empty space) and get rid of the original virtual hard disk.

    The resulting image file is only 1.6GB (to be compared to the original 6.5GB image file):

    1. From Parallels VM configuration, create a new self-expanding hard drive (IDE 1:1 in my config). I've used a 8000MB hard drive, put it should work with any size, as long as the resulting virtual disk can contain all your original disk data.

    2. Boot the guest OS (Linux), then from the Linux prompt

    3. Create the partition table on the new hard drive:
    fdisk /dev/hdd
    so that it looks like your original hard drive (/dev/hda on most configurations)

    4. Format the partition(s) on the new hard drive with the same filesystems as the original hard drive. I only have one partition (/) on my original hard drive. Your mileage may vary.

    5. Mount the new partition
    mount /dev/hdd1 /mnt

    6. Copy the original partition content to the new partition
    cd /mnt; (cd /; tar cf - --one-file-system) | tar xvf -

    7. Re-install the boot loader on the new partition
    grub-install --recheck --root-directory=/mnt hd2
    hd2 means /dev/hdd on my machine, check the result of the grub-install command if you've installed the new virtual hard drive on another IDE port. Note that if your Linux distribution is using LILO, lilo must be used instead of grub.

    8. Unmount /mnt. You may want to repeat step 5 and 6 for other partitions, and initialize any swap partition if you have any on the new hard drive

    9. Shutdown linux, then the VM
    shutdown -h now

    10. Remove the newly created virtual hard drive from the VM configuration, and replace the original virtual hard drive with the new one.

    11. Restart the VM. The new virutal hard drive should boot. Once you've checked that everything works as it used to be with the original virtual hard disk, you can get rid of this image.
    If you cannot boot from your new virtual disk image, you can simply restart the whole procedure (or give up ;-)): your original virtual disk image has not been modified, and you can still boot your Linux environment from it.

    HTH.
     

Share This Page