Hi! I''m using fedora 7 for both host and guests. I would like to be able to borrow unused space from one guest to be used in another one. Looking for how to do that I only found instructions from people that creates logical volumes and install the system using debootstrap. I would like to use virt-manager to install my guests with lvm. How can I do the partitioning for guests during my host install? Thanks in advance. Regards, -- Augusto
Augusto Castelan Carlson wrote:> I''m using fedora 7 for both host and guests. I would like to be able > to borrow unused space from one guest to be used in another one. > > Looking for how to do that I only found instructions from people that > creates logical volumes and install the system using debootstrap. I > would like to use virt-manager to install my guests with lvm. How can > I do the partitioning for guests during my host install?I think a number of separate issues to address here. The advantages of LVM when combined with virtualisation or Xen are that you can create guest partitions easily and flexibly, that they can have nice names, and that you can resize and also delete them simply. LVM also lets you do this flexibly across physical disks, add extra physical disks if you run out of space, and so on. So the basic command you need is: lvcreate -L 10G -n myguest VolGroup00 which would create a 10 GB partition called /dev/VolGroup00/myguest within an existing volume group called VolGroup00. (This isn''t going to be a tutorial about LVM - there are plenty out there, go and use Google). With the partition created above, just use the name of the partition directly within the virt-manager creation dialog. Forthcoming versions of virt-manager will be able to do the provisioning of LVM storage more automatically. If you want to follow this work, take a look at libvir-list. This doesn''t address directly your problem "to be able to borrow unused space from one guest to be used in another one". All that you''ll get with basic LVM is the ability to resize one guest down and another guest up. If all your guests are "related" -- that is they are derived from say a single distribution, there are several options: run an NFS server and share parts of the guests'' filesystems, eg. home directories or /usr if you''re feeling adventurous. You could also look at LVM snapshotting, which will let guests "share" a single installation, but writes all modifications to their private partitions. The disadvantage of snapshotting is that although your guests start small, they grow indefinitely over time and later common changes cannot be shared. Rich. -- Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/ Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 03798903
Hi! On 11/5/07, Richard W.M. Jones <rjones@redhat.com> wrote:> The advantages of LVM when combined with virtualisation or Xen are that > you can create guest partitions easily and flexibly, that they can have > nice names, and that you can resize and also delete them simply. LVM > also lets you do this flexibly across physical disks, add extra physical > disks if you run out of space, and so on.> So the basic command you need is: > > lvcreate -L 10G -n myguest VolGroup00 > > which would create a 10 GB partition called /dev/VolGroup00/myguest > within an existing volume group called VolGroup00. (This isn''t going to > be a tutorial about LVM - there are plenty out there, go and use Google). > > With the partition created above, just use the name of the partition > directly within the virt-manager creation dialog. Forthcoming versions > of virt-manager will be able to do the provisioning of LVM storage more > automatically. If you want to follow this work, take a look at libvir-list. > > This doesn''t address directly your problem "to be able to borrow unused > space from one guest to be used in another one". All that you''ll get > with basic LVM is the ability to resize one guest down and another guest up.I pointed /dev/VolGroup00/myguest within virt-manager and installed the guest. Suppose that I need to add an extra physical disk or instead of borrow, only resize one guest down and another guest up. I did a lvextend to add 1G to myguest, but how can I make my guest see that change? In lvm How To they use the command resize2fs to resize the filesystem, but I do not realize how to apply that changes to guests using LVM or partitioned by the guest installer. I tried to use the guest drive partitioned as /dev/xvda1 (boot), /dev/xvda2 (/) and /dev/xvda3 (/home) and also with LVM. How can I make the guest see that change? Thanks! Regards, -- Augusto
----- "Augusto Castelan Carlson" <accarlson@gmail.com> wrote:> On 11/5/07, Richard W.M. Jones <rjones@redhat.com> wrote: > > The advantages of LVM when combined with virtualisation or Xen are > that > > you can create guest partitions easily and flexibly, that they can > have > > nice names, and that you can resize and also delete them simply. > LVM > > also lets you do this flexibly across physical disks, add extra > physical > > disks if you run out of space, and so on. > > > So the basic command you need is: > > > > lvcreate -L 10G -n myguest VolGroup00 > > > > which would create a 10 GB partition called /dev/VolGroup00/myguest > > within an existing volume group called VolGroup00. (This isn''t > going to > > be a tutorial about LVM - there are plenty out there, go and use > Google). > > > > With the partition created above, just use the name of the > partition > > directly within the virt-manager creation dialog. Forthcoming > versions > > of virt-manager will be able to do the provisioning of LVM storage > more > > automatically. If you want to follow this work, take a look at > libvir-list. > > > > This doesn''t address directly your problem "to be able to borrow > unused > > space from one guest to be used in another one". All that you''ll > get > > with basic LVM is the ability to resize one guest down and another > guest up. > > I pointed /dev/VolGroup00/myguest within virt-manager and installed > the guest. > > Suppose that I need to add an extra physical disk or instead of > borrow, only resize one guest down and another guest up. > > I did a lvextend to add 1G to myguest, but how can I make my guest > see > that change? > In lvm How To they use the command resize2fs to resize the > filesystem, > but I do not realize how to apply that changes to guests using LVM or > partitioned by the guest installer. > > I tried to use the guest drive partitioned as /dev/xvda1 (boot), > /dev/xvda2 (/) and /dev/xvda3 (/home) and also with LVM. > > How can I make the guest see that change?If I understand... You created a LV called myguest in dom0 and within your domU you have used fdisk to partition /dev/xvda and layered LVM on top of one of those partitions. Now you''ve expanded myguest and want to see that space gain in the domU. I think what you should have done is turn /dev/xvda into a PV inside your domU. At that point you can use pvresize in your domU to take advantage of any space you may add to the myguest LV in dom0. I''m not sure how you''d account for a change in /dev/xvda otherwise. Someone else may know. In your domU, you are working at the device level below the filesystem level. Resizefs doesn''t immediately come into play. -- Dale Bewley - Unix Administrator - Shields Library - UC Davis GPG: 0xB098A0F3 0D5A 9AEB 43F4 F84C 7EFD 1753 064D 2583 B098 A0F3
Augusto Castelan Carlson wrote:> I did a lvextend to add 1G to myguest, but how can I make my guest see > that change? > In lvm How To they use the command resize2fs to resize the filesystem, > but I do not realize how to apply that changes to guests using LVM or > partitioned by the guest installer. > > I tried to use the guest drive partitioned as /dev/xvda1 (boot), > /dev/xvda2 (/) and /dev/xvda3 (/home) and also with LVM. > > How can I make the guest see that change?I think pvresize is the command (in the guest). However I''d strongly suggest that you take a look at a few FAQs and HOWTOs, for example: http://tldp.org/HOWTO/LVM-HOWTO/index.html http://tldp.org/HOWTO/LVM-HOWTO/extendlv.html Rich. -- Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/ Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 03798903
Hi! On 11/7/07, Richard W.M. Jones <rjones@redhat.com> wrote:> Augusto Castelan Carlson wrote: > > I did a lvextend to add 1G to myguest, but how can I make my guest see > > that change? > > In lvm How To they use the command resize2fs to resize the filesystem, > > but I do not realize how to apply that changes to guests using LVM or > > partitioned by the guest installer. > > > > I tried to use the guest drive partitioned as /dev/xvda1 (boot), > > /dev/xvda2 (/) and /dev/xvda3 (/home) and also with LVM. > > > > How can I make the guest see that change? > > I think pvresize is the command (in the guest). However I''d strongly > suggest that you take a look at a few FAQs and HOWTOs, for example: > > http://tldp.org/HOWTO/LVM-HOWTO/index.html > http://tldp.org/HOWTO/LVM-HOWTO/extendlv.htmlThanks, it works! With the new space unallocated in the guest a have created a new partition, create a new PV, extended the VG and the LV. To resize the guest down, the procedure is different as the file system can''t be reduced on-line... I''m having no success reducing the files system. After reducing, I can restart it ("kernel panic, not syncing"). I tried to resize down the guest accessing the LV through the host with 1) kpartx, pvscan, lvchange, e2fsck, resize2fs, lvreduce and also 2) doing the resize2fs through the host and the rest in the guest. Both approaches failed for me. Are these the correct way to do that? Or there is a better way to do that? Thanks! Regards, -- Augusto