Hi All, I need to resize the xen disk file. This file have a LVM partition inside .Do you have any ideas how to do it? Thanks _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
I resized the file disk using: dd if=/dev/zero of=*image* bs=1M conv=notrunc count=1 seek=10240 But when I boot up my VM I can''t see the new space [root@boldtsamqa ~]# vgdisplay --- Volume group --- VG Name VolGroup00 System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 3 VG Access read/write VG Status resizable MAX LV 0 Cur LV 2 Open LV 2 Max PV 0 Cur PV 1 Act PV 1 VG Size 4.88 GB PE Size 32.00 MB Total PE 156 Alloc PE / Size 156 / 4.88 GB Free PE / Size 0 / 0 VG UUID cMZekR-zsPG-lZGc-dO2J-aZdh-RO7d-8WdZUi On Thu, Mar 6, 2008 at 4:11 PM, Brian Stempin <brian.stempin@gmail.com> wrote:> I don''t know the syntax off of the top of my head, but I''d imagine that > you could use the dd command to tack on empty space to the end of your > file. Once that''s done, you can boot up the domU and expand your LVM > partition. > > On Thu, Mar 6, 2008 at 11:07 AM, Martin Fernandez < > martingfernandez@gmail.com> wrote: > > > Hi All, > > I need to resize the xen disk file. This file have a LVM partition > > inside . Do you have any ideas how to do it? > > > > > > Thanks > > > > _______________________________________________ > > 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 Thu, Mar 6, 2008 at 1:18 PM, Martin Fernandez <martingfernandez@gmail.com> wrote:> I resized the file disk using: > dd if=/dev/zero of=image bs=1M conv=notrunc count=1 seek=10240 > But when I boot up my VM I can''t see the new spacewhat does /proc/partitions say? the old size? if it''s the new size, then you need to do a pvresize so that the LVM system gets it. if it''s the old size, something''s fishy... -- Javier _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Now I can see the free space, but I cant extend the LV [root@boldtsamqa ~]# pvresize --setphysicalvolumesize 8GB /dev/xvda2 WARNING: /dev/xvda2: Overriding real size. You could lose data. Physical volume "/dev/xvda2" changed 1 physical volume(s) resized / 0 physical volume(s) not resized [root@boldtsamqa ~]# lvextend -L+3G /dev/VolGroup00/LogVol00 Extending logical volume LogVol00 to 6.84 GB device-mapper: table: device 202:2 too small for target device-mapper: table: 253:0: linear: dm-linear: Device lookup failed device-mapper: ioctl: error adding target to table device-mapper: reload ioctl failed: Invalid argument Failed to suspend LogVol00 Any ideas? Thanks all for your help On Thu, Mar 6, 2008 at 4:28 PM, Javier Guerra <javier@guerrag.com> wrote:> On Thu, Mar 6, 2008 at 1:18 PM, Martin Fernandez > <martingfernandez@gmail.com> wrote: > > I resized the file disk using: > > dd if=/dev/zero of=image bs=1M conv=notrunc count=1 seek=10240 > > But when I boot up my VM I can''t see the new space > > what does /proc/partitions say? the old size? > > if it''s the new size, then you need to do a pvresize so that the LVM > system gets it. > > if it''s the old size, something''s fishy... > > -- > Javier >_______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Martin Fernandez wrote:> I resized the file disk using: > dd if=/dev/zero of=*image* bs=1M conv=notrunc count=1 seek=10240Can someone please explain to me what this command does? I also want to increase a VM''s space. This is my current layout: Filesystem Size Used Avail Use% Mounted on /dev/mapper/sysvg-root 2.1G 943M 1.1G 48% / /dev/mapper/sysvg-usr 8.4G 1.1G 6.8G 14% /usr /dev/mapper/sysvg-var 8.4G 246M 7.7G 4% /var /dev/mapper/sysvg-home 56G 13G 40G 25% /home /dev/mapper/sysvg-tmp 1.1G 45M 942M 5% /tmp /dev/sda1 152M 27M 118M 19% /boot tmpfs 269M 0 269M 0% /dev/shm /dev/mapper/backup-home2 15G 172M 14G 2% /home2 /dev/mapper/backup-iso 22G 1.9G 19G 10% /iso /dev/mapper/backup-bck 43G 185M 40G 1% /bck The VM''s are located in /home/vm as /home/vm/vm01.img And is it safe to resize an VM image while it''s running? -- Kind Regards Rudi Ahlers CEO, SoftDux Web: http://www.SoftDux.com Check out my technical blog, http://blog.softdux.com for Linux or other technical stuff, or visit http://www.WebHostingTalk.co.za for Web Hosting stugg _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
On Thu, Mar 6, 2008 at 4:16 PM, Rudi Ahlers <Rudi@softdux.com> wrote:> Martin Fernandez wrote: > > I resized the file disk using: > > dd if=/dev/zero of=*image* bs=1M conv=notrunc count=1 seek=10240 > Can someone please explain to me what this command does? I also want to''dd'' copies ''count'' blocks of size ''bs'' from ''if'' to ''of'', first advancing (from start) ''seek'' blocks. in this case, it advances to 10G (10240*1M), and writes 1M of zeroes. if the image file was smaller than that, it would grow.> And is it safe to resize an VM image while it''s running?sure. to the VM it''s simply that the block device won''t complain for access to blocks that it wasn''t accessing anyway. example: - you have a 5G image file, put an ext3 filesystem on it. mkfs checks the device size once and does the ondisk structures so that you won''t try to access beyond the end of the device when using the filesystem. - start VM: - checks device size, shows it in /proc/partitions - mounts fs, uses it to access, never writes beyond 5G - in Dom0 you grow it to 10G. now if you wrote to the device at the 7G point, it could work, but the kernel still beleives it''s just 5G, so it would fail before trying. - in VM do a partscan. /proc/partitions is updated, now it shows 10G and if you wrote to the 7G point it would work; but the filesystem still is 5G - in VM do a resizefs, this is the part that really affects upper layers, but there''s lots of experience in doing it well, and these days most filesystems can do it online. (at least ReiserFS, ext3, XFS) the only ''scary'' thing is updating all layers in the *correct* order. in this example, the image file directly contains the ext3 fs; but if you have LVM, there are at least a couple more (PV and LV) -- Javier _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Javier Guerra wrote:> On Thu, Mar 6, 2008 at 4:16 PM, Rudi Ahlers <Rudi@softdux.com> wrote: > >> Martin Fernandez wrote: >> > I resized the file disk using: >> > dd if=/dev/zero of=*image* bs=1M conv=notrunc count=1 seek=10240 >> Can someone please explain to me what this command does? I also want to >> > > ''dd'' copies ''count'' blocks of size ''bs'' from ''if'' to ''of'', first > advancing (from start) ''seek'' blocks. > > in this case, it advances to 10G (10240*1M), and writes 1M of zeroes. > if the image file was smaller than that, it would grow. >Thanx :) What does the "conv=notrunc" mean? And does / will it simply append the extra blocks to the existing ones? Or how does it know where to put it?>> And is it safe to resize an VM image while it''s running? >> > > sure. to the VM it''s simply that the block device won''t complain for > access to blocks that it wasn''t accessing anyway. > > example: > - you have a 5G image file, put an ext3 filesystem on it. mkfs checks > the device size once and does the ondisk structures so that you won''t > try to access beyond the end of the device when using the filesystem. > > - start VM: > - checks device size, shows it in /proc/partitions > - mounts fs, uses it to access, never writes beyond 5G > > - in Dom0 you grow it to 10G. now if you wrote to the device at the > 7G point, it could work, but the kernel still beleives it''s just 5G, > so it would fail before trying. > > - in VM do a partscan. /proc/partitions is updated, now it shows 10G > and if you wrote to the 7G point it would work; but the filesystem > still is 5G > > - in VM do a resizefs, this is the part that really affects upper > layers, but there''s lots of experience in doing it well, and these > days most filesystems can do it online. (at least ReiserFS, ext3, XFS) > > the only ''scary'' thing is updating all layers in the *correct* order. > in this example, the image file directly contains the ext3 fs; but if > you have LVM, there are at least a couple more (PV and LV) >This helps quite a lot. Do I understand correctly that there''s no point in setting up a LVM on the VM then? So, to safely resize the current VM''s space, I do the following: xm save vm01 xm destroy vm01 Then I increase the image dd if=/dev/zero of=/home/vm/vm01.im bs=1M conv=notrunc count=1 seek=30720 after that I need to run partscan? I don''t see such a command on the VM, what is it part of? After I install partscan, then how do I use it? Then, I need to run resize2fs, what is the correct syntax? This is the current VM''s output root@vps01 [~]# df -H Filesystem Size Used Avail Use% Mounted on /dev/mapper/VolGroup00-LogVol00 9.8G 6.6G 2.7G 71% / /dev/xvda1 104M 20M 79M 21% /boot tmpfs 537M 0 537M 0% /dev/shm /usr/tmpDSK 508M 42M 441M 9% /tmp -- Kind Regards Rudi Ahlers CEO, SoftDux Web: http://www.SoftDux.com Check out my technical blog, http://blog.softdux.com for Linux or other technical stuff, or visit http://www.WebHostingTalk.co.za for Web Hosting stugg _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Rudi, conv=notrunc prevents dd from truncating the file. Normally, dd would just overwrite the file. When using conv=notrunc, dd will leave the existing data alone and stop taking on 0s when the desired file size is reached. Setting up LVM inside of a VM is the most useful in cases where you give the VM direct disk access. Since you have a file (or a series of files), most of the advantages that LVM affords you are redundant. Since you''re using LVM, you''ll have to expand your LVM partitions before you can expand the underlying EXT2 file system. As indicated earlier in this email chain, you can expand your LVM group via pvresize and lvextend. Martin, I have no idea. If I find something, I''ll let you know. _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Brian Stempin wrote:> Rudi, > > conv=notrunc prevents dd from truncating the file. Normally, dd would > just overwrite the file. When using conv=notrunc, dd will leave the > existing data alone and stop taking on 0s when the desired file size > is reached. >Great, so existing data should still stay the same then?> Setting up LVM inside of a VM is the most useful in cases where you > give the VM direct disk access. Since you have a file (or a series of > files), most of the advantages that LVM affords you are redundant.Ok, so you''re saying that when I setup the VM''s / dum_U''s, and I get to the partitioning part, that I should use LVM? Even thoug h LVM is already being used on dom0 / the main server''s hard drives? That sounds odd to me, but I''ll give it a shot on my next VM deployment> > Since you''re using LVM, you''ll have to expand your LVM partitions > before you can expand the underlying EXT2 file system. As indicated > earlier in this email chain, you can expand your LVM group via > pvresize and lvextend.My main system still has plenty space on the HDD''s, and I use image files for the VM''s, not seperate LV''s / PV''s - The only reason I use LVM is to make it easier to upgrade the HDD''s> _______________________________________________ > Xen-users mailing list > Xen-users@lists.xensource.com > http://lists.xensource.com/xen-usersI''m learning a lot today :) -- Kind Regards Rudi Ahlers CEO, SoftDux Web: http://www.SoftDux.com Check out my technical blog, http://blog.softdux.com for Linux or other technical stuff, or visit http://www.WebHostingTalk.co.za for Web Hosting stugg _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Rudi, Great, so existing data should still stay the same then Yes, your data will remain untouched if you use conv=notrunc Ok, so you''re saying that when I setup the VM''s / dum_U''s, and I get to> the partitioning part, that I should use LVM? Even thoug h LVM is > already being used on dom0 / the main server''s hard drives? That sounds > odd to me, but I''ll give it a shot on my next VM deploymentThat''s not quite what I meant. Some people prefer to install their VMs directly to disk. Instead of having a disk stanza that contains "file:/media/storage/domainxx/disk0.img", you could use "phy:/dev/sda1". In cases where you want to use direct access, it''s generally a common practice to use LVM on dom0 to make managing these physical partitions easier. The domU doesn''t ever need to know that it''s disk is really a LV, and thus does not need any LVM utilities installed. On Thu, Mar 6, 2008 at 11:25 PM, Rudi Ahlers <Rudi@softdux.com> wrote:> Brian Stempin wrote: > > Rudi, > > > > conv=notrunc prevents dd from truncating the file. Normally, dd would > > just overwrite the file. When using conv=notrunc, dd will leave the > > existing data alone and stop taking on 0s when the desired file size > > is reached. > > > Great, so existing data should still stay the same then? > > Setting up LVM inside of a VM is the most useful in cases where you > > give the VM direct disk access. Since you have a file (or a series of > > files), most of the advantages that LVM affords you are redundant. > Ok, so you''re saying that when I setup the VM''s / dum_U''s, and I get to > the partitioning part, that I should use LVM? Even thoug h LVM is > already being used on dom0 / the main server''s hard drives? That sounds > odd to me, but I''ll give it a shot on my next VM deployment > > > > Since you''re using LVM, you''ll have to expand your LVM partitions > > before you can expand the underlying EXT2 file system. As indicated > > earlier in this email chain, you can expand your LVM group via > > pvresize and lvextend. > My main system still has plenty space on the HDD''s, and I use image > files for the VM''s, not seperate LV''s / PV''s - The only reason I use LVM > is to make it easier to upgrade the HDD''s > > _______________________________________________ > > Xen-users mailing list > > Xen-users@lists.xensource.com > > http://lists.xensource.com/xen-users > > I''m learning a lot today :) > > -- > > Kind Regards > Rudi Ahlers > CEO, SoftDux > > Web: http://www.SoftDux.com > Check out my technical blog, http://blog.softdux.com for Linux or other > technical stuff, or visit http://www.WebHostingTalk.co.za for Web Hosting > stugg > >_______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Brian Stempin wrote:> Rudi, > > Great, so existing data should still stay the same then > > > Yes, your data will remain untouched if you use conv=notrunc > > Ok, so you''re saying that when I setup the VM''s / dum_U''s, and I > get to > the partitioning part, that I should use LVM? Even thoug h LVM is > already being used on dom0 / the main server''s hard drives? That > sounds > odd to me, but I''ll give it a shot on my next VM deployment > > > That''s not quite what I meant. Some people prefer to install their > VMs directly to disk. Instead of having a disk stanza that contains > "file:/media/storage/domainxx/disk0.img", you could use > "phy:/dev/sda1". In cases where you want to use direct access, it''s > generally a common practice to use LVM on dom0 to make managing these > physical partitions easier. The domU doesn''t ever need to know that > it''s disk is really a LV, and thus does not need any LVM utilities > installed.Ok, I see where you''re coming from. LVM is a new thing to me too, so I have opted to use img files instead which I understand more than I understand VM at this stage. So, if you were to build a server that will mainly host VM''s, say 20 VM''s, would you start off with LVM immediately, and then greate a new logical volume for each VM / VPS? I presume if this is the route you take, then you probably also only create them when needed, right? So, if you only have 3 clients with VM''s at the moment, you only create the three needed lv''s on LVM. From my understanding, you can now resize them as needed? Can one then se LVM''s snapshot feature to backup these VM''s / VP''s while they''re running?> > > On Thu, Mar 6, 2008 at 11:25 PM, Rudi Ahlers <Rudi@softdux.com > <mailto:Rudi@softdux.com>> wrote: > > Brian Stempin wrote: > > Rudi, > > > > conv=notrunc prevents dd from truncating the file. Normally, dd > would > > just overwrite the file. When using conv=notrunc, dd will leave the > > existing data alone and stop taking on 0s when the desired file size > > is reached. > > > Great, so existing data should still stay the same then? > > Setting up LVM inside of a VM is the most useful in cases where you > > give the VM direct disk access. Since you have a file (or a > series of > > files), most of the advantages that LVM affords you are redundant. > Ok, so you''re saying that when I setup the VM''s / dum_U''s, and I > get to > the partitioning part, that I should use LVM? Even thoug h LVM is > already being used on dom0 / the main server''s hard drives? That > sounds > odd to me, but I''ll give it a shot on my next VM deployment > > > > Since you''re using LVM, you''ll have to expand your LVM partitions > > before you can expand the underlying EXT2 file system. As indicated > > earlier in this email chain, you can expand your LVM group via > > pvresize and lvextend. > My main system still has plenty space on the HDD''s, and I use image > files for the VM''s, not seperate LV''s / PV''s - The only reason I > use LVM > is to make it easier to upgrade the HDD''s > > _______________________________________________ > > Xen-users mailing list > > Xen-users@lists.xensource.com <mailto:Xen-users@lists.xensource.com> > > http://lists.xensource.com/xen-users > > I''m learning a lot today :) > > -- > > Kind Regards > Rudi Ahlers > CEO, SoftDux > > Web: http://www.SoftDux.com > Check out my technical blog, http://blog.softdux.com for Linux or > other technical stuff, or visit http://www.WebHostingTalk.co.za > for Web Hosting stugg > >-- Kind Regards Rudi Ahlers CEO, SoftDux Web: http://www.SoftDux.com Check out my technical blog, http://blog.softdux.com for Linux or other technical stuff, or visit http://www.WebHostingTalk.co.za for Web Hosting stugg _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Rudi Ahlers wrote:> Brian Stempin wrote: >> Rudi, >> >> conv=notrunc prevents dd from truncating the file. Normally, dd >> would just overwrite the file. When using conv=notrunc, dd will >> leave the existing data alone and stop taking on 0s when the desired >> file size is reached. >> > Great, so existing data should still stay the same then? >> Setting up LVM inside of a VM is the most useful in cases where you >> give the VM direct disk access. Since you have a file (or a series >> of files), most of the advantages that LVM affords you are redundant. > Ok, so you''re saying that when I setup the VM''s / dum_U''s, and I get > to the partitioning part, that I should use LVM? Even thoug h LVM is > already being used on dom0 / the main server''s hard drives? That > sounds odd to me, but I''ll give it a shot on my next VM deploymentUse LVM to create partitions, on Dom0, to act like block devices on DomU. Use them as raw block block devices, not LVM, inside the DomU: you can add a pretty arbitrary number of such block devices in DomU, and do your resizing on Dom0 with the DomU shut down. This works well for everything except the boot loader, which is its own adventure in Xen.>> >> Since you''re using LVM, you''ll have to expand your LVM partitions >> before you can expand the underlying EXT2 file system. As indicated >> earlier in this email chain, you can expand your LVM group via >> pvresize and lvextend. > My main system still has plenty space on the HDD''s, and I use image > files for the VM''s, not seperate LV''s / PV''s - The only reason I use > LVM is to make it easier to upgrade the HDD''sHmm. Can you keep snapshotting that way? And don''t you suffer a performance penalty? _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Nico Kadel-Garcia wrote:> Rudi Ahlers wrote: >> Brian Stempin wrote: >>> Rudi, >>> >>> conv=notrunc prevents dd from truncating the file. Normally, dd >>> would just overwrite the file. When using conv=notrunc, dd will >>> leave the existing data alone and stop taking on 0s when the desired >>> file size is reached. >>> >> Great, so existing data should still stay the same then? >>> Setting up LVM inside of a VM is the most useful in cases where you >>> give the VM direct disk access. Since you have a file (or a series >>> of files), most of the advantages that LVM affords you are redundant. >> Ok, so you''re saying that when I setup the VM''s / dum_U''s, and I get >> to the partitioning part, that I should use LVM? Even thoug h LVM is >> already being used on dom0 / the main server''s hard drives? That >> sounds odd to me, but I''ll give it a shot on my next VM deployment > Use LVM to create partitions, on Dom0, to act like block devices on > DomU. Use them as raw block block devices, not LVM, inside the DomU: > you can add a pretty arbitrary number of such block devices in DomU, > and do your resizing on Dom0 with the DomU shut down. This works well > for everything except the boot loader, which is its own adventure in Xen. > >>> >>> Since you''re using LVM, you''ll have to expand your LVM partitions >>> before you can expand the underlying EXT2 file system. As indicated >>> earlier in this email chain, you can expand your LVM group via >>> pvresize and lvextend. >> My main system still has plenty space on the HDD''s, and I use image >> files for the VM''s, not seperate LV''s / PV''s - The only reason I use >> LVM is to make it easier to upgrade the HDD''s > Hmm. Can you keep snapshotting that way? And don''t you suffer a > performance penalty? > > _______________________________________________ >I havent'' tired it yet, but it''s the theory. Apparently if I add more / bigger drives to the system (which runs software RAID), then I should just be able to extend the PV''s? Like I said, I haven''t tried it yet, so I don''t know if / how it will actually work. But now that you mention it, I should probably try it out sometime -- Kind Regards Rudi Ahlers CEO, SoftDux Web: http://www.SoftDux.com Check out my technical blog, http://blog.softdux.com for Linux or other technical stuff, or visit http://www.WebHostingTalk.co.za for Web Hosting stugg _______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users
Anyone know about this error? Thanks On Thu, Mar 6, 2008 at 5:29 PM, Martin Fernandez <martingfernandez@gmail.com> wrote:> Now I can see the free space, but I cant extend the LV > > [root@boldtsamqa ~]# pvresize --setphysicalvolumesize 8GB /dev/xvda2 > WARNING: /dev/xvda2: Overriding real size. You could lose data. > Physical volume "/dev/xvda2" changed > 1 physical volume(s) resized / 0 physical volume(s) not resized > > [root@boldtsamqa ~]# lvextend -L+3G /dev/VolGroup00/LogVol00 > Extending logical volume LogVol00 to 6.84 GB > device-mapper: table: device 202:2 too small for target > device-mapper: table: 253:0: linear: dm-linear: Device lookup failed > device-mapper: ioctl: error adding target to table > device-mapper: reload ioctl failed: Invalid argument > Failed to suspend LogVol00 > > Any ideas? > > Thanks all for your help > > > On Thu, Mar 6, 2008 at 4:28 PM, Javier Guerra <javier@guerrag.com> wrote: > > > On Thu, Mar 6, 2008 at 1:18 PM, Martin Fernandez > > <martingfernandez@gmail.com> wrote: > > > I resized the file disk using: > > > dd if=/dev/zero of=image bs=1M conv=notrunc count=1 seek=10240 > > > But when I boot up my VM I can''t see the new space > > > > what does /proc/partitions say? the old size? > > > > if it''s the new size, then you need to do a pvresize so that the LVM > > system gets it. > > > > if it''s the old size, something''s fishy... > > > > -- > > Javier > > > >_______________________________________________ Xen-users mailing list Xen-users@lists.xensource.com http://lists.xensource.com/xen-users