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] How do I resize a Physical Partition in a Dom U that's "

Bob Linkonij wrote:

 > I'm not clear here - did you partition /dev/xvdc and create a filesystem on
 /dev/xvdc1, or did you create a filesystem on /dev/xvdc ?

I'm pretty foggy about the xvdc vs xvdc1 name differences but if I
understand what you're asking I did the first type.  I'm not even sure
how I'd do the latter, or if I should.

What does it say in /etc/fstab ?

If it has "/dev/xvdc" then the filesystem has been created in the whole disk, which I think is easiest.

If it has "/dev/xvdc1" then the virtual disk has been partitioned and the filesystem created inside the partition. How you would do that is you would simply treat the virtual disk the same way as a real disk and just partition it - from inside the guest.

Anyway I used Suse SLED v10's auto-installation stuff to do it. The
part of the script for the xvdc device was

<partitioning config:type="list"><drive>
<device>/dev/xvdc</device>
<initialize config:type="boolean">false</initialize>
<partitions config:type="list"><partition>
 <create config:type="boolean">false</create>
 <filesystem config:type="symbol">ext3</filesystem>
 <format config:type="boolean">true</format>
 <label>GUESTROOT</label>
 <mount>/</mount>
 <partition_id config:type="integer">131</partition_id>
 <partition_nr config:type="integer">1</partition_nr>
 <partition_type>primary</partition_type>
 <size>max</size>
</partition></partitions>
<type config:type="symbol">CT_DISK</type>
<use>all</use>
</drive></partitioning>

Double dutch to me, but it does hint at having created a partition.


 If you create a filesystem on the disk device rather than partitioning it,
 then you can shutdown the guest, use resize2fs to enlarge the filesystem in
 it, and startup the guest.

 If you created a partition, then you will need to deal with that. I think
 there was a discussion a while back on mounting partitions from a partition.
 You'll need to enlarge the partition to fill the disk, and then you can
 resize the filesystem in it. Other than doing it from within the guest I
 don't know how to do that. Once you shutdown and then start up (NOT reboot)
 the guest, it will see the new logical volume as a bigger disk - I don't
 know if there is any way to make this happen 'live'.

So it sounds like the 1st one is simpler.  And can be done live or hot.

Actually, it can't be done live - you have to unmount the filesystem and fsck it before you can resize it. You'll struggle to unmount your root filesystem.

If you find that your root partition is /dev/xvdc1 then what I'd suggest is this :
shutdown the guest
boot up another guest with this LV attached as a disk. This can be an entirely different guest setup, or you could boot your current setup from one of the "live cd" distros such as Knoppix. You'll now be able to use fdisk to alter the partition - so you'll do "fdisk /dev/xvdx" (where x is the current drive letter the LV gets mapped to). I can't remember the commands, but there is one to alter a partition, and you need to change the end of partition 1 (which should be the only one) to be the end of the disk.
use resize2fs to expand the filesystem to fill the partition.
shutdown the guest, return everything to normal, boot up your guest with the resized disk.

It's a lot easier to not use partitions in the guest. If you are happy doing that, you could consider re-installing without using partitions, but you may find it hard to persuade the installer to accept that. IIRC, in Debian (whose installer I was using only today) there isn't an option - but there may be a command line method to bypass the disk partitions step.

For Xen guests, I usually just clone a basic image that was created initially with debbootstrap - so I never use OS installers in a guest.

Maybe I should just redo the whole thing to use the "create a
filesystem on /dev/xvdc" way.

Any pointers on that one?  I've tried to follow some of those
discussions, and just get lost.  It seems like each message answers a
question someone's not asking.

That's often the way.

--
Simon Hobson

Visit http://www.magpiesnestpublishing.co.uk/ for books by acclaimed
author Gladys Hobson. Novels - poetry - short stories - ideal as
Christmas stocking fillers. Some available as e-books.

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