WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-users

Re: [Xen-users] shrink or grow disk image?

To: xen-users@xxxxxxxxxxxxxxxxxxx
Subject: Re: [Xen-users] shrink or grow disk image?
From: Mark Williamson <mark.williamson@xxxxxxxxxxxx>
Date: Wed, 30 Apr 2008 15:26:33 +0100
Cc: James Pifer <jep@xxxxxxxxxxxxxxxx>, John Haxby <john.haxby@xxxxxxxxxx>, "Joseph L. Casale" <jcasale@xxxxxxxxxxxxxxxxx>, Jonathan Ervine <jervine@xxxxxxxxxx>
Delivery-date: Thu, 01 May 2008 08:55:11 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <1209496880.29921.59.camel@xxxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-users-request@lists.xensource.com?subject=help>
List-id: Xen user discussion <xen-users.lists.xensource.com>
List-post: <mailto:xen-users@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=unsubscribe>
References: <1209496880.29921.59.camel@xxxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-users-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: KMail/1.9.9
> I have installations of sles for 64 and 32 bit in img files. I can copy
> the img file, create a new domU, adjust the networking as needed, and I
> have a new server up and ready to be configured.
>
> Problem is my img file is a lot bigger than needed for some uses. Is
> there a way to shrink an img file? Or, if I create a new "template"
> server that is smaller, can the img file be grown when needed?

The suggestions by other folks basically cover most of the sensible ways of 
doing this.  You can change the size of the file in place, or you can copy 
the relevant data to a different sized file.  As others have mentioned, it's 
sensible to make a backup copy to try changes on, then abandon the original 
if it works OK.

If you're shrinking then you need to shrink the guest filesystem *first* and 
adjust the guest partition table.  Then shrink the disk image itself.

If you're growing then you need to grow the disk image first, then adjust the 
guest partition table, then grow the guest filesystem.

You could either do the adjustment of the partition table and filesystem from 
within the guest, or by stopping the guest and doing the operations from 
dom0.  The parted partition editor can, in principle, resize partitions and 
the filesystems within them, so it might be worth trying that out.

Resizing an image file won't be picked up by a running guest automatically.  
Using xm block-remove followed by xm block-add might do the trick but 
obviously you can't do that for devices the guest is using (e.g. the guest's 
root device).  This is only really an issue if you're trying to make the size 
changes "on line".  If the guest is shut down, then it'll see the new sizes 
at next power on.

> I created the img files using virt manager to setup sles with
> para-virtualized settings.
>
> I've done some searching and I came across qcow, but it looks like
> that's not supported.

The qcow format is now supported by Xen, I believe, although it may not be 
supported by your version.  I don't think it solves your immediate problem 
although it could cut down on the space required for machines based on this 
image.

Cheers,
mark    

-- 
Push Me Pull You - Distributed SCM tool (http://www.cl.cam.ac.uk/~maw48/pmpu/)

_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-users

<Prev in Thread] Current Thread [Next in Thread>