-   Linux - Newbie (
-   -   Anyone has experience running parted on raid device with LVM ? (

jkl555 03-28-2011 08:53 AM

Anyone has experience running parted on raid device with LVM ?
I read the parted documentation and it suggests it should work. I would like to know if anyone has such experience.

I have 2 identical disks, /dev/sda and /dev/sdb. I have a raid-2 configuration (/dev/md0) on /dev/sda3 and /dev/sdb3 partitions. On top of /dev/md0, I am running LVM.

There are also partitions sda4 and sdb4 following sda3 and sdb3 respectively but the data in there are not important. What I want to do is delete the sda4 and sdb4 partitions and extend sda3 and sdb3 to the end of disk, and grow the md0 and the volume group of course *without* loss of data.

Anyone has tried this before and share with me your experience ?

Thanks in advance.

tommylovell 03-28-2011 09:25 AM

Your best option would be to turn sda4 and sdb4 into a second RAID1 array (probably /dev/md1); 'pvcreate' that new md array; 'vgextend' the Volume Group that you already have on /dev/md0 with your new md device; and you are done.

Doing what you originally suggested is not possible to do "in place". It would involve changing the partition info in the MBR to extend out the sda3/sdb3 partitions; move and alter the md raid metadata that is on the end of the current sda/sdb3 partitions; and then alter all of the LVM metadata to reflect the new physical extents that have been added. The tools are just not built to do that.

To do it "not in place" you would need "swing space" (another volume that could hold your /dev/md0 data). You'd need to add that space to LVM with a 'pvcreate'; 'vgextend' your volume group; 'pvmove' the data to the new volume; 'vgreduce' to remove /dev/md0; 'pvremove /dev/md0'; destroy the md0 array; fdisk the sda and sdb disks to create the larger partition; turn sda3/sdb3 into a RAID1 array once again; 'pvcreate' the new larger RAID array; 'vgextend' adding in the new array; 'pvmove' the data back to it; go through the steps to remove your "swing space". More effort than I'd ever want to expend.

I'd go with option 1.

jkl555 03-28-2011 08:09 PM

Thank you. I understand your approach to add a new PV by simply converting sda4/sdb4 into a new raid device. Originally I thought it will be as simple as deleting the partition(s) and let parted take care of the rest. It sounds like it can't be done.

tommylovell 03-28-2011 09:09 PM

You're welcome.

'parted' can resize a partition and resize the filesystem (or swap) installed directly within it. But unfortunately it can't do a RAID array and I don't think it knows about LVM either. Maybe someday.

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