[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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



> 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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.