Tuesday, August 28, 2012

Creating a software raid

1. format the hard drives to raid using fdisk (gdisk in fedora 17)
or with parted (for 3TB disks):

> parted /dev/sdx
        (parted) mklabel gpt
        (parted) unit TB
        (parted) mkpart primary 0 3001G
        (parted) print
        (parted) quit

2. Create the raid device (change level and devices as needed):
mdadm --create --level=1 --raid-devices=2 /dev/md0 /dev/sd[bc]1
3. format the file system of the new device:
mkfs.ext4 /dev/md0
4. create the mdadm.conf file:
mdadm --detail --scan > /etc/mdadm.conf
5. add mail alert:
echo "MAILADDR your_mail@somthing.com" >> /etc/mdadm.conf
echo "MAILFROM your_server" >> /etc/mdadm.conf
6. test mail alert:
mdadm --monitor --scan --test --oneshot
7. start mail alert deamon:
systemctl enable mdmonitor.service
systemctl start mdmonitor.service
8. edit the mail aliases file to forward root messages to your email:
vi /etc/aliases
add your mail under the line:  # Person who should get root's mail
run newaliases command
see also at:
http://www.iceteks.com/articles.php/linuxmdadmraid/

* after name change, create the /etc/mdadm.conf file and run:
sudo update-initramfs -u
or
sudo dracut -f /boot/initramfs-[current].img

No comments:

Post a Comment

Please Comment this Post or send me an Email