Announcement

Collapse
No announcement yet.

How to shrink a Linux guest disk in Hyper-V?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to shrink a Linux guest disk in Hyper-V?

    Hi all,

    Serer 2008 R2 x64, running Ubuntu 9.04 Server as a VM.

    When I first installed the VM the disk was around 2GB. It's now 22GB, even though "df" command in Linux reports that it's only 6.7GB. I guess this is from the days when I've copied large files to the VM and they've now been removed.

    As it's Ubuntu, the Integration Components don't work.

    Is there a way to shrink the disk? The Hyper-V tools do work, but they only remove a few KB, not the GB that I'm expecting.

    The disk will be "standard" for Ubuntu, so I'm guessing ext3.

    Any thoughts?

    Many thanks,


    Jim

  • #2
    Re: How to shrink a Linux guest disk in Hyper-V?

    Could you just add a new virtual hard drive of the size you want and clone the VM over to the new VHD? Kinda manual and not terribly elegant, but it might just work. (Special thanks to gforceindustries for this solution in a previous thread). You may also want to look into VHD Resize. No guarantee of success is implied.
    Wesley David
    LinkedIn | Careers 2.0
    -------------------------------
    Microsoft Certifications: MCSE 2003 | MCSA:Messaging 2003 | MCITP:EA, SA, EST | MCTS: a'plenty | MCDST
    Vendor Neutral Certifications: CWNA
    Blog: www.TheNubbyAdmin.com || Twitter: @Nonapeptide || GTalk, Reader and Google+: [email protected] || Skype: Wesley.Nonapeptide
    Goofy kitten avatar photo from Troy Snow: flickr.com/photos/troysnow/

    Comment


    • #3
      Re: How to shrink a Linux guest disk in Hyper-V?

      Many thanks, but unfortunately none of these solutions seems to apply to a Linux guest, jut Windows.

      Not sure how I could clone it.



      Jim

      Comment


      • #4
        Re: How to shrink a Linux guest disk in Hyper-V?

        By "clone it" I meant simply using an imaging utility like Ghost / Acronis / etc. and boot into that within the VM. Image the drive to an external storage device and then apply the image to the new, smaller VHD just as you would do if it was a real physical machine. Of course, the image utility would have to support changing the imaged machine's partition size, but I think that's a common feature nowadays.
        Wesley David
        LinkedIn | Careers 2.0
        -------------------------------
        Microsoft Certifications: MCSE 2003 | MCSA:Messaging 2003 | MCITP:EA, SA, EST | MCTS: a'plenty | MCDST
        Vendor Neutral Certifications: CWNA
        Blog: www.TheNubbyAdmin.com || Twitter: @Nonapeptide || GTalk, Reader and Google+: [email protected] || Skype: Wesley.Nonapeptide
        Goofy kitten avatar photo from Troy Snow: flickr.com/photos/troysnow/

        Comment

        Working...
        X