I''m looking for help in resizing an LVM2 PV I''m using a logical volume as a "disk" for a Xen guest. e.g. /dev/vg01/lv_bah_vm appears to the Xen guest as /dev/xvda Inside the Xen guest, I also use LVM to partition the disk. I create a /boot partition (/dev/xvda1) and assign the rest (/dev/xvda2) to an lvm Physical Volume. I then create an lvm Volume Group consisting of this PV, and add logical volumes as required. All fairly standard stuff... However, I want to add more disk space to this virtual machine. I can increase the size of the under-lying logical volume (/dev/vg01/lv_bah_vm) e.g increase it from 10GB to 15GB. But, even though I''ve resized the under-lying LV, the PV in the Xen guest is still only 10GB. How do I get the PV inside the Xen guest to reflect the increased size of the under-lying disk, i.e. appear to be 15GB? Thanks, R. _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Christopher G. Stach II
2006-Oct-31 06:20 UTC
Re: [Xen-users] DomU guest - resize disk on LVM?
Robin Bowes wrote:> I''m looking for help in resizing an LVM2 PV > > I''m using a logical volume as a "disk" for a Xen guest. e.g. > /dev/vg01/lv_bah_vm appears to the Xen guest as /dev/xvda > > Inside the Xen guest, I also use LVM to partition the disk. > I create a /boot partition (/dev/xvda1) and assign the rest (/dev/xvda2) > to an lvm Physical Volume. I then create an lvm Volume Group consisting > of this PV, and add logical volumes as required. All fairly standard > stuff... > > However, I want to add more disk space to this virtual machine. > > I can increase the size of the under-lying logical volume > (/dev/vg01/lv_bah_vm) e.g increase it from 10GB to 15GB. But, even > though I''ve resized the under-lying LV, the PV in the Xen guest is still > only 10GB. > > How do I get the PV inside the Xen guest to reflect the increased size > of the under-lying disk, i.e. appear to be 15GB? > > Thanks, > > R.If it''s ext2 or ext3, run fsck and resize2fs while it''s not mounted. -- Christopher G. Stach II _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
On 30 Oct 2006 at 20:54, Robin Bowes wrote:> I''m looking for help in resizing an LVM2 PVAFAIK you can only resize LVs, not PVs. But you can add another PV to the VG, and then resize the LV. You might be able to resoze a PV by some tricks, but you''ll have to tell the VG using it then, and I think it''s quite dangerous. Real disks don''t change their size! Ulrich _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Robin Bowes wrote:> I can increase the size of the under-lying logical volume > (/dev/vg01/lv_bah_vm) e.g increase it from 10GB to 15GB. But, even > though I''ve resized the under-lying LV, the PV in the Xen guest is still > only 10GB. > > How do I get the PV inside the Xen guest to reflect the increased size > of the under-lying disk, i.e. appear to be 15GB?I think you can''t resize PVs. How about creating a new /dev/hda3 partition (inside the guest) using the new disk space, create a new pv there, add that to the volume group? cheers, Gerd -- Gerd Hoffmann <kraxel@suse.de> http://www.suse.de/~kraxel/julika-dora.jpeg _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Gerd Hoffmann wrote:> Robin Bowes wrote: >> I can increase the size of the under-lying logical volume >> (/dev/vg01/lv_bah_vm) e.g increase it from 10GB to 15GB. But, even >> though I''ve resized the under-lying LV, the PV in the Xen guest is still >> only 10GB. >> >> How do I get the PV inside the Xen guest to reflect the increased size >> of the under-lying disk, i.e. appear to be 15GB? > > I think you can''t resize PVs. How about creating a new /dev/hda3 > partition (inside the guest) using the new disk space, create a new pv > there, add that to the volume group?Thanks for all the suggestions. I have since realised what I''m missing: the PV/VG is actually created from a partition, i.e the under-lying disk is /dev/xvda, so I have /boot as /dev/xvda1 and the PV is /dev/xvda2. So, to resize it, I need to boot into a rescue disk or live CD and rezize the /dev/xvda2 partition. The PV should then reflect the increased size. I can then increase the partition size and grow the FS. Thanks, R. _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
> > Gerd Hoffmann wrote: > > Robin Bowes wrote: > >> I can increase the size of the under-lying logical volume > >> (/dev/vg01/lv_bah_vm) e.g increase it from 10GB to 15GB. But, even > >> though I''ve resized the under-lying LV, the PV in the Xen guest is > >> still only 10GB. > >> > >> How do I get the PV inside the Xen guest to reflect the increased > >> size of the under-lying disk, i.e. appear to be 15GB? > > > > I think you can''t resize PVs. How about creating a new /dev/hda3 > > partition (inside the guest) using the new disk space, > create a new pv > > there, add that to the volume group? > > Thanks for all the suggestions. > > I have since realised what I''m missing: the PV/VG is actually > created from a partition, i.e the under-lying disk is > /dev/xvda, so I have /boot as /dev/xvda1 and the PV is > /dev/xvda2. So, to resize it, I need to boot into a rescue > disk or live CD and rezize the /dev/xvda2 partition. The PV > should then reflect the increased size. I can then increase > the partition size and grow the FS. >Are all these layers *really* required??? Seems messy to have LVM ontop of LVM (even if the OS doesn''t realise this is the case). ATM for my Xen boxes I use LVM in the Dom0 and use this to create my DomU drives. For instance I have Dom0 and DomU VGs in my Dom0. I then create the usual set of LVs for each Dom0/U and make them accessible to the DomU in the usual way (as sda1,sda2, etc, etc). VG-Dom0 - LVRoot - LVSwap - LVwhatever VG-DomU - LVDomU1-root - LVDomU1-swap - LVDomU1-whatever - LVDomU2-root - LVDomU2-swap - LVDomU2-whatever With this I can extend the LVs in the Dom0, and either shutdown the DomU and resize2fs from Dom0 or even (tested on test VMs and low-use production ones) resize online within the DomU. Works fine and I still get the manageability of LVM within my DomU''s without actually using LVM within them. Just makes it simpler in my little head :) or am I missing a trick here??? Dan This email (including any attachments) may contain confidential and/or privileged information or information otherwise protected from disclosure. If you are not the intended recipient, please notify the sender immediately, do not copy this message or any attachments and do not use it for any purpose or disclose its content to any person, but delete this message and any attachments from your system. Astrium disclaims any and all liability if this email transmission was virus corrupted, altered or falsified. --------------------------------------------------------------------- Astrium Limited, Registered in England and Wales No. 2449259 Registered Office: Gunnels Wood Road, Stevenage, Hertfordshire, SG1 2AS, England _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
On 31 Oct 2006 at 9:27, Gerd Hoffmann wrote:> Robin Bowes wrote: > > I can increase the size of the under-lying logical volume > > (/dev/vg01/lv_bah_vm) e.g increase it from 10GB to 15GB. But, even > > though I''ve resized the under-lying LV, the PV in the Xen guest is still > > only 10GB. > > > > How do I get the PV inside the Xen guest to reflect the increased size > > of the under-lying disk, i.e. appear to be 15GB? > > I think you can''t resize PVs. How about creating a new /dev/hda3 > partition (inside the guest) using the new disk space, create a new pv > there, add that to the volume group?When creating a new PV, you are not resizing an existing PV. Ulrich _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
> -----Original Message----- > From: xen-users-bounces@lists.xensource.com [mailto:xen-users-bounces@lists.xensource.com] On > Behalf Of Gerd Hoffmann > Sent: 31 October 2006 08:27 > To: Robin Bowes > Cc: xen-users@lists.xensource.com > Subject: Re: [Xen-users] DomU guest - resize disk on LVM? > > Robin Bowes wrote: > > I can increase the size of the under-lying logical volume > > (/dev/vg01/lv_bah_vm) e.g increase it from 10GB to 15GB. But, even > > though I''ve resized the under-lying LV, the PV in the Xen guest is still > > only 10GB. > > > > How do I get the PV inside the Xen guest to reflect the increased size > > of the under-lying disk, i.e. appear to be 15GB? > > I think you can''t resize PVs. How about creating a new /dev/hda3 > partition (inside the guest) using the new disk space, create a new pv > there, add that to the volume group?Recent versions of LVM should include the "pvresize" command which does exactly what you require. There are also long discussions on the LVM mailing list for how to achieve a PV resize effect on older systems where the pvresize command doesn''t exist. BR, Roger _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Christopher G. Stach II
2006-Oct-31 15:23 UTC
Re: [Xen-users] Re: DomU guest - resize disk on LVM?
HAWKER, Dan wrote:>> Gerd Hoffmann wrote: >>> Robin Bowes wrote: >>>> I can increase the size of the under-lying logical volume >>>> (/dev/vg01/lv_bah_vm) e.g increase it from 10GB to 15GB. But, even >>>> though I''ve resized the under-lying LV, the PV in the Xen guest is >>>> still only 10GB. >>>> >>>> How do I get the PV inside the Xen guest to reflect the increased >>>> size of the under-lying disk, i.e. appear to be 15GB? >>> I think you can''t resize PVs. How about creating a new /dev/hda3 >>> partition (inside the guest) using the new disk space, >> create a new pv >>> there, add that to the volume group? >> Thanks for all the suggestions. >> >> I have since realised what I''m missing: the PV/VG is actually >> created from a partition, i.e the under-lying disk is >> /dev/xvda, so I have /boot as /dev/xvda1 and the PV is >> /dev/xvda2. So, to resize it, I need to boot into a rescue >> disk or live CD and rezize the /dev/xvda2 partition. The PV >> should then reflect the increased size. I can then increase >> the partition size and grow the FS. >> > > Are all these layers *really* required??? Seems messy to have LVM ontop of > LVM (even if the OS doesn''t realise this is the case). > ATM for my Xen boxes I use LVM in the Dom0 and use this to create my DomU > drives. For instance I have Dom0 and DomU VGs in my Dom0. I then create the > usual set of LVs for each Dom0/U and make them accessible to the DomU in the > usual way (as sda1,sda2, etc, etc). > > VG-Dom0 > - LVRoot > - LVSwap > - LVwhatever > VG-DomU > - LVDomU1-root > - LVDomU1-swap > - LVDomU1-whatever > - LVDomU2-root > - LVDomU2-swap > - LVDomU2-whatever > > With this I can extend the LVs in the Dom0, and either shutdown the DomU and > resize2fs from Dom0 or even (tested on test VMs and low-use production ones) > resize online within the DomU. Works fine and I still get the manageability > of LVM within my DomU''s without actually using LVM within them. > > Just makes it simpler in my little head :) or am I missing a trick here??? > > DanYou''re mostly right. There is an obvious advantage (for consistent naming for cluster nodes) to export the entire LVM partition to every domU (using CLVM) so you can just mount /dev/vgwhatever/foo-root inside of the domU instead of exposing /dev/vgwhatever/foo-root as /dev/xvda1 to the domain. LVM inside of LVM is definitely overcomplicating things, though. -- Christopher G. Stach II _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Roger Lucas wrote:> Recent versions of LVM should include the "pvresize" command which does exactly what you require. There are also long discussions > on the LVM mailing list for how to achieve a PV resize effect on older systems where the pvresize command doesn''t exist. >Yes, I found that command. However, the step I was mising was the partition resize. Thanks, R. _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
HAWKER, Dan wrote:> ATM for my Xen boxes I use LVM in the Dom0 and use this to create my DomU > drives. For instance I have Dom0 and DomU VGs in my Dom0. I then create the > usual set of LVs for each Dom0/U and make them accessible to the DomU in the > usual way (as sda1,sda2, etc, etc).Hey Dan, That''s a damn good scheme. How do you make the lvs available to the DomUs? For example, suppose I have: /dev/vg01/lv_guest1_root /dev/vg01/lv_guest1_usr /dev/vg01/lv_guest1_var How do I make these available to the DomU guest1 ? R. _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
On Tue, Oct 31, 2006 at 08:04:53PM +0000, Robin Bowes wrote:> That''s a damn good scheme.[Supported by xen-tools if you''re using Debian.]> How do you make the lvs available to the DomUs? > > For example, suppose I have: > > /dev/vg01/lv_guest1_root > /dev/vg01/lv_guest1_usr > /dev/vg01/lv_guest1_var > > How do I make these available to the DomU guest1 ?Just define them appropriately in the configuration file for Xen. Something like this: disk = [ ''phy:vg01/lv_guest1_root,sda1,w'', ''phy:vg01/lv_guest1_usr,sda2,w'', ''phy:vg01/lv_guest1_var,sda3,w'', ... ] Then inside the /etc/fstab of the domU you''d have: /dev/sda1 / ... /dev/sda2 /usr ... /dev/sda3 /var ... Steve -- Debian GNU/Linux System Administration http://www.debian-administration.org/ _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
> > How do you make the lvs available to the DomUs?Just specify them in the appropriate config file as normal.> > For example, suppose I have: > > /dev/vg01/lv_guest1_root > /dev/vg01/lv_guest1_usr > /dev/vg01/lv_guest1_var > > How do I make these available to the DomU guest1 ?Eg... In the Xen config file disk = [ ''phy:/dev/vg01/lv_guest1_root,sda1,w'',''phy:/dev/vg01/lv_guest1_usr,sda2,w'','' phy:/dev/vg01/lv_guest1_var,sda3,w'' ] And then attach these as required in your guests /etc/fstab as normal. In the above case, mapping sda1 to root, sda2 to usr and sda3 to var. HTH Dan -- Dan Hawker Linux System Administrator Astrium -- This email (including any attachments) may contain confidential and/or privileged information or information otherwise protected from disclosure. If you are not the intended recipient, please notify the sender immediately, do not copy this message or any attachments and do not use it for any purpose or disclose its content to any person, but delete this message and any attachments from your system. Astrium disclaims any and all liability if this email transmission was virus corrupted, altered or falsified. --------------------------------------------------------------------- Astrium Limited, Registered in England and Wales No. 2449259 Registered Office: Gunnels Wood Road, Stevenage, Hertfordshire, SG1 2AS, England _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
HAWKER, Dan wrote:>> How do you make the lvs available to the DomUs? > > Just specify them in the appropriate config file as normal. > >> For example, suppose I have: >> >> /dev/vg01/lv_guest1_root >> /dev/vg01/lv_guest1_usr >> /dev/vg01/lv_guest1_var >> >> How do I make these available to the DomU guest1 ? > > Eg... In the Xen config file > > disk = [ > ''phy:/dev/vg01/lv_guest1_root,sda1,w'',''phy:/dev/vg01/lv_guest1_usr,sda2,w'','' > phy:/dev/vg01/lv_guest1_var,sda3,w'' ] > > And then attach these as required in your guests /etc/fstab as normal. In > the above case, mapping sda1 to root, sda2 to usr and sda3 to var.Is it possible to do this at install time? For example, I currently kickstart install my xen guests as follows: xenguest-install.py --name=guest1 --file=/dev/vg01/lv_guest1_vm --ram=384 --location=http://mirrors.kernel.org/fedora/core/5/i386/os/ --extra-args="ip=192.168.23.229 netmask=255.255.255.248 gateway=192.168.23.225 dns=192.168.2.203,192.168.2.204 ks=http://dev.robinbowes.com/kickstart/misc/guest1-fc5.cfg" The disk layout is defined in the kickstart config. But I''d need to specify that /dev/vg01/lv_guest1_root = /dev/sda1, /dev/vg01/lv_guest1_usr = /dev/sda2, etc. Is this possible with xenguest-install.py or do I need to use a different install method? Thanks, R. _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
On Wed, Nov 01, 2006 at 11:19:28AM +0000, Robin Bowes wrote:> Is it possible to do this at install time?I guess it depends on how you install...> For example, I currently kickstart install my xen guests as follows:> Is this possible with xenguest-install.py or do I need to use a > different install method?I''m not familiar with xenguest-install.py, and I''m guessing from your mention of kickstart that you''re using some rpm-based distribution. You might need to write a script or two to manage the installation yourself if you''re wanting something non-standard. Steve -- _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Steve Kemp wrote:> On Wed, Nov 01, 2006 at 11:19:28AM +0000, Robin Bowes wrote: >> Is this possible with xenguest-install.py or do I need to use a >> different install method? > > I''m not familiar with xenguest-install.py, and I''m guessing from > your mention of kickstart that you''re using some rpm-based > distribution.Yes, this is on FC5.> > You might need to write a script or two to manage the installation > yourself if you''re wanting something non-standard.I''ll have a look at the xenguest-install.py script and see how it deals with the disks and maybe modify it to suit my needs. Thanks, R. _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
> Is it possible to do this at install time?As Steve mentioned, it depends, but there should be a way, its just how automated and hassle-free it ends up being :)> > For example, I currently kickstart install my xen guests as follows: > > xenguest-install.py --name=guest1 > --file=/dev/vg01/lv_guest1_vm --ram=384 > --location=http://mirrors.kernel.org/fedora/core/5/i386/os/ > --extra-args="ip=192.168.23.229 netmask=255.255.255.248 > gateway=192.168.23.225 dns=192.168.2.203,192.168.2.204 > ks=http://dev.robinbowes.com/kickstart/misc/guest1-fc5.cfg" > > The disk layout is defined in the kickstart config. > > But I''d need to specify that /dev/vg01/lv_guest1_root = > /dev/sda1, /dev/vg01/lv_guest1_usr = /dev/sda2, etc. > > Is this possible with xenguest-install.py or do I need to use > a different install method?Although I use FC4/5, like Steve, I don''t personally use xenguest-install.py either. However am pretty sure kickstart can do these kinds of things. By default, it maps things out *fresh* but IIRC the *partition* argument in a kickstart file can be told to use an existing partition/disk, which coupled with your kickstart layout, should make it work. Eg partition /var --onpart=/dev/sda2 or something like that. Your only problem will be automating the creation of the xen config script, which is part of what the xenguest-install.py does. I presume with some hacking it could be made to work (by someone with better than my non-existent Python skills :). Just a thought, does the --file really *mean* a file, or is it just a string that is parsed by xenguest-install.py and fed into the DomU config file??? If the latter, could you simply use --file="[ ''phy:/dev/vg01/lv_guest1_root,sda1,w''.....]" or similar. Maybe the *extra-args* parameter can have disk=[ ''phy:/.....] as an argument... Hmmm. Good luck :) Dan -- Dan Hawker Linux System Administrator Astrium -- This email (including any attachments) may contain confidential and/or privileged information or information otherwise protected from disclosure. If you are not the intended recipient, please notify the sender immediately, do not copy this message or any attachments and do not use it for any purpose or disclose its content to any person, but delete this message and any attachments from your system. Astrium disclaims any and all liability if this email transmission was virus corrupted, altered or falsified. --------------------------------------------------------------------- Astrium Limited, Registered in England and Wales No. 2449259 Registered Office: Gunnels Wood Road, Stevenage, Hertfordshire, SG1 2AS, England _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
HAWKER, Dan wrote:> > Although I use FC4/5, like Steve, I don''t personally use xenguest-install.py > either. However am pretty sure kickstart can do these kinds of things. By > default, it maps things out *fresh* but IIRC the *partition* argument in a > kickstart file can be told to use an existing partition/disk, which coupled > with your kickstart layout, should make it work. > > Eg partition /var --onpart=/dev/sda2 or something like that.I don''t have a problem with the kickstart part of the setup. I can modify the kickstart config file to use all the disks I can throw at it!> Your only problem will be automating the creation of the xen config script, > which is part of what the xenguest-install.py does. I presume with some > hacking it could be made to work (by someone with better than my > non-existent Python skills :).I''ve looked at it, and, to someone with similar Python skills to yourself, it''s not easy.> Just a thought, does the --file really *mean* a file, or is it just a string > that is parsed by xenguest-install.py and fed into the DomU config file??? > If the latter, could you simply use --file="[ > ''phy:/dev/vg01/lv_guest1_root,sda1,w''.....]" or similar. Maybe the > *extra-args* parameter can have disk=[ ''phy:/.....] as an argument... Hmmm.It is semi-intelligent. It checks the file type of the file specified. If it''s "phy" it adds a line like this to the config file: disk = [ ''%(disktype)s:%(disk)s,xvda,w'' ] I''d be happy creating a config file manually if I knew how to launch the install process, i.e. start the kickstart install using the host specified. I''d also like to know how to boot a guest DomU from an ISO image, e.g. a recovery disk so I can resize filesystems. Any idea how to do either of these things? R. _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
On 31 Oct 2006 at 9:23, Christopher G. Stach II wrote: [...]> LVM inside of LVM is definitely overcomplicating things, > though.I wouldn''t say: Dom0 maintains LVs for the DomUs, and the DomUs maintain their own LVs, doing their own local space management. At the time when I tried it, SLES10 was unable to find the root LV on boot. They released an update to mkinitrd (regarding LVM) recently, but I heven''t re-checked if it would work now. I''ve created LVs in Dom0 for each DomU, pushing a namespace problem into Dom0... Regards, Ulrich _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
HAWKER, Dan wrote:> > Are all these layers *really* required??? Seems messy to have LVM ontop of > LVM (even if the OS doesn''t realise this is the case). > ATM for my Xen boxes I use LVM in the Dom0 and use this to create my DomU > drives. For instance I have Dom0 and DomU VGs in my Dom0. I then create the > usual set of LVs for each Dom0/U and make them accessible to the DomU in the > usual way (as sda1,sda2, etc, etc). > > VG-Dom0 > - LVRoot > - LVSwap > - LVwhatever > VG-DomU > - LVDomU1-root > - LVDomU1-swap > - LVDomU1-whatever > - LVDomU2-root > - LVDomU2-swap > - LVDomU2-whateverThat''s how we''ve settled on doing things as well. Our hypervisor servers typically only have a single volume group (called ''vg'' for simplicity) with LV names like: domu-svn domu-svnsvn domu-svnbkp domu-jabber domu-fw1 Where domu-svn, domu-svnsvn, domu-svnbkp map to sda1, sda2, sda3 inside the subversion DomU. If the DomU needs a swap area or other scratch space, we export those as sdbN inside the DomU. One nice thing about doing everything in Dom0 is that you can do LVM snapshots and quick images of entire systems. Or resizing the file system, being able to take a DomU down and check the file systems or even mount the DomU''s troubled file systems in Dom0 and do maintenance. There could be less wasted space by managing everything in Dom0. I would imagine it also keeps LVM from being confused when it encounters an LVM inside another LVM. Without having to resort to LVM filtering tricks. _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users