<div class="markdown-here-wrapper" id="markdown-here-wrapper-211533" style="font-size:1em;font-family:Helvetica,arial,freesans,clean,sans-serif;color:rgb(34,34,34);background-color:rgb(255,255,255);border:none;line-height:1.2">
<p style="margin:1em 0px">Understood.
</p>
<p style="margin:1em 0px">Another question. If the vm treat the vol-0 as a normal block device, is it necessary to partition? If not, the fdisk will show <code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:nowrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;display:inline">Disk /dev/vdb doesn't contain a valid partition table</code>. If yes, how can I extend the volume on the vm? It seems that treat the volume as a normal block device is not a good idea. </p>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Nov 27, 2012 at 4:52 AM, Dean Troyer <span dir="ltr"><<a href="mailto:dtroyer@gmail.com" target="_blank">dtroyer@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Mon, Nov 26, 2012 at 6:51 AM, Lei Zhang <<a href="mailto:zhang.lei.fly@gmail.com">zhang.lei.fly@gmail.com</a>> wrote:<br>
> I creat a lvm named vol-0 and attach it to the machine com-0. After a period<br>
> of time, the vol-0 is full and I want to extend it. At now, I have two<br>
> solutions.<br>
<br>
</div>Nested LVM gets tricky so I want to be sure I am clear on your setup:<br>
<br>
* Your host has a logical volume (LV) 'vol-0' that is attached to a VM<br>
named 'com-0'.<br>
* com-0 uses the attached logical volume (vol-0 on the host) as a<br>
physical volume (PV) for its own LVM configuration.<br>
<div class="im"><br>
> Because the vol-0 is manage by the LVM on the hoster. So I can extend the<br>
> size of it by using lvextend. But I meet that the vm(com-0) can not be aware<br>
> this. Should I make some extrac operations like reseize2fs? I have no ideas.<br>
<br>
</div>If vol-0 is used directly as a block device with a filesystem on it<br>
(older Xen installs often did this) then a resize2fs is sufficient to<br>
recognize the additional space. It appears this is _not_ your<br>
configuration, correct?<br>
<br>
If vol-0 is used as a PV in com-0 then you can run pvresize inside<br>
com-0 and have com-0's LVM recognize the additional space.<br>
<div class="im"><br>
> In the vm (com-0), I can treat the vol-0 as a normal block device and create<br>
> lvm on it. When need more space, the hoster can "plug" a new lvm<br>
> device(vol-1) on it. In the vm, I can add it to the lvm. But I found another<br>
<br>
</div>Correct, this is another way to increase the space available to<br>
cpm-0's volume groups.<br>
<div class="im"><br>
> problem. Because the vol-* is not real block device, when I create lvm on<br>
> it, the hoster is aware of it. The result is that on the hoster, another PV<br>
> is created base on a lvm partition like bellow. I want to know, it is<br>
> acceptable?<br>
<br>
</div>To fix this you need to adjust the filter on your host's<br>
/etc/lvm/lvm.conf. You can either reject any physical volumes found<br>
for VMs:<br>
<br>
filter = ["r|/dev/cinder-volumes/.*", "a/.*/"] # reject cinder<br>
devices, alow everything else<br>
<br>
or you can only look at particular divice files for physical devices:<br>
<br>
filter = ["a/dev/sd.*"] # look only at SCSI disks for physical devices<br>
<br>
That last one will likely need adjusting for your local block device names.<br>
<span class="HOEnZb"><font color="#888888"><br>
dt<br>
<br>
--<br>
<br>
Dean Troyer<br>
<a href="mailto:dtroyer@gmail.com">dtroyer@gmail.com</a><br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br><div><span style="font-family:arial,sans-serif;font-size:13px;border-collapse:collapse">Lei Zhang</span></div><div><span style="font-family:arial,sans-serif;font-size:13px;border-collapse:collapse"><br>
</span></div><div><font face="arial, sans-serif">Blog: <a href="http://jeffrey4l.github.com" target="_blank">http://jeffrey4l.github.com</a></font></div><div>twitter/weibo: @jeffrey4l</div><br>
</div>