Install new hard drives with Software RAID 1
Thursday, June 16th, 2005This turned out to be pretty straightforward once I got the order of steps right. Don’t make the filesystems before the mkraid, you will end up with “bad superblock†errors later.
I added two 400Gb SATA hard drives in RAID1 to an existing system. I already had one pair of drives in RAID 1, the new drives form a new RAID array.
1) Phyiscally add the drives.
2) Run fdisk, make one partition on each drive.
fdisk /dev/hdc
fdisk /dev/hdd
3) Edit /etc/raidtab, add section for /dev/md1:
raiddev /dev/md1
raid-level 1
nr-raid-disks 2
chunk-size 256
persistent-superblock 1
nr-spare-disks 0
device /dev/sdc1
raid-disk 0
device /dev/sdd1
raid-disk 1
4) Make RAID, needed ‘force’ flag:
mkraid -f /dev/md1
mkraid -R /dev/md1
5) Make filesystems:
mke2fs -j /dev/sdc1
mke2fs -j /dev/sdd1
This takes 10 min or so.
6) Add new filesystem to /etc/fstab for automounting:
/dev/md1 /home ext3 defaults 1 2
And now the keychain drive gets pushed from sdc to sde:
/udev/sde1 /mnt/key vfat owner,kudzu 0 0
7) Mount new RAID:
mkdir /data
mount /data
Useful RAID commands:
more /proc/mdstat
mdadm -D /dev/md1
Useful guide:
Software-RAID-HOWTO