个人工具

UbuntuHelp:Installation/RAID1

来自Ubuntu中文

Oneleaf讨论 | 贡献2007年5月13日 (日) 11:43的版本 (New page: {{From|https://help.ubuntu.com/community/Installation/RAID1}} {{Languages|php5}} Fully installing to RAID1 is officially not supported in Warty. At least root partition should not be on RA...)

(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳转至: 导航, 搜索

Fully installing to RAID1 is officially not supported in Warty. At least root partition should not be on RAID1. However, you can install it to RAID1.

First create your partitions and make the raid1 in the partitioner. Make at least one primary partition on each disk, and put them into one RAID. Simply ignore the warning message which warns you about RAID1 install problems.

  • After it, install the base system in normal way.
  • When you get to make system bootable with grub (or LILO), open a new terminal (with pressing Alt+F2 and Enter).

On the terminal type the following:

# chroot /target /bin/bash
# mount -t proc none /proc
# vi /etc/mkinitrd/modules
</code>
add two lines:
<pre>
 raid1
 md
</code>
exit from vi.
<pre>
# dpkg-reconfigure linux-image-2.6.8.1-3-386
</code>

For installing the boot loader, install the following package <code>lilo</code> (see InstallingSoftware).

create an /etc/lilo.conf file with the following content:
<pre>
boot=/dev/hda
map=/boot/map
vga=normal
delay=20
image=/vmlinuz
        initrd=/initrd.img
        root=/dev/md0 <- choose the correct device depending on your current installation
        label=Linux
        read-only
</code>
then at the console type:
<pre>
# lilo
</code>
If everything is OK, close the console (typt Ctrl+d two times) and return to the installer (Alt+F1) 

Choose "continue without boot loader"

The system should reboot without problem. After rebooting continue installing Ubuntu as usual. After installing Ubuntu you have one more step: make the system bootable with any disk.

You need to enable Universe repository, see AddingRepositoriesHowto for details.

Install the following package: <code>mbr</code>
(I have no idea why the mbr package in universe)

<pre>
$ sudo install-mbr /dev/hda
$ sudo install-mbr /dev/hdc
</code>
(if the two raid disks are the primary master and secondary master)

Then modify <code>/etc/lilo.conf</code>, change the <code>boot=/dev/hda</code> line to your 
primary partition (probably boot=/dev/md0).

then type the 
<pre>
# sudo lilo
</code>
command. You are ready with installing to RAID1, you can test it.


From JonathanRiddell Thu Mar 10 15:46:12 +0000 2005
From: Jonathan Riddell
Date: Thu, 10 Mar 2005 15:46:12 +0000
Subject: Thanks
Message-ID: <[email protected]>

Many thanks for this excellent article.
I found that installing lilo to md0 did not work, instead I just installed it to /dev/sdb then /dev/sda 

'''Hoary Update'''

RAID1 can be almost completed during the disk partitioning section of the install process.  First set two partitions to type FD/Linux Raid on different discs, commit them, then take the 'Configure Raid' option at the top. Do 'Create MD', thence partition the multidisc "partition" as you see fit.  You don't need to do anything special with /boot if you don't want to; it can remain as part of / without grief.  It might be useful to know that the install actually goes onto one disc, then on the first boot the software RAID spots that the discs are out of sync and starts syncronizing them.  This might take a while. <code> cat /proc/mdstat </code> to watch the progress.

However there are some catches...

1) Some people find that the /etc/mdadm/mdadm.conf generated at install time causes problems.  You might find things go better by deleting it after the install.
<pre>
sudo mv /etc/mdadm/mdadm.conf /etc/mdadm/mdadm.conf.dud
</code>
This is listed as a bug someplace.

2) The Master Boot Record (MBR) is only setup on the primary disk by default. So if that disc fails the system won't automatically boot from the other, unless you install the MBR on the other as well.  This works with grub.  Use the second argument to the 'device' command to explicitly state which disc you're playing with. Also note you can use the TAB key in grub to reveal your options.
<pre>
# sudo grub
grub> device (hd0) /dev/sda
grub> root (hd0,0)
grub> setup (hd0)
grub> device (hd0) /dev/sdb
grub> root (hd0,0)
grub> setup (hd0)
grub> quit
</code>
Thence, after the discs are synced, if you power down and unplug one of these drives the system should boot from the other without intervention.  You should probably look into having mdadm email you when bad things happen because the whole point of RAID1 is to defer the impact of bad things to a more convenient time. Your RAID1 has worked as intended but requires intervention in order to do this again before something else bad happens.

CategoryDocumentation CategoryCleanup

[[category:UbuntuHelp]]