OK,
All the command line stuff - assuming the new drives are /dev/sdb and /dev/sdc - check and make a note of the drives you want to work on. Double check this - you don't want to do anything with your OS disk!!!
All done as root (sudo -i) ...
1) Use fdisk to delete the new partitions as we need them setup differently - for each drive:
fdisk /dev/sdx (eg: fdisk /dev/sdb)
- d (delete) the current partition - follow the prompts
- n (new partition) and create a primary partition the full size of the drive
- t (type) and set the partition type to fd (linux raid autodetect)
- w (write) your changes and exit
fdisk help here: http://tldp.org/HOWTO/Partition/fdisk_partitioning.html
2) Create your new RAID array - we'll assume /dev/md0 (the first RAID array)
mdadm --create /dev/md0 --chunk=128 --level=1 --raid-devices=2 /dev/sdb1 /dev/sdc1
3) Format your new array:
mkfs -t ext3 /dev/md0
(or use ext4 if you want)
4) You need to create /etc/mdadm/mdadm.conf or your array disappears when you restart the server!
echo "DEVICE partitions" > /etc/mdadm/mdadm.conf
mdadm --detail --scan >> /etc/mdadm/mdadm.conf
Once you have created this file, view/edit it to make sure that the 'DEVICE partitions' wording is on a line of its own. If the array doesn't start up automatically on reboot, see the more comprehensive .conf file at the end of this answer.
5) Make sure the mount target folder exists:
mkdir /home/myname/files/
6) Add mount to /etc/fstab - add this line at the end
/dev/md0 /home/myname/files auto defaults 0 0
You can check that your new RAID array is running and doing its first time sync with this command:
cat /proc/mdstat
EDIT:
Further to the array disappearing on reboot - try the following madam.conf, which includes the line you posted for your array:
# mdadm.conf
#
# Please refer to mdadm.conf(5) for information about this file.
#
# by default, scan all partitions (/proc/partitions) for MD superblocks.
# alternatively, specify devices to scan, using wildcards if desired.
DEVICE partitions
# auto-create devices with Debian standard permissions
CREATE owner=root group=disk mode=0660 auto=yes
# automatically tag new arrays as belonging to the local system
HOMEHOST <system>
# instruct the monitoring daemon where to send mail alerts
MAILADDR root
# definitions of existing MD arrays
ARRAY /dev/md0 level=raid1 num-devices=2 metadata=00.90 UUID=4fd3b193:c6c09dea:46ed9f91:db68f1c3
Best Answer
By default,
/etc/mdadm/mdadm.conf
contains the lineI can confirm that on Ubuntu 8.04, this does result in mail being sent to root when the array is degraded (and I don't see why this would work differently in other releases).
The problem is that the mail is sent to root, and Ubuntu doesn't seem to have set up anything so that administrator users would read root's mail. It used to; I see that on a machine whose initial installation was Ubuntu 4.10,
/etc/aliases
containswhich does result in root's mail being redirected to my local mailbox, which I do read.
Maybe Ubuntu stopped setting up
/etc/aliases
because most people aren't even aware that there is such a thing as local mailboxes. But it would be a good idea for Ubuntu to arrange that administrators receive root's mail somehow. Maybe you could make a feature request (or add your voice to an existing one, I haven't looked). (Strictly speaking, it's a regression from warty!)