Aclhk Aclhk
2009-Aug-16 11:06 UTC
[Xen-users] increase size for dom guest using lvm online
could we increase the size for dom guest online without rebooting or unmounting? pls kindly advise any methods. Yahoo!香港提供網上安全攻略,教你如何防範黑客! 請前往 http://hk.promo.yahoo.com/security/ 了解更多! _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Simon Hobson
2009-Aug-16 11:23 UTC
Re: [Xen-users] increase size for dom guest using lvm online
Aclhk Aclhk wrote:>could we increase the size for dom guest online without rebooting or >unmounting?I don''t believe so. At the moment, I believe the size passed to the guest is fixed at creating time, so if you enlarge the volume, the guest won''t get to know about it until it is shut down and re-created. It may be possible to detatch a volume and re-attach it with xm but I''ve never done that. In any case, at least with ext3, you need the filesystem unmounted in order to resize it. -- 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@lists.xensource.com http://lists.xensource.com/xen-users
James Harper
2009-Aug-16 11:25 UTC
RE: [Xen-users] increase size for dom guest using lvm online
> > could we increase the size for dom guest online without rebooting or > unmounting? > > pls kindly advise any methods. >For a PV DomU (or a HVM DomU using PV drivers), there is no mechanism for the backend (Dom0) to notify the frontend (DomU) of a change in device size. I suspect that HVM DomU''s have the same problems. So no, it cannot be done without rebooting. James _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Bart Van Kerckhove
2009-Aug-16 11:27 UTC
Re: [Xen-users] increase size for dom guest using lvm online
Just for the sake of it: ext3 has supported online expansion for some time now. -Bart ----- Original Message ----- From: "Simon Hobson" <linux@thehobsons.co.uk> To: "Aclhk Aclhk" <aclhkaclhk@ymail.com>; <xen-users@lists.xensource.com> Sent: Sunday, August 16, 2009 1:23 PM Subject: Re: [Xen-users] increase size for dom guest using lvm online> Aclhk Aclhk wrote: >>could we increase the size for dom guest online without rebooting or >>unmounting? > > I don''t believe so. At the moment, I believe the size passed to the guest > is fixed at creating time, so if you enlarge the volume, the guest won''t > get to know about it until it is shut down and re-created. It may be > possible to detatch a volume and re-attach it with xm but I''ve never done > that. > > In any case, at least with ext3, you need the filesystem unmounted in > order to resize it. > > -- > 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@lists.xensource.com > http://lists.xensource.com/xen-users >_______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Ferenc Wagner
2009-Aug-16 19:56 UTC
[Xen-users] Re: increase size for dom guest using lvm online
"James Harper" <james.harper@bendigoit.com.au> writes:>> could we increase the size for dom guest online without rebooting or >> unmounting? >> >> pls kindly advise any methods. > > For a PV DomU (or a HVM DomU using PV drivers), there is no mechanism > for the backend (Dom0) to notify the frontend (DomU) of a change in > device size. I suspect that HVM DomU''s have the same problems. > > So no, it cannot be done without rebooting.Unless you resort to double attach and replacing device-mapper tables. Possible in principle, but be very careful suspending your root device... Good luck! -- Feri. _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Thaddeus J. Hogan
2009-Aug-18 15:54 UTC
Re: [Xen-users] increase size for dom guest using lvm online
> At the moment, I believe the size passed to the guest is fixed at > creating time, so if you enlarge the volume, the guest won''t get to > know about it until it is shut down and re-created.I just verified that this is the case on Xen 3.2 on Debian 5. I was not able to get the guest to pick up the change in device size. There is the option of doing LVM in the guest, though this will make the volumes more difficult to access from the Xen dom0. If you do lvm in the guest you will be able to attach a new chunk of disk, then run pvcreate on it and add it to a volume group in your guest. However if the dom0 is running lvm as well it will try to register the volume groups defined by the PVs that you are intending to map through to your guests. You have two options for preventing this from creating problems on the dom0. First, you could exclude from the scan process in lvm.conf those devices destined to be used with LVM in a guest, but you will not be able to mount these volumes in the dom0 as a result. The other option is to name your volume groups differently for every guest so there are no conflicts when lvm in the dom0 does a pvscan, this allows you to use the volumes from dom0 but can be a manageability issue. Personally I don''t think the tradeoffs are worth it for online resize. I do my LVM on the dom0 and then send individual LVs to the guests as xvda, xvdb, etc. but I cannot resize these without a reboot. _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Fajar A. Nugraha
2009-Aug-19 06:55 UTC
Re: [Xen-users] increase size for dom guest using lvm online
On Sun, Aug 16, 2009 at 6:25 PM, James Harper<james.harper@bendigoit.com.au> wrote:>> >> could we increase the size for dom guest online without rebooting or >> unmounting?> > For a PV DomU (or a HVM DomU using PV drivers), there is no mechanism > for the backend (Dom0) to notify the frontend (DomU) of a change in > device size. I suspect that HVM DomU''s have the same problems. > > So no, it cannot be done without rebooting.There''s a workaround, actually. For PV domU anyway. While you cannot get domU to pickup device size change online, you CAN attach new block device. So if you use LVM on domU as well, you can simply attach a new block device, add it as new PV, then extend domU''s LV. So you get the ability to grow domU''s storage online at the cost of extra complexity (having LVM on domU). -- Fajar _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Simon Hobson
2009-Aug-19 15:17 UTC
Re: [Xen-users] increase size for dom guest using lvm online
I wrote:>It may be possible to detatch a volume and re-attach it with xm but >I''ve never done that.Well now I have. Advance planning says I''ll need a bit more space on a volume, and there was a little bit of space available on the iSCSI box (so a case of grab it while it''s there, before someone else does !). Unmounted the volume in the guest, then : # cat backup <stuff deleted> disk = [ ''phy:vg0/backuproot,xvda1,w'', ''phy:vg0/backupvar,xvda2,w'', ''phy:/dev/disk/by-path/ip-<very-long-iscsi-address>,xvda3,w'', ''phy:vg0/backupswap,xvda4,w'' ] # xm list Name ID Mem VCPUs State Time(s) Domain-0 0 486 4 r----- 67982.4 backup 11 511 2 -b---- 135441.2 # xm block-detach 11 xvda3 <do any other steps required, such as altering partitions or resizing LVM volumes> # xm block-attach 11 ''/dev/disk/by-path/ip-<very-long-iscsi-address>'' /dev/xvda3 r Error: Device 51715 (vbd) could not be connected. Hotplug scripts not working. Usage: xm block-attach <Domain> <BackDev> <FrontDev> <Mode> [BackDomain] Create a new virtual block device. Checked in teh guest and the device didn''t re-appear, so tried again : # xm block-attach 11 ''/dev/disk/by-path/ip-<very-long-iscsi-address>'' /dev/xvda3 r Error: Device /dev/xvda3 (51715, vbd) is already connected. Usage: xm block-attach <Domain> <BackDev> <FrontDev> <Mode> [BackDomain] Create a new virtual block device. So I still had to shutdown and re-create the guest for the size change to appear.>In any case, at least with ext3, you need the filesystem unmounted >in order to resize it.As "Bart Van Kerckhove" <bart@it-ss.be> pointed out, you can do online resize of an ext3 filesystem : # df -h /store Filesystem Size Used Avail Use% Mounted on /dev/xvda3 99G 44G 51G 47% /store # resize2fs /dev/xvda3 resize2fs 1.41.3 (12-Oct-2008) Filesystem at /dev/xvda3 is mounted on /store; on-line resizing required old desc_blocks = 7, new_desc_blocks = 10 Performing an on-line resize of /dev/xvda3 to 39321087 (4k) blocks. The filesystem on /dev/xvda3 is now 39321087 blocks long. # df -h /store Filesystem Size Used Avail Use% Mounted on /dev/xvda3 148G 44G 97G 31% /store -- 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@lists.xensource.com http://lists.xensource.com/xen-users
Pasi Kärkkäinen
2009-Aug-19 17:35 UTC
Re: [Xen-users] increase size for dom guest using lvm online
On Wed, Aug 19, 2009 at 04:17:41PM +0100, Simon Hobson wrote:> I wrote: > > >It may be possible to detatch a volume and re-attach it with xm but > >I''ve never done that. > > Well now I have. Advance planning says I''ll need a bit more space on > a volume, and there was a little bit of space available on the iSCSI > box (so a case of grab it while it''s there, before someone else does > !). > > Unmounted the volume in the guest, then : > > # cat backup > <stuff deleted> > disk = [ ''phy:vg0/backuproot,xvda1,w'', > ''phy:vg0/backupvar,xvda2,w'', > ''phy:/dev/disk/by-path/ip-<very-long-iscsi-address>,xvda3,w'', > ''phy:vg0/backupswap,xvda4,w'' ] > > # xm list > Name ID Mem VCPUs State > Time(s) > Domain-0 0 486 4 r----- > 67982.4 > backup 11 511 2 -b---- > 135441.2 > > # xm block-detach 11 xvda3 > > <do any other steps required, such as altering partitions or resizing > LVM volumes> > > # xm block-attach 11 ''/dev/disk/by-path/ip-<very-long-iscsi-address>'' > /dev/xvda3 r > Error: Device 51715 (vbd) could not be connected. Hotplug scripts not > working. > Usage: xm block-attach <Domain> <BackDev> <FrontDev> <Mode> [BackDomain] > > Create a new virtual block device. > > Checked in teh guest and the device didn''t re-appear, so tried again : > > # xm block-attach 11 ''/dev/disk/by-path/ip-<very-long-iscsi-address>'' > /dev/xvda3 r > Error: Device /dev/xvda3 (51715, vbd) is already connected. > Usage: xm block-attach <Domain> <BackDev> <FrontDev> <Mode> [BackDomain] > > Create a new virtual block device. > > > So I still had to shutdown and re-create the guest for the size > change to appear. >You need to attach a completely new device, not the same xvda3. -- Pasi> > > >In any case, at least with ext3, you need the filesystem unmounted > >in order to resize it. > > As "Bart Van Kerckhove" <bart@it-ss.be> pointed out, you can do > online resize of an ext3 filesystem : > > # df -h /store > Filesystem Size Used Avail Use% Mounted on > /dev/xvda3 99G 44G 51G 47% /store > > # resize2fs /dev/xvda3 > resize2fs 1.41.3 (12-Oct-2008) > Filesystem at /dev/xvda3 is mounted on /store; on-line resizing required > old desc_blocks = 7, new_desc_blocks = 10 > Performing an on-line resize of /dev/xvda3 to 39321087 (4k) blocks. > The filesystem on /dev/xvda3 is now 39321087 blocks long. > > # df -h /store > Filesystem Size Used Avail Use% Mounted on > /dev/xvda3 148G 44G 97G 31% /store > -- > 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@lists.xensource.com > http://lists.xensource.com/xen-users_______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Simon Hobson
2009-Aug-19 17:51 UTC
Re: [Xen-users] increase size for dom guest using lvm online
Pasi Kärkkäinen wrote:> > # xm block-attach 11 ''/dev/disk/by-path/ip-<very-long-iscsi-address>'' >> /dev/xvda3 r >> Error: Device 51715 (vbd) could not be connected. Hotplug scripts not >> working. >> Usage: xm block-attach <Domain> <BackDev> <FrontDev> <Mode> [BackDomain] >> >> Create a new virtual block device. >> >> Checked in teh guest and the device didn''t re-appear, so tried again : >> >> # xm block-attach 11 ''/dev/disk/by-path/ip-<very-long-iscsi-address>'' >> /dev/xvda3 r >> Error: Device /dev/xvda3 (51715, vbd) is already connected. >> Usage: xm block-attach <Domain> <BackDev> <FrontDev> <Mode> [BackDomain] >> >> Create a new virtual block device. >> >> >> So I still had to shutdown and re-create the guest for the size >> change to appear. >> > >You need to attach a completely new device, not the same xvda3.Are you saying it''s not possible to use the same device name that was previously detatched ? -- 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@lists.xensource.com http://lists.xensource.com/xen-users