[CentOS] Reorg of a RAID/LVM system

Fri Mar 1 04:14:40 UTC 2013
Harold Pritchett <harold at uga.edu>

I have a system with 4 disk drives, two 512 Gb and two 1 Tb.
It look like this:

CentOS release 5.9 (Final)

Disk /dev/sda: 500.1 GB, 500107862016 bytes
Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
Disk /dev/sdc: 500.1 GB, 500107862016 bytes
Disk /dev/sdd: 1000.2 GB, 1000204886016 bytes
=================================================================

Disk /dev/sda: 500.1 GB, 500107862016 bytes
16 heads, 63 sectors/track, 969021 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes

    Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        1985     1000408+  fd  Linux raid autodetect
/dev/sda2            1986        9923     4000752   82  Linux swap / Solaris
/dev/sda3            9924      969021   483385392   fd  Linux raid autodetect

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

    Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1         125     1004031   fd  Linux raid autodetect
/dev/sdb2             126         624     4008217+  82  Linux swap / Solaris
/dev/sdb3             625      121601   971747752+  fd  Linux raid autodetect

Disk /dev/sdc: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

    Device Boot      Start         End      Blocks   Id  System
/dev/sdc1   *           1         125     1004031   fd  Linux raid autodetect
/dev/sdc2             126        4096    31897057+  82  Linux swap / Solaris
/dev/sdc3            4097       60801   455482912+  fd  Linux raid autodetect

Disk /dev/sdd: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

    Device Boot      Start         End      Blocks   Id  System
/dev/sdd1   *           1         125     1004031   fd  Linux raid autodetect
/dev/sdd2             126         624     4008217+  82  Linux swap / Solaris
/dev/sdd3             625      121601   971747752+  fd  Linux raid autodetect

The four 1 GB partitions (sd[abcd]1) are configured as a RAID 1 array with a single ext4
filesystem mounted as /boot.

Swap is Swap...

the two smaller drives (sd[ac]3) partitions are configured as a RAID 1 array containing an LVM
physical volume (md1).  the two larger drives (sd[bd]3) are configured as a RAID 1 array
containing an LVM physical volume (md2).


# pvdisplay
   --- Physical volume ---
   PV Name               /dev/md1
   VG Name               vg0
   PV Size               434.38 GB / not usable 7.44 MB
   Allocatable           yes
   PE Size (KByte)       32768
   Total PE              13900
   Free PE               7810
   Allocated PE          6090
   PV UUID               z5QGpO-6bKP-k8xm-vUha-CWYj-dkjG-UaHAE5

   --- Physical volume ---
   PV Name               /dev/md2
   VG Name               vg0
   PV Size               926.73 GB / not usable 12.31 MB
   Allocatable           yes (but full)
   PE Size (KByte)       32768
   Total PE              29655
   Free PE               0
   Allocated PE          29655
   PV UUID               RIliNF-SENU-O2S9-Qo4H-rtOC-2Yzr-7jzuB0

The two physical volumes are defined as a single volume group.

# vgdisplay
   --- Volume group ---
   VG Name               vg0
   System ID
   Format                lvm2
   Metadata Areas        2
   Metadata Sequence No  17
   VG Access             read/write
   VG Status             resizable
   MAX LV                0
   Cur LV                10
   Open LV               10
   Max PV                0
   Cur PV                2
   Act PV                2
   VG Size               1.33 TB
   PE Size               32.00 MB
   Total PE              43555
   Alloc PE / Size       35745 / 1.09 TB
   Free  PE / Size       7810 / 244.06 GB
   VG UUID dKKD3L-pcHy-F8KQ-6qNX-vFye-tXdv-6Qs98W

One of the 512 Gb drives is failing.  What I want to do is to replace the
two 512 Gb drives with 3 Tb drives, expand the RAID array on them and then
expand the LVM PV contained therein.  This much I can do.

I then want to move all of the date from the other PV into this one, and remove
the second PV, RAID array, and the two 1 Tb drives, leaving me with two 3 Tb
drves, a large RAID array and a single PV containing everything (except the /boot
and SWAP partitions.)

What I'm not sure about is how to move the date from the second PV to the
first so I can then delete the contents of the drive and physically remove them
from the system leaving me with only the two 3 Tb drives.

Help!

Thanks

Harold