Building software RAID mdmad adding a second disk

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Quoting israel.garcia@xxxxxxxxxxxx:

> How can I build a RAID 1 of all my particions of sda using mdadm?

1. Boot into rescue mode.

2. Shrink each file system a bit.  Generally you'll use resize2fs 
utility.  MD uses some space at the end of partition for its metadata, 
and you don't want this to overwrite the end of your filesystem.  Most 
HOWTOs on the net list this as one of the last steps (after mirrors are 
created).  However if you do this as last step, in rare cases it may 
lead to data loss.  You probably want to be on the safe side and shrink 
file systems first (this will insure your data is secure).  I'm not 
sure by how much you need to shrink, should be somewhere in 
documentation how many sectors at end of partition MD uses for 
metadata...

3. Create mirror(s) using mdadm.  Create using only one real partition 
and use "missing" instead of second partition (wish Anaconda installer 
would allow for something like this).  Then use mdadm to add second 
partition to the mirror.  Something like:

# mdadm --create /dev/md0 --run --level=1 --raid-devices=2 /dev/sda1 missing
# mdadm /dev/md0 -a /dev/sdb1

4. Edit /etc/fstab file.

5. You'll need to rebuild initrd image(s) for installed kernel(s).  
Just mount your filesystems somewhere, chroot into it and run mkinitrd. 
  Mkinitrd should be smart enough to figure it'll need md device 
drivers by looking into fstab file.  Use -v option to mkinitrd to make 
sure it included needed drivers into new initrd image.

6. Configure boot loader (LILO or Grub, whicever you use) to reflect 
changes.  Make sure you install boot loader into MBR of both drives.

-- 
See Ya' later, alligator!
http://www.8-P.ca/


[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux