4

I've just read "How can you re-allocate space from one Volume Group to another Volume Group in Linux?" How can you re-allocate space from one Volume Group to another Volume Group in Linux? But I'm still confused.

I have inherited the managemnt of a linux NAS built with a 16 disk supermicro case, a 3ware 9650 RAID card and Centos 5. There are three 2.73 TB raid units created by the 3ware board; auto-carving to 1.5TB is enabled so Centos sees six physical volumes.

Those 6 PVs are arranged in 2 volume groups and one of the VGs (volgroup1) has 2.15TB of free space. I need to move those free 2.15TB to the other VG (volgroup2) Then I need to assign those 2.15TB the ext3 partition on logical volume "mmedia0", without disruption of any other LV/filesystem.

The output of the relevant LVM commands follws.

Thanks in advance Guido


[root@lt-nas1 ~]# pvscan
  PV /dev/sdd1   VG volgroup2   lvm2 [1.50 TB / 0    free]
  PV /dev/sdf1   VG volgroup2   lvm2 [1.50 TB / 0    free]
  PV /dev/sdg1   VG volgroup2   lvm2 [1.23 TB / 0    free]
  PV /dev/sdb1   VG volgroup1   lvm2 [1.50 TB / 1.00 TB free]
  PV /dev/sdc1   VG volgroup1   lvm2 [1.22 TB / 24.00 GB free]
  PV /dev/sde1   VG volgroup1   lvm2 [1.23 TB / 1.12 TB free]
  Total: 6 [8.18 TB] / in use: 6 [8.18 TB] / in no VG: 0 [0   ]

[root@lt-nas1 ~]# vgs
  VG        #PV #LV #SN Attr   VSize VFree
  volgroup1   3   5   0 wz--n- 3.95T 2.15T
  volgroup2   3   3   0 wz--n- 4.23T    0

[root@lt-nas1 ~]# lvs
  LV               VG        Attr   LSize    Origin Snap%  Move Log Copy%  Convert
  cli-bak          volgroup1 -wi-ao  515.88G
  fatt-dig         volgroup1 -wi-ao   10.00G
  fil-ut           volgroup1 -wi-ao  220.00G
  homes            volgroup1 -wi-ao  100.00G
  serv-bak         volgroup1 -wi-ao 1000.00G
  esxp-bak         volgroup2 -wi-ao    3.73T
  lt-services      volgroup2 -wi-ao   10.00G
  mmedia0          volgroup2 -wi-ao  501.97G


