Re: Resizing a Xen DomU disk image

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



Alain Spineux wrote:
> On Dec 19, 2007 7:26 PM, Matthew Lind <mlind@xxxxxxxxx> wrote:
>> Hello Mailing List!
>>
>> A quick question.  Has anyone gotten a resize (in my case grown) a Xen
>> DomU disk image?
>>
>> Here is the procedure I have followed:
>>
>> 1.  Install a DomU using virt-install
>>         Customize xvda to be all one partition ext3
>> 2.  On Dom0:
>>         dd if=/dev/zero bs=1G count=1 >> <my_disk_image>
>>         ll -h (Image is now 1GB larger)
>>         xm create <DomU>
>>     On DomU:
>>         df -h (Size has not changed)
>>         shutdown -h now
>>     On Dom0:
> 
> e2fsck works only on device, but yuo can creat a loop device using losetup
> 
> someting like
> 
> losetup -f <my_disk_image>
> 
> now you can mount, e2fsck or resize /dev/loop0

It appears as though the disk image was partitioned within the domU (the
OP is speaking of xvda and not xvda1), so I don't think that is going to
work either. I think you need to use "xm block-attach". Something like:

	modprobe xenblk
	xm block-attach 0 'file:/path/to/image/file' xvda w

This will create two new device files /dev/xvda (the hole disk) and
/dev/xvda1 (the only partition on this disk).

You can now use any partition editor you want to expand the first
partition on /dev/xvda.

For example: (s)fdisk to expand the partition, "e2fsck -f /dev/xvda1" to
check for errors (required to run resize2fs), then "resize2fs
/dev/xvda1" to resize to fill the expanded partition.

When you are done, use "xm block-detach" to release the virtual disk.

The xm man page is very helpful for accessing domU disk images on dom0.

Cheers,
Michael
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux