Hi Folks: I am a big fan of Xen and have a gotten a lot of help from this forum so I am posting this in the hopes that it will help others. My apologies for wasting space if this is already widely known. I am running xen-3.4.3 on CentOS 5.5 and recently had to grow a domU guest image because I miscalculated the amount of space I needed for packages. I tried a variety of ways to the fix the problem but because the image was created by cobbler, most of them didn''t work because there was no ext2 file system anywhere. My particular image had two partitions: ext3 for /sda1 (/boot) and lvm2 for /sda2 (/, swap, etc.) for the rest. Tools like gparted don''t work with lvm (yet). I finally settled on virt-resize from the guestfish package and found it so easy to use that I thought I would share it. Here are the steps, in a nutshell: % # Shutdown the VM (vm01) % virsh shutdown vm01 % # Find the location of the disk image. % virsh dumpxml vm01 | xpath /domain/devices/disk/source Found 1 nodes: -- NODE -- <source file="/var/lib/libvirt/images/vm01.img" /> % # List the partitions so that you can figure out which one you want to grow. % # Can also use tools like gparted for this. % cd /var/lib/libvirt/images/ % virt-list-partitions vm01.img Could not open ''/dev/kqemu'' - QEMU acceleration layer not activated: No such file or directory /dev/sda1 /dev/sda2 % # Create a new image of the correct size, in this case 16GB. % dd if=/dev/zero of=newdisk bs=1GB count=16 % # Resize. % virt-resize --expand /dev/sda2 vm01.img newdisk % # Install the new image. % mv vm01.img{,.too-small} % mv newdisk vm01.img % # Restart the guest. % virsh start vm01 If you don''t have the guestfish package which includes the virt-resize and virt-list-partitions tools, you can find it in the EPEL repository for Redhat/CentOS/Fedora. It can be installed as follows. % # As root -- get the repository reference if you don''t already have it. % # The rpm command will be different for non Redhat/CentOS/Fedora distros. % rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noa rch.rpm % # Install guestfish % # The yum command will be different for non Redhat/CentOS/Fedora distros. % yum -y install guestfish Cheers, Joe _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
On Mon, Jan 31, 2011 at 12:23 AM, Joe Linoff <jlinoff@tabula.com> wrote:> My particular image had two > partitions: ext3 for /sda1 (/boot) and lvm2 for /sda2 (/, swap, etc.) > for the rest. Tools like gparted don''t work with lvm (yet).You DO know that you can just add a new disk image to domU and add it to the LVM, right?> % # Create a new image of the correct size, in this case 16GB. > % dd if=/dev/zero of=newdisk bs=1GB count=16 > > % # Resize. > % virt-resize --expand /dev/sda2 vm01.img newdiskI''m guessing virt-resize will copy the data from the old disk to the new, bigger one. If so, it''d create I/O load to the disk which might not be desirable if you have other domUs running. Adding a second disk to the LVM set has the benefit of: - doesn''t require copying existing data - can be done live without shutting down domU> % mv vm01.img{,.too-small}Good trick, I didn''t know you can do that. Glad to hear you were able to solve your problem. -- Fajar _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Hi Fajar: Thank you for your feedback and insights.> You DO know that you can just add a new disk image to domU and add it > to the LVM, right?Yup but I appreciate the feedback. This was a production VM with local data. I ran into trouble when I needed to add another set of packages and was out of space. I needed to keep everything and simply extend the root partition a bit. Of course I could also have mounted the image on the dom0, backed up the data, re-created the new image and the copied it back but I wanted to try something different :-)> I''m guessing virt-resize will copy the data from the old disk to the > new, bigger one.Yup> If so, it''d create I/O load to the disk which might not be desirable > if you have other domUs running.Agreed. This is an important point that folks who want to try this will want to consider but it is pretty fast. If someone wanted to try this, I would strongly recommend doing it in a lab system first to if the performance hit was acceptable.> Adding a second disk to the LVM set has the benefit of: > - doesn''t require copying existing data > - can be done live without shutting down domUAgreed, but in this case to get the extra packages onto the system I would have had to split them between the old and new disks. Of course I could have made both disks part of the VG and extended the LV which is also a reasonable option. Thanks again, as I mentioned earlier, this forum has been just great and I really appreciate the help that you and other folks provide. Cheers, Joe -----Original Message----- From: Fajar A. Nugraha [mailto:list@fajar.net] Sent: Sunday, January 30, 2011 9:40 AM To: Joe Linoff Cc: xen-users@lists.xensource.com Subject: Re: [Xen-users] howto grow a domU disk image On Mon, Jan 31, 2011 at 12:23 AM, Joe Linoff <jlinoff@tabula.com> wrote:> My particular image had two > partitions: ext3 for /sda1 (/boot) and lvm2 for /sda2 (/, swap, etc.) > for the rest. Tools like gparted don''t work with lvm (yet).You DO know that you can just add a new disk image to domU and add it to the LVM, right?> % # Create a new image of the correct size, in this case 16GB. > % dd if=/dev/zero of=newdisk bs=1GB count=16 > > % # Resize. > % virt-resize --expand /dev/sda2 vm01.img newdiskI''m guessing virt-resize will copy the data from the old disk to the new, bigger one. If so, it''d create I/O load to the disk which might not be desirable if you have other domUs running. Adding a second disk to the LVM set has the benefit of: - doesn''t require copying existing data - can be done live without shutting down domU> % mv vm01.img{,.too-small}Good trick, I didn''t know you can do that. Glad to hear you were able to solve your problem. -- Fajar _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
On Sun, Jan 30, 2011 at 09:23:36AM -0800, Joe Linoff wrote:> If you don''t have the guestfish package which includes the virt-resize > and virt-list-partitions tools, you can find it in the EPEL repository > for Redhat/CentOS/Fedora. It can be installed as follows. > > % # As root -- get the repository reference if you don''t already have > it. > % # The rpm command will be different for non Redhat/CentOS/Fedora > distros. > % rpm -Uvh > http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noa > rch.rpmDebian/Ubuntu/Fedora/RHEL 6 users can also try binaries linked from here: http://libguestfs.org/FAQ.html#binaries Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming blog: http://rwmj.wordpress.com Fedora now supports 80 OCaml packages (the OPEN alternative to F#) http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
On Mon, Jan 31, 2011 at 12:40:01AM +0700, Fajar A. Nugraha wrote:> I''m guessing virt-resize will copy the data from the old disk to the > new, bigger one.Indeed this is how it works. There are drawbacks and benefits to both approaches. It''s all clearly explained in the manual page: http://libguestfs.org/virt-resize.1.html Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-top is ''top'' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://et.redhat.com/~rjones/virt-top _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
I have send the mailist but not have answare. I can use cobbler/koan and guestfish form my XEN 3.0 ? Thanks ----- Messaggio originale ----- Da: Joe Linoff <jlinoff@tabula.com> A: Franco Gismondi <f_gismondi@yahoo.it> Cc: Joe Linoff jlinoff@tabula.combut Inviato: Lun 31 gennaio 2011, 17:18:13 Oggetto: RE: [Xen-users] howto grow a domU disk image Hi Franco:> You are the first one to help me and i thank you a lotI am not sure but I think that is because you sent your email address to me personally and not to the xen users mailing list.> When i prove from my xenwebmanager interface to add new server i have this > messages in form the xenmanager and in file log /var/log/xenmanager/error_logI am afraid that I can''t help with xenwebmanager. I don''t use it. You will talk to the experts. I use cobbler/koan and guestfish for my cloud administration. Best regards, Joe -----Original Message----- From: Franco Gismondi [mailto:f_gismondi@yahoo.it] Sent: Monday, January 31, 2011 8:13 AM To: Joe Linoff Subject: Re: [Xen-users] howto grow a domU disk image You are the first one to help me and i thank you a lot When i prove from my xenwebmanager interface to add new server i have this messages in form the xenmanager and in file log /var/log/xenmanager/error_log [24/Jan/2011:13:13:01] HTTP Traceback (most recent call last): File "/usr/share/xenwebmanager/cherrypy/_cprequest.py", line 606, in respond cherrypy.response.body = self.handler() File "/usr/share/xenwebmanager/cherrypy/_cpdispatch.py", line 25, in __call__ return self.callable(*self.args, **self.kwargs) File "/usr/bin/xenwebmanager", line 1059, in alerts listalerts += xc_servers[sessid][host].fill_alerts() File "/usr/share/xenwebmanager/backend/addserver.py", line 45, in fill_alerts for ref in self.all_messages.keys(): AttributeError: backend instance has no attribute ''all_messages I have very Thank ----- Messaggio originale ----- Da: Joe Linoff <jlinoff@tabula.com> A: Franco Gismondi <f_gismondi@yahoo.it> Cc: Joe Linoff <jlinoff@tabula.com> Inviato: Lun 31 gennaio 2011, 16:56:36 Oggetto: RE: [Xen-users] howto grow a domU disk image Hi Franco: I would be happy to help. What is the problem? Cheers, Joe -----Original Message----- From: Franco Gismondi [mailto:f_gismondi@yahoo.it] Sent: Monday, January 31, 2011 2:05 AM To: Joe Linoff Subject: Re: [Xen-users] howto grow a domU disk image I have this problem,i non working whit xenwebmanager I have installated the last versione of xenwebmanager xenwebmanager-0.9.9-1.el5.rf.noarch.rpm and my XEN server is xen-3.0.3-105.el5_5.5 The OS is Centos 5 Can you give me an help Thaks ----- Messaggio originale ----- Da: Joe Linoff <jlinoff@tabula.com> A: xen-users@lists.xensource.com Cc: Joe Linoff <jlinoff@tabula.com> Inviato: Dom 30 gennaio 2011, 18:23:36 Oggetto: [Xen-users] howto grow a domU disk image Hi Folks: I am a big fan of Xen and have a gotten a lot of help from this forum so I am posting this in the hopes that it will help others. My apologies for wasting space if this is already widely known. I am running xen-3.4.3 on CentOS 5.5 and recently had to grow a domU guest image because I miscalculated the amount of space I needed for packages. I tried a variety of ways to the fix the problem but because the image was created by cobbler, most of them didn''t work because there was no ext2 file system anywhere. My particular image had two partitions: ext3 for /sda1 (/boot) and lvm2 for /sda2 (/, swap, etc.) for the rest. Tools like gparted don''t work with lvm (yet). I finally settled on virt-resize from the guestfish package and found it so easy to use that I thought I would share it. Here are the steps, in a nutshell: % # Shutdown the VM (vm01) % virsh shutdown vm01 % # Find the location of the disk image. % virsh dumpxml vm01 | xpath /domain/devices/disk/source Found 1 nodes: -- NODE -- <source file="/var/lib/libvirt/images/vm01.img" /> % # List the partitions so that you can figure out which one you want to grow. % # Can also use tools like gparted for this. % cd /var/lib/libvirt/images/ % virt-list-partitions vm01.img Could not open ''/dev/kqemu'' - QEMU acceleration layer not activated: No such file or directory /dev/sda1 /dev/sda2 % # Create a new image of the correct size, in this case 16GB. % dd if=/dev/zero of=newdisk bs=1GB count=16 % # Resize. % virt-resize --expand /dev/sda2 vm01.img newdisk % # Install the new image. % mv vm01.img{,.too-small} % mv newdisk vm01.img % # Restart the guest. % virsh start vm01 If you don''t have the guestfish package which includes the virt-resize and virt-list-partitions tools, you can find it in the EPEL repository for Redhat/CentOS/Fedora. It can be installed as follows. % # As root -- get the repository reference if you don''t already have it. % # The rpm command will be different for non Redhat/CentOS/Fedora distros. % rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noa rch.rpm % # Install guestfish % # The yum command will be different for non Redhat/CentOS/Fedora distros. % yum -y install guestfish Cheers, Joe _______________________________________________ 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
Hi Franco:> I can use cobbler/koan and guestfish form my XEN 3.0 ?cobbler/koan -- definitely guestfish -- probably (never tested it) I used cobbler/koan with the 3.0.3 and it worked great but I decided to move to xen 3.4.3 before I discovered guestfish so I can''t say whether it would work. However my guess is that guestfish will work well with 3.0.3 because it seems really solid. Hope this helps. Cheers, Joe -----Original Message----- From: Franco Gismondi [mailto:f_gismondi@yahoo.it] Sent: Monday, January 31, 2011 8:24 AM To: Joe Linoff Cc: xen-users@lists.xensource.com Subject: Re: [Xen-users] howto grow a domU disk image I have send the mailist but not have answare. I can use cobbler/koan and guestfish form my XEN 3.0 ? Thanks ----- Messaggio originale ----- Da: Joe Linoff <jlinoff@tabula.com> A: Franco Gismondi <f_gismondi@yahoo.it> Cc: Joe Linoff jlinoff@tabula.combut Inviato: Lun 31 gennaio 2011, 17:18:13 Oggetto: RE: [Xen-users] howto grow a domU disk image Hi Franco:> You are the first one to help me and i thank you a lotI am not sure but I think that is because you sent your email address to me personally and not to the xen users mailing list.> When i prove from my xenwebmanager interface to add new server i have this > messages in form the xenmanager and in file log /var/log/xenmanager/error_logI am afraid that I can''t help with xenwebmanager. I don''t use it. You will talk to the experts. I use cobbler/koan and guestfish for my cloud administration. Best regards, Joe -----Original Message----- From: Franco Gismondi [mailto:f_gismondi@yahoo.it] Sent: Monday, January 31, 2011 8:13 AM To: Joe Linoff Subject: Re: [Xen-users] howto grow a domU disk image You are the first one to help me and i thank you a lot When i prove from my xenwebmanager interface to add new server i have this messages in form the xenmanager and in file log /var/log/xenmanager/error_log [24/Jan/2011:13:13:01] HTTP Traceback (most recent call last): File "/usr/share/xenwebmanager/cherrypy/_cprequest.py", line 606, in respond cherrypy.response.body = self.handler() File "/usr/share/xenwebmanager/cherrypy/_cpdispatch.py", line 25, in __call__ return self.callable(*self.args, **self.kwargs) File "/usr/bin/xenwebmanager", line 1059, in alerts listalerts += xc_servers[sessid][host].fill_alerts() File "/usr/share/xenwebmanager/backend/addserver.py", line 45, in fill_alerts for ref in self.all_messages.keys(): AttributeError: backend instance has no attribute ''all_messages I have very Thank ----- Messaggio originale ----- Da: Joe Linoff <jlinoff@tabula.com> A: Franco Gismondi <f_gismondi@yahoo.it> Cc: Joe Linoff <jlinoff@tabula.com> Inviato: Lun 31 gennaio 2011, 16:56:36 Oggetto: RE: [Xen-users] howto grow a domU disk image Hi Franco: I would be happy to help. What is the problem? Cheers, Joe -----Original Message----- From: Franco Gismondi [mailto:f_gismondi@yahoo.it] Sent: Monday, January 31, 2011 2:05 AM To: Joe Linoff Subject: Re: [Xen-users] howto grow a domU disk image I have this problem,i non working whit xenwebmanager I have installated the last versione of xenwebmanager xenwebmanager-0.9.9-1.el5.rf.noarch.rpm and my XEN server is xen-3.0.3-105.el5_5.5 The OS is Centos 5 Can you give me an help Thaks ----- Messaggio originale ----- Da: Joe Linoff <jlinoff@tabula.com> A: xen-users@lists.xensource.com Cc: Joe Linoff <jlinoff@tabula.com> Inviato: Dom 30 gennaio 2011, 18:23:36 Oggetto: [Xen-users] howto grow a domU disk image Hi Folks: I am a big fan of Xen and have a gotten a lot of help from this forum so I am posting this in the hopes that it will help others. My apologies for wasting space if this is already widely known. I am running xen-3.4.3 on CentOS 5.5 and recently had to grow a domU guest image because I miscalculated the amount of space I needed for packages. I tried a variety of ways to the fix the problem but because the image was created by cobbler, most of them didn''t work because there was no ext2 file system anywhere. My particular image had two partitions: ext3 for /sda1 (/boot) and lvm2 for /sda2 (/, swap, etc.) for the rest. Tools like gparted don''t work with lvm (yet). I finally settled on virt-resize from the guestfish package and found it so easy to use that I thought I would share it. Here are the steps, in a nutshell: % # Shutdown the VM (vm01) % virsh shutdown vm01 % # Find the location of the disk image. % virsh dumpxml vm01 | xpath /domain/devices/disk/source Found 1 nodes: -- NODE -- <source file="/var/lib/libvirt/images/vm01.img" /> % # List the partitions so that you can figure out which one you want to grow. % # Can also use tools like gparted for this. % cd /var/lib/libvirt/images/ % virt-list-partitions vm01.img Could not open ''/dev/kqemu'' - QEMU acceleration layer not activated: No such file or directory /dev/sda1 /dev/sda2 % # Create a new image of the correct size, in this case 16GB. % dd if=/dev/zero of=newdisk bs=1GB count=16 % # Resize. % virt-resize --expand /dev/sda2 vm01.img newdisk % # Install the new image. % mv vm01.img{,.too-small} % mv newdisk vm01.img % # Restart the guest. % virsh start vm01 If you don''t have the guestfish package which includes the virt-resize and virt-list-partitions tools, you can find it in the EPEL repository for Redhat/CentOS/Fedora. It can be installed as follows. % # As root -- get the repository reference if you don''t already have it. % # The rpm command will be different for non Redhat/CentOS/Fedora distros. % rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noa rch.rpm % # Install guestfish % # The yum command will be different for non Redhat/CentOS/Fedora distros. % yum -y install guestfish Cheers, Joe _______________________________________________ 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
On Mon, Jan 31, 2011 at 04:24:04PM +0000, Franco Gismondi wrote:> and guestfish form my XEN 3.0 ?libguestfs and guestfish just work on disk images, so as long as the disk image is in a standard format then yes. There is no dependency or requirement for Xen or anything else. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-top is ''top'' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://et.redhat.com/~rjones/virt-top _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users