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] Increase size of file-based diskimage (with MBR, partiti

To: "Henrik Holmboe" <henrik@xxxxxxxxxx>
Subject: Re: [Xen-users] Increase size of file-based diskimage (with MBR, partitions + fs)
From: "Todd Deshane" <deshantm@xxxxxxxxx>
Date: Tue, 30 Sep 2008 20:36:20 -0400
Cc: xen-users@xxxxxxxxxxxxxxxxxxx
Delivery-date: Tue, 30 Sep 2008 17:37:05 -0700
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:reply-to :to:subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=qcElJJZfrmFB1vBrH7wvDBAQcYBzgjoqB2MYqNGbzzo=; b=n1M9CoCELZlAN1XhufdXxELbLIfCjuceghIKTTgfQwWxP0fE3eYGh5V8b8RXtjUlNV l8urKBMc3QVAdKAyCd8yXsx6IiB6X5d6z8lB13LD6Lm/Ym9op45ZkmEpXHKvwdRu3htp yboeq2untRU/ul9CqUModbYLH6e2VNouhVp2E=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:reply-to:to:subject:cc:in-reply-to :mime-version:content-type:content-transfer-encoding :content-disposition:references; b=Eok/9+P74sNCRb8uhuA2uHAGNhfv6w7Bweekgq1uCC5/MFN0Y+L8e5Ftkl6AguL/HK NnMxNleQFv6xu+hBjutlxiYGWVxv1BFKW15mW2KOE7R7Lgl9Tvvz8p//WSxI341WfOr7 Ph65CnEQ4sREP7zQ64W/hZvLADMM4M+oZSLhY=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <20080930225408.GE32649@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/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-users>, <mailto:xen-users-request@lists.xensource.com?subject=unsubscribe>
References: <20080930225408.GE32649@xxxxxxxxxxxxxxxxxxxxxxxx>
Reply-to: deshantm@xxxxxxxxx
Sender: xen-users-bounces@xxxxxxxxxxxxxxxxxxx
On Tue, Sep 30, 2008 at 6:54 PM, Henrik Holmboe <henrik@xxxxxxxxxx> wrote:
> Hello all,
>
> I have been struggling with a problem for some time and haven't quite
> found a working solution. Tried to search the mailing list and other
> online resources but still got stuck.
>
> What I have: a diskimage stored in the fs on dom0. The image is not
> just a filesystem, but contains a full disk presented to the domU. Thus
> it contains an MBR, partition table and a single ext3 filesystem. No
> LVM is not used in the domU. Both dom0 and domU is Centos 5.2.
>
> What I want to accomplish: increase the size of this diskimage, resize
> the partition and filesystem.
>

There are a couple ways that are slight variations on the things that you
have tried that have worked for me.

Simplest way, if it works, is to simply create a "disk image" with dd
and append it onto your disk image.

Something like:

dd if=/dev/zero of=space.img bs=1M seek=1024k count=1
cat space.img >> your_small_image.img

Then what you have is unallocated space at the end of your
image file, which you can then resize the partitions the way
you want to get them to use the newly added space

For linux file systems that can be as easy as using losetup
and/or kpartx to associate the disk partitions with device
nodes and then using standard resize tools. Alternatively
gparted should also be able to handle the virtual device
after it has been associated with a device node, if you
prefer a graphically tool. For windows file systems you
can simply use the Manage Computer option (right click
My Computer --> Manage) and then resize the partitions
with the wizard.

If that way doesn't work, using kpartx/losetup to associate
the image is again a good first step. Then, create a new
blank bigger image and use losetup to associate it with
a loop device, use fdisk to partition it, and then use dd
with the "if" equal to the source disk image and "of"
equal to the destination disk image. Using conv=notrunc

You may then also need to do resizing of partition as above.

>From dd man page:

Specify the output pathname; the default is standard output. If the
seek=expr conversion is not also specified, the output file will be
truncated before the copy begins, unless conv=notrunc is specified. If
seek=expr is specified, but conv=notrunc is not, the effect of the
copy will be to preserve the blocks in the output file over which dd
seeks, but no other portion of the output file will be preserved. (If
the size of the seek plus the size of the input file is less than the
previous size of the output file, the output file will be shortened by
the copy.)

Hope that helps some,
Cheers,
Todd

-- 
Todd Deshane
http://todddeshane.net
check out our book: http://runningxen.com

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

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