How To Install Ubuntu 8.04 With Software RAID1
How To Install Ubuntu 8.04 With Software RAID1This short guide explains how you can configure software RAID1 during the initial installation of an Ubuntu 8.04 ("Hardy Heron") system.
During Ubuntu installation:
Next configure device md0 to be mounted as the “/” filesystem and device md1 to be mounted as swap:
Making every drive bootableBoot your freshly installed Ubuntu and do the following : grub device (hd1) /dev/sdb root (hd1,0) setup (hd1) quit
Adding second HD to grubvi /boot/grub/menu.lst Add something like this : ### To boot if sda fails ### title Ubuntu 8.04.1, kernel 2.6.24-19-generic /dev/sda fail root (hd1,0) kernel /boot/vmlinuz-2.6.24-19-generic root=/dev/md0 ro quiet splash initrd /boot/initrd.img-2.6.24-19-generic ### End mod ### Replace kernel and initrd filename if necessary. Reboot and try if Ubuntu boot on the second hard drive.
Care and feedingHaving two drives configured in a RAID1 mirror allows the server to continue to function when either drive fails. When a drive fails completely, the kernel RAID driver automatically removes it from the array. However, a drive may start having seek errors without failing completely. In that situation the RAID driver may not remove it from service and performance will degrade. Luckily you can manually remove a failing drive using the “mdadm” command. For example, to manually mark both of the RAID devices on drive sda as failed: mdadm /dev/md0 –-fail /dev/sda1 The above removes both RAID devices on drive sda from service, leaving only the partitions on drive sdb active.
Removing a failed driveWhen a drive fails it is vital to act immediately. RAID drives have an eerie habit of all failing around the same time, especially when they are identical models purchased together and put into service at the same time. Even drives from different manufacturers sometimes fail at nearly the same time… probably because they all experience the same environmental factors (power events, same number of power downs, the same janitor banging the vacuum into the server every night, etc.) When Ubuntu sees that RAID has been configured, it automatically runs the mdadm command in “monitor mode” to watch each device and send email to root when a problem is noticed. You can also manually inspect RAID status using commands like the following: cat /proc/mdstat It’s also wise to use “smartctl” to monitor each drive’s internal failure stats. However as noted in a recent analysis by Google (PDF link), drives are perfectly capable to dying without any warning showing in their SMART monitors. To replace a drive that has been marked as failed (either automatically or by using “mdadm –fail”), first remove all partitions on that drive from the array. For example to remove all partitions from drive sda: mdadm –-remove /dev/md0 /dev/sda1 Once removed it is safe to power down the server and replace the failed drive.
Preparing the new driveOnce system as been rebooted with the new unformatted replacement drive in place, some manual intervention is required to partition the drive and add it to the RAID array. The new drive must have an identical (or nearly identical) partition table to the other. You can use fdisk to manually create a partition table on the new drive identical to the table of the other, or if both drives are identical you can use the “sfdisk” command to duplicate the partition. For example, to copy the partition table from the second drive “sdb” onto the first drive “sda”, the sfdisk command is as follows: sfdisk -–d /dev/sdb | sfdisk /dev/sda Warning: be careful to specify the right source and destinations drives when using sfdisk or your could blank out the partition table on your good drive. Once the partitions have been created, you can add them to the corresponding RAID devices using “mdadm –add” commands. For example: mdadm -–add /dev/md0 /dev/sda1 Once added, the Linux kernel immediately starts re-syncing contents of the arrays onto the new drive. You can monitor progress via “cat /proc/mdstat”. Syncing uses idle CPU cycles to avoid overloading a production system, so performance should not be affected too badly. The busier the server (and larger the partitions), the longer the re-sync will take. Note that you don’t have to wait until all partitions are re-synced… servers can be on-line and in production while syncing is in progress: no data will be lost and eventually all drives will become synchronized.
Creating a new array under Linux with free spaceFirst use fdisk to create a partition on both hard drive in the remaining space (exact space). You must make sure the filesystem is set to Raid (code fd). Then do something like : sudo mdadm --create --verbose /dev/md3 --level=1 --raid-devices=2 /dev/sda5 /dev/sdb5
SummaryLinux software RAID is far more cost effective and flexible than hardware RAID, though it is more complex and requires manual intervention when replacing drives. In most situations, software RAID performance is as good (and often better) than an equivalent hardware RAID solution, all at a lower cost and with greater flexibility. When all you need are mirrored drives, software RAID is often the best choice.
|






Recent comments
12 hours 17 min ago
14 hours 8 min ago
19 hours 25 min ago
19 hours 32 min ago
21 hours 2 min ago
21 hours 19 min ago
22 hours 38 min ago
1 day 33 min ago
1 day 1 hour ago
1 day 4 hours ago