[CentOS] CentOS 4 Software Raid1 questions

Aleksandar Milivojevic amilivojevic at pbl.ca
Wed Apr 27 15:44:09 UTC 2005


Lee Parmeter wrote:
> I want to mirror an existing 40GB data only drive using
> software Raid1 on my new CentOS 4 server. The existing
> drive is connected to a Promise Ultra 100 TX2 controller
> (non-raid). I have read about mdadm and understand how to
> create the Raid1 on /dev/mdxx devices. However I would like
> to know if the existing data on the orignal 40GB drive in
> the system will be destroyed when I create the raid with
> mdadm. Also do the 2 drives after being setup with mdadm
> have to be reformated? Both the 40GB drives are now
> formated with ext3. If not, will the added 40GB drive
> assigned to the Raid1 atomaticly sync to the original 40GB
> drive. If so, what do I need to do to assure this will
> happend automaticly? Your comments are appreciated, as this
> is my first time to setup a software Raid1. 

You'd need to resize file systems after you import partitions into MD. 
An e2fsck/resize2fs would take care of that.  Do an "fsck -f /dev/md0" 
(for example).  It will complain that information in superblock is wrong 
(partition size fsck sees is smaller than what it found in superblock). 
  Just answer "no" to abort question.  After you did fsck, you need to 
do "resize2fs /dev/md0".  Repeat for all md devices you created.

For above, the file systems should be either unmounted, or mounted read 
only.  The best thing to do is to boot from CD into rescue mode, and do 
all job from it.

The reason is that MD uses couple of last blocks for metadata 
information, and that space is no longer usable for file system data. 
So your /dev/md* metadisks will be slightly smaller than partitions you 
created them on.

When you are creating mirrors, make sure you list devices in right 
order.  Data is always copied from first disk you specify to second 
disk.  If you get them the wrong way around, you loose data.

There are some rather good HOWTOs on this question (with much longer, 
detailed and better descriptions of migration process).  Use the Google 
Luke.

-- 
Aleksandar Milivojevic <amilivojevic at pbl.ca>    Pollard Banknote Limited
Systems Administrator                           1499 Buffalo Place
Tel: (204) 474-2323 ext 276                     Winnipeg, MB  R3T 1L7



More information about the CentOS mailing list