LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   Convert to SW RAID with LVM2 on existing disk (http://www.linuxquestions.org/questions/linux-general-1/convert-to-sw-raid-with-lvm2-on-existing-disk-444072/)

atman1974 05-12-2006 05:52 AM

Convert to SW RAID with LVM2 on existing disk
 
All,

I just got a Dell 2850 workstation coming in with RHEL 4 installed. It has two identical disk, /dev/sda & /dev/sdb. The system is installed in /dev/sda, & unfortunately (or fortunately?) it has LVM2 installed already.

Now I planned to convert the system to SW RAID-1 configuration. And I planned to follow the simple way as suggested in the RedHat knowledge base, which basically uses one single command to create RAID. Please refer to kbase of redhat, FAQ_43_2812
Quote:

mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/hda3 /dev/hdc3
Then I realized that with LVM2 installed on existing disk, the situation might be not the same 'cause the PV will be in a fully different device.

Can I change the PV to the RAID device without losing the data? Or, what's the proper procedure to be taken here to accomplish the task?

I had also been thinking of a new installation of the system, which might make the life easier. But there is one concern: I'm not sure whether the RHEL4 has all the right & updated drivers for Dell 2850?

Any suggestion will be greatly appreciated.

Thanks,
Atman

For reference, I copied the output of Fdisk/lvs/pvs here.

Quote:

[root@kou etc]# fdisk -l /dev/sda

Disk /dev/sda: 146.8 GB, 146815733760 bytes
255 heads, 63 sectors/track, 17849 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 1 5 40131 de Dell Utility
/dev/sda2 6 528 4200997+ 8e Linux LVM
/dev/sda3 * 529 553 200812+ 83 Linux
/dev/sda4 554 17849 138930120 5 Extended
/dev/sda5 554 17849 138930088+ 8e Linux LVM
Quote:

[root@kou etc]# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 lvm2 -- 4.00G 4.00G
/dev/sda5 VolGroup00 lvm2 a- 132.47G 106.47G
[root@kou etc]# lvs
LV VG Attr LSize Origin Snap% Move Copy%
LogVol00 VolGroup00 -wi-ao 4.00G
LogVol01 VolGroup00 -wi-ao 2.00G
LogVol02 VolGroup00 -wi-ao 8.00G
LogVol03 VolGroup00 -wi-ao 4.00G
LogVol04 VolGroup00 -wi-ao 4.00G
LogVol05 VolGroup00 -wi-ao 4.00G

atman1974 05-14-2006 11:40 PM

I guess there is no easy way to work around here. There are two options in my humble mind.

Option A, move system/data to one part of the disk; keep it; create RAID on the unused part; move all system/data to RAID; create new RAID on the rest of the disk; steps are like following:
1. Shrink LV, then shrink LVG; -- easy
2. Shrink PV, free up unused PE; -- Doable, with risk;
3. Shrink partition size; -- Doable, with bigger risk;
4. create new partition & new RAID device; -- easy;
5. copy system/data to RAID; --easy
6. create new RAID on the old part of disk; --easy
7. create new PV and add to VG -- easy

I tried this option and stop in step 2, no further with step 3. because I found it too trouble some. So I essentially turn to the Option B, which turn out to be easy & fast.

Option B, reinstall the system. :)

Hope this experience can be helpful for those who looking for similar solutions.

Cheers,
-Atman


All times are GMT -5. The time now is 12:22 AM.