LVM

Move logical Volumes to other volume group and remove the physical volume.

At the beginning, it look like:

~# lvs
  LV         VG         Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  log        system     -wi-ao----  1.86g
  root       system     -wi-ao----  2.79g
  swap       system     -wi-ao----  1.86g
  tmp        system     -wi-ao----  1.86g
  usr        system     -wi-ao----  1.86g
  var        system     -wi-ao---- 31.72g
  testlv     systemtest -wi-------  5.00g
  testlv2    systemtest -wi------- 20.00g
~# pvs
  PV         VG         Fmt  Attr PSize   PFree
  /dev/md0   systemtest lvm2 a--  884.63g 859.63g
  /dev/sdk3  system     lvm2 a--  147.61g 105.66g

Now we begin to merge the two volume groups to one.

vgsplit -n systemtest/testlv systemtest system

Now it look like:

~# pvs
  PV         VG     Fmt  Attr PSize   PFree
  /dev/md0   system lvm2 a--  884.63g 859.63g
  /dev/sdk3  system lvm2 a--  147.61g 105.66g
~# lvs
  LV         VG         Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  log        system     -wi-ao----  1.86g
  root       system     -wi-ao----  2.79g
  swap       system     -wi-ao----  1.86g
  tmp        system     -wi-ao----  1.86g
  usr        system     -wi-ao----  1.86g
  var        system     -wi-ao---- 31.72g
  testlv     system     -wi-------  5.00g
  testlv2    system     -wi------- 20.00g

Now we want to remove md0, but before we must move the data to the other physical volume.

~# pvmove /dev/md0
  /dev/md0: Moved: 0.0%
  /dev/md0: Moved: 5.5%
  /dev/md0: Moved: 10.6%
  /dev/md0: Moved: 14.1%
  /dev/md0: Moved: 17.6%
  /dev/md0: Moved: 21.8%
  /dev/md0: Moved: 25.3%
  /dev/md0: Moved: 28.9%
  /dev/md0: Moved: 32.4%
  /dev/md0: Moved: 36.2%
  /dev/md0: Moved: 39.8%
  /dev/md0: Moved: 43.6%
  /dev/md0: Moved: 47.4%
  /dev/md0: Moved: 50.7%
  /dev/md0: Moved: 54.6%
  /dev/md0: Moved: 58.1%
  /dev/md0: Moved: 62.0%
  /dev/md0: Moved: 65.9%
  /dev/md0: Moved: 69.1%
  /dev/md0: Moved: 72.9%
  /dev/md0: Moved: 76.9%
  /dev/md0: Moved: 80.0%
  /dev/md0: Moved: 83.7%
  /dev/md0: Moved: 87.2%
  /dev/md0: Moved: 90.8%
  /dev/md0: Moved: 95.0%
  /dev/md0: Moved: 98.6%
  /dev/md0: Moved: 100.0%

Now we can remove the md0 from the system volume group.

~# vgreduce system /dev/md0
  Removed "/dev/md0" from volume group "system"

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.