[CentOS] Linux Software RAID 1 - Unequal Sized Hard Disks

Thu Oct 18 17:32:36 UTC 2012
Scott Silva <ssilva at sgvwater.com>

on 10/18/2012 9:53 AM Manish Kathuria spake the following:
> On Thu, Oct 18, 2012 at 9:02 PM, Reindl Harald <h.reindl at thelounge.net> wrote:
>> Am 18.10.2012 17:29, schrieb Manish Kathuria:
>>> Has anyone created or rebuilt a Linux Software RAID having mirrored
>>> partitions on unequal sized hard disks ? There is  a CentOS 5 server
>>> having two 400 GB hard disks with five mirrored partitions (software
>>> RAID 1) and one of the hard disks is dying. Since new 400 GB HDDs are
>>> not available here, we are exploring the possibility of replacing the
>>> faulty hard disk with one of a higher capacity (500 GB or more). And
>>> once it is fully replicated, we plan to replace the other 400 GB HDD
>>> also with another hard disk of the same higher capacity.
>>> Just want to know if anyone has done something similar and what are
>>> the chances of success (or data loss) ?
>> no problem at all
>> * remove the disk
>> * dd if=/dev/one-of-the-living/ of=/dev/new-disk/ bs=512 count=1
>> * reboot or bring the kernel to re-read the partition table
>> * rebuild the raid
>> the dd-trick is intented to clone the complete partition table and
>> MBR to the new disk and the additional space is untouched
>> linux-software raid has no problem with different disk-sizes
>> only the used partitions must be equal
> Thanks Reindl, copying the first sector using is the simplest and
> foolproof way of ensuring that the exact partition table is cloned but
> would it also include the logical partitions ? In our case we have 5
> partitions, two of which are logical ones.
> --
> Manish
I always used this snip;
sfdisk -d /dev/olddisk | sfdisk /dev/newdisk
Obviously olddisk and newdisk are placeholders, but you know how those legal
disclaimers are...