I have an ubuntu 12.04 setup with two HDD that is setup in a software raid 1. Now I need to add two additional SSD drives for separate storage of some database files. They need to be setup in their own separate raid 1 array. Unfortunately I have no idea where and how to start? So from the beginning after having plugged the two drives in, and booted the server - then what?
Okay i got it:
1) First list all drives:
sudo lshw -c storage -c disk
and note down the drives that needs to be put into a new raid array (in my case /dev/sda and /dev/sdb)
1.1) If you need to find out what drives are already in a raid this can be done with
sudo cat /etc/mdadm/mdadm.conf details about which drives they cover can be inspected with
sudo mdadm --query --detail /dev/md0 where /dev/md0 is the array you want to inspect.
2) Now use fdisk to format the drives and create partitions for each drive:
sudo fdisk /dev/sda this is done for each drive (and they should of cause be setup equally)
- If the disk is not "clean" then press
dand follow instructions to delete the current partitions (note all data will be lost on that disk!)
- Then press
nto create a new partition.
pfor primary and
1for one partition, and use the defaults (pressing
tfor type and set the partition type to fd (linux raid autodetect).
wfor writing your changes and exit.
3) Create the RAID array:
sudo mdadm --create /dev/md3 --chunk=128 --level=1 --raid-devices=2 /dev/sda1 /dev/sdb1
4) Format the array:
sudo mkfs -t ext4 /dev/md3
5) Lookup the infor for the new array using method in step 1.1 and edit
sudo nano /etc/mdadm/mdadm.conf accordingly with the following line for your new array
ARRAY /dev/md/3 metadata=1.2 UUID=f368e29e:b79c72bd:631ce90f:e3370f90 name=master-db:3
6) Create a directory (mount dir) for the new drive
sudo mkdir /new_device
7) Mount to fstab by editing
sudo nano /etc/fstab with
/dev/md3 /new_device auto defaults 0 0
sudo mount -a
Check that everything runs with:
sudo cat /proc/mdstat