LVM: How do I merge fragmented LVM PE Segments/Ranges that were fragmented during pvmove operations?

29 Views Asked by At

I have 2 HDDs with 18TB & 8TB combined as an LV (Logical Volume) under a VG (Volume Group).. I initially had another 1TB which I recently removed/reduced from this VG and while reducing, I used multiple pvmove operations to move parts of data at a time to the bigger 18TB drive until I moved them all..

user@server:~$ sudo pvs
  PV         VG  Fmt  Attr PSize  PFree
  /dev/sda1  vg1 lvm2 a--  16.37t 6.13t
  /dev/sdb1  vg1 lvm2 a--  <7.28t 1.14t

Now, I see that those multiple pvmove operations created fragments or multiple PE ranges in the bigger drive as seen below.. Although it hasn't caused me any performance issues so far, I would like to merge these fragments to just have 2 PE ranges as before (1 range on the 8TB and the other on the 18TB)..

Does anyone know if this is possible and if so, how do I do it? I should be okay with a logical move around tricks with data too, if any..

user@server:~$ sudo lvs --segments -o +pe_ranges
  LV   VG  Attr       #Str Type   SSize   PE Ranges
  lv1  vg1 -wi-ao----    1 linear 781.25g /dev/sda1:4053109-4253109
  lv1  vg1 -wi-ao----    1 linear 390.62g /dev/sda1:2145389-2245388
  lv1  vg1 -wi-ao----    1 linear   6.13t /dev/sdb1:300001-1907719
  lv1  vg1 -wi-ao----    1 linear 390.62g /dev/sda1:3814643-3914642
  lv1  vg1 -wi-ao----    1 linear   4.00m /dev/sda1:4014643-4014643
  lv1  vg1 -wi-ao----    1 linear 390.62g /dev/sda1:3914643-4014642
  lv1  vg1 -wi-ao----    1 linear 150.25g /dev/sda1:4014644-4053108
  lv1  vg1 -wi-ao----    1 linear   8.18t /dev/sda1:0-2145388

Any suggestions appreciated.. I am concerned that future pvmoves would cause larger PE range fragments that just appears like a mess..

0

There are 0 best solutions below