<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">On 7/12/18 10:15 am, G C wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAGdG7F5LY5+5EOscjuhrkO7auBcSo1=peUkRdeQTbXrFZvKjtg@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div>Not really clear to me but no
we're not using an SSD.</div>
<div><br>
</div>
<div>(I'm not an expert on LVM so bear
with me)</div>
Are you saying that I would add some
of the new PV to the existing LV so it
can be utilized and then perform a
pvmove later?
<div>If I'm using part of the new PV
as part of the LV how would I ensure
that it's not overwritten when
performing the pvmove later?</div>
<div><br>
</div>
<div>Here are my scenarios below maybe
you can add what you're thinking
into it and it will make more sense
to me.</div>
<div><br>
</div>
<div>Original Scenario:</div>
<div>DISK_1 2TB<br>
pvcreate /dev/sdd<br>
</div>
<div>vgcreate vg01 /dev/sdd<br>
</div>
<div>lvcreate -n 01lv -l 100%FREE vg01<br>
</div>
<div>Device: /dev/vg01/01lv<br>
</div>
<div># drbd setup</div>
<div>drbdadm create-md clusterdb<br>
</div>
<div>drbdadm up clusterdb<br>
</div>
<div>drbdadm primary --force clusterdb<br>
</div>
<div>mkfs.ext4 /dev/drbd0<br>
</div>
<div>mkdir /01<br>
</div>
<div>mount /dev/drbd0 /01<br>
</div>
<div><br>
</div>
<div>RESIZE (ONLINE) - really slow
currently takes over 20hours for the
migration, final outcome is that we
have only one Physical disk after
the move</div>
<div>DISK_2 3TB</div>
<div>pvcreate /dev/sde</div>
<div><span
style="color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:14px">vgextend
vg01 /dev/sde</span><br>
</div>
<div><font face="Arial, sans-serif"
color="#333333"><span
style="font-size:14px">pvmove
/dev/sdd /dev/sde</span></font><br>
</div>
<div><font face="Arial, sans-serif"
color="#333333">
<div><span style="font-size:14px">vgreduce
vg01 /dev/sdd</span></div>
<div><span style="font-size:14px">pvremove
/dev/sdd</span></div>
<div style="font-size:14px">lvextend
-l +100%FREE /dev/vg01/01lv<br>
</div>
</font></div>
<div><span
style="color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:14px">drbdadm
-- --assume-clean resize </span>clusterdb<br>
</div>
<div><span
style="color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:14px">resize2fs
/dev/drbd0</span><span
style="color:rgb(51,51,51);font-family:Arial,sans-serif;font-size:14px"><br>
</span></div>
<div><br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<p>For me, it is like this (simple case with SSD's)<br>
pvcreate /dev/sde<br>
vgextend vg01 /dev/sde<br>
lvextend -L+900G /dev/vg01/01lv<br>
drbdadm resize clusterdb<br>
</p>
<p>A somewhat simple solution to do what you want might be this
(untested, so check it on a VM or test env first):<br>
pvcreate /dev/sde<br>
vgextend vg01 /dev/sde<br>
lvcreate -n temp -l <xxx> vg01</p>
<p>Note, the size xxx is exactly equal to the size of 01lv which you
can check with lvdisplay. This will allocate the first part of sde
to a new LV called temp, it is just here to use up the space.<br>
</p>
<p>
lvextend -l+100%FREE /dev/vg01/01lv</p>
<p>Note, I don't usually use this 100%FREE method, but I assume it
will work right...<br>
</p>
<p>
drbdadm resize clusterdb<br>
</p>
<p>This effectively means your LV 01lv is split across sdd and sde,
which might improve performance, but increases risk if either disk
dies.</p>
<p>At any time, you can now lvremove /dev/vg01/temp and can then do
your pvmove which will move the first 2TB of 01lv from sdd to the
beginning of sde.</p>
<p>There is a more complicated method, but this is what I would do
if faced with your problem. I've also successfully used this
script:<br>
<a class="moz-txt-link-freetext" href="https://bisqwit.iki.fi/source/lvm2defrag.html">https://bisqwit.iki.fi/source/lvm2defrag.html</a></p>
<p>Which can assist you to ensure that the entire disk ends up
contiguous (though you would need to have at least some temporary
space, so better not to allocate 100% of the space in the step
after you create the temp LV).</p>
<p>Also, why do you allocate 100% of the space? Why not leave some
space for snapshots, or for future growth? If you had left 100G
spare, then right now you would simply lvextend to use up the last
100G, and then have some time to deal with arranging the upgrade.
Just my suggestions, but I don't understand your needs.<br>
</p>
Regards,<br>
Adam<br>
<p><br>
</p>
<div class="moz-signature">-- <br>
Adam Goryachev
Website Managers
<a class="moz-txt-link-abbreviated" href="http://www.websitemanagers.com.au">www.websitemanagers.com.au</a></div>
<div style=3D"clear: both;width:100%;"><br><span style=3D"font-family: Arial, Helvetica, sans-serif; font-size: 10px; clear: both;">--
The information in this e-mail is confidential and may be legally privileged.
It is intended solely for the addressee. Access to this e-mail by anyone else
is unauthorised. If you are not the intended recipient, any disclosure,
copying, distribution or any action taken or omitted to be taken in reliance
on it, is prohibited and may be unlawful. If you have received this message
in error, please notify us immediately. Please also destroy and delete the
message from your computer. Viruses - Any loss/damage incurred by receiving
this email is not the sender's responsibility.</span><br></div>
</body>
</html>