[root@lt-nas1 ~]# pvdisplay -m
  --- Physical volume ---
  PV Name               /dev/sdd1
  VG Name               volgroup2
  PV Size               1.50 TB / not usable 31.88 MB
  Allocatable           yes (but full)
  PE Size (KByte)       32768
  Total PE              49151
  Free PE               0
  Allocated PE          49151
  PV UUID               dj86xG-bVvy-e2KS-dxCb-oDTB-vqfB-oIFEFn

  --- Physical Segments ---
  Physical extent 0 to 32767:
    Logical volume      /dev/volgroup2/esxp-bak
    Logical extents     89404 to 122171
  Physical extent 32768 to 33087:
    Logical volume      /dev/volgroup2/lt-services
    Logical extents     0 to 319
  Physical extent 33088 to 49150:
    Logical volume      /dev/volgroup2/mmedia0
    Logical extents     0 to 16062

  --- Physical volume ---
  PV Name               /dev/sdf1
  VG Name               volgroup2
  PV Size               1.50 TB / not usable 29.98 MB
  Allocatable           yes (but full)
  PE Size (KByte)       32768
  Total PE              49151
  Free PE               0
  Allocated PE          49151
  PV UUID               VzrYLh-qzGP-JlfN-WtUn-39Li-mq4Z-M4AlkY

  --- Physical Segments ---
  Physical extent 0 to 49150:
    Logical volume      /dev/volgroup2/esxp-bak
    Logical extents     0 to 49150

  --- Physical volume ---
  PV Name               /dev/sdg1
  VG Name               volgroup2
  PV Size               1.23 TB / not usable 27.98 MB
  Allocatable           yes (but full)
  PE Size (KByte)       32768
  Total PE              40253
  Free PE               0
  Allocated PE          40253
  PV UUID               w2AczV-NUC1-K6xj-Qom6-NsNb-0mXk-o9a63M

  --- Physical Segments ---
  Physical extent 0 to 40252:
    Logical volume      /dev/volgroup2/esxp-bak
    Logical extents     49151 to 89403

  --- Physical volume ---
  PV Name               /dev/sdb1
  VG Name               volgroup1
  PV Size               1.50 TB / not usable 31.88 MB
  Allocatable           yes
  PE Size (KByte)       32768
  Total PE              49151
  Free PE               32832
  Allocated PE          16319
  PV UUID               Kilk0G-0qxl-ft2w-8iU7-abaa-u1n2-d9EHiO

  --- Physical Segments ---
  Physical extent 0 to 32767:
    FREE
  Physical extent 32768 to 39167:
    Logical volume      /dev/volgroup1/fil-ut
    Logical extents     0 to 6399
  Physical extent 39168 to 39231:
    FREE
  Physical extent 39232 to 39871:
    Logical volume      /dev/volgroup1/fil-ut
    Logical extents     6400 to 7039
  Physical extent 39872 to 49150:
    Logical volume      /dev/volgroup1/cli-bak
    Logical extents     0 to 9278

  --- Physical volume ---
  PV Name               /dev/sdc1
  VG Name               volgroup1
  PV Size               1.22 TB / not usable 16.80 MB
  Allocatable           yes
  PE Size (KByte)       32768
  Total PE              39997
  Free PE               768
  Allocated PE          39229
  PV UUID               EAtHL7-wraU-DdRP-d9Fq-xdrU-Wyf0-8PlCqj

  --- Physical Segments ---
  Physical extent 0 to 31999:
    Logical volume      /dev/volgroup1/serv-bak
    Logical extents     0 to 31999
  Physical extent 32000 to 32767:
    FREE
  Physical extent 32768 to 39996:
    Logical volume      /dev/volgroup1/cli-bak
    Logical extents     9279 to 16507

  --- Physical volume ---
  PV Name               /dev/sde1
  VG Name               volgroup1
  PV Size               1.23 TB / not usable 14.18 MB
  Allocatable           yes
  PE Size (KByte)       32768
  Total PE              40253
  Free PE               36733
  Allocated PE          3520
  PV UUID               I1RUAu-P8Sw-waPF-b8u1-0szV-lR9D-hY1DvA

  --- Physical Segments ---
  Physical extent 0 to 32767:
    FREE
  Physical extent 32768 to 33087:
    Logical volume      /dev/volgroup1/fatt-dig
    Logical extents     0 to 319
  Physical extent 33088 to 33887:
    FREE
  Physical extent 33888 to 37087:
    Logical volume      /dev/volgroup1/homes
    Logical extents     0 to 3199
  Physical extent 37088 to 40252:
    FREE
1
  • What is it that confuses you? Oct 19, 2015 at 13:37

1 Answer 1

1

Since you can only move an entire PV from one VG to another, it is not going to be possible to move all free space from one VG to the other. But you can get there part of the way:

First, move all data on one of your PVs to some other PV:

pvmove -v /dev/sdb1

This will start moving the data to the other PVs, away from sdb1. The -v option will also ensure that you see some progress information. Once the move has finished, you can remove it from the volume group:

vgreduce -a

This will report something along the lines of removing /dev/sdb1 from volgroup1 (sorry, it's been a while, and I don't have a machine to test on). You can then add that to the other VG:

vgextend volgroup2 /dev/sdb1

After that, volgroup2 should have the space on sdb1 added to it.

You may be able to repeat this operation with sde1; depends on the amount of free space left in volgroup1 after the first move (I'm too lazy to make the necessary calculations ;-). I would also recommend moving all your data into a single volume group; however, doing that will require you to create a new LV in volgroup2, create a filesystem on it, mount it, use rsync or similar to move the date over, and then destroy the old one. Clearly, this is a more risky operation.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .