个人工具

“UbuntuHelp:Installation/SoftwareRAID”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
(新页面: {{From|https://help.ubuntu.com/community/Installation/SoftwareRAID}} {{Languages|UbuntuHelp:Installation/SoftwareRAID}} How to install Ubuntu onto a '''''Linux Software RAID''''' system =...)
 
第3行: 第3行:
 
How to install Ubuntu onto a '''''Linux Software RAID''''' system
 
How to install Ubuntu onto a '''''Linux Software RAID''''' system
 
=== Introduction ===
 
=== Introduction ===
RAID mirroring is a method of using two hard-drives to act as one, avoiding the possibility of a catastrophic loss if one of the drives should failThis method is possible through either software (where the operating system knows about both drives and actively maintains both of them) or through hardware (where a special controller makes the OS think there's only one drive and maintains the drives 'invisibly').
+
RAID is a method of using multiple hard drives to act as one, reducing the probability of catastrophic data loss in case of drive failureRAID is implemented in either software (where the operating system knows about both drives and actively maintains both of them) or hardware (where a special controller makes the OS think there's only one drive and maintains the drives 'invisibly').
 
The RAID software included with current versions of Linux (and Ubuntu) is based on the 'mdadm' driver and works very well, better even than many so-called 'hardware' RAID controllers.
 
The RAID software included with current versions of Linux (and Ubuntu) is based on the 'mdadm' driver and works very well, better even than many so-called 'hardware' RAID controllers.
NOTE: Many aftermarket motherboards tout 'hardware RAID' but it's really not.  Instead, it's a software driver with a slight hardware 'assist' from the motherboard; these systems are known as "FakeRAID" in the Linux community.  If you're doing a new install, it is better to use the standard Linux drivers.  If you're trying to dual-boot an existing FakeRAID setup, or you're insistent on using it even on a new install, you need to follow these instructions, [[UbuntuHelp:FakeRaidHowto|FakeRaidHowto]].
+
NOTE: Many aftermarket motherboards tout 'hardware RAID' but it's really not.  Instead, it's a software driver with a slight hardware 'assist' from the motherboard; these systems are known as "FakeRAID" in the Linux community.  If you're doing a new install, it is better to use the standard Linux drivers.  If you're trying to dual-boot an existing FakeRAID setup, or you're insistent on using it even on a new install, you need to follow these instructions, [[FakeRaidHowto]].
 
=== Requirements ===
 
=== Requirements ===
* The "Alternate" install CD for *buntu. [[UbuntuHelp:GettingUbuntu#head-40b5bcdbc1d4ec7b8149519dfd4f08c7fa274559| Getting Ubuntu Alternate Install disk]]
+
* The "Alternate" install CD for *buntu if you're building a desktop system. If you're building a server, the server install CD includes the necessary options. [[GettingUbuntu#head-40b5bcdbc1d4ec7b8149519dfd4f08c7fa274559| Getting Ubuntu Alternate Install disk]]
* At least two hard drives, preferably the same mode, size etc..
+
* At least two hard drives, preferably the same mode, size, etc.
 
After a successful install, you should also manually fix 2 shortcomings in the default configuration:
 
After a successful install, you should also manually fix 2 shortcomings in the default configuration:
 
* Install GRUB boot-loader on second drive
 
* Install GRUB boot-loader on second drive
 
* Update startup script to detect a failed drive
 
* Update startup script to detect a failed drive
 
=== Installing ===
 
=== Installing ===
[[UbuntuHelp:BurningIsoHowto|How to Burn an ISO]]
+
[[BurningIsoHowto|How to Burn an ISO]]
 
Follow the install instruction for an Alternate Install until you get to partitioning the disks
 
Follow the install instruction for an Alternate Install until you get to partitioning the disks
[[UbuntuHelp:Installation#head-194b248381c71c37f7b187c6b814bbe7e31d91d6| How to do a Ubuntu Alternate Install]]
+
[[Installation#head-194b248381c71c37f7b187c6b814bbe7e31d91d6| How to do a Ubuntu Alternate Install]]
 
==== Partitioning the disk ====
 
==== Partitioning the disk ====
For a standard 2 hard drive system in RAID1 Configuration. (repeat steps for additional Hard drives)  
+
For a 2 hard drive system in RAID 1 configuration. (repeat steps for additional hard drives)  
'''Warning this will remove all data on hard drives''' See [[UbuntuHelp:DrivesAndPartitions|DrivesAndPartitions]] for more information.
+
'''Warning: this will remove all data on hard drives.''' See [[DrivesAndPartitions]] for more information.
 
<ol><li>Select "Manual" as your partition method.
 
<ol><li>Select "Manual" as your partition method.
 
</li><li>Select your 1st hard drive, and agree to "Create a new empty partition table on this device ?"
 
</li><li>Select your 1st hard drive, and agree to "Create a new empty partition table on this device ?"
第37行: 第37行:
 
</li><li>Number of devices 2 or the amount of hard drives you have
 
</li><li>Number of devices 2 or the amount of hard drives you have
 
</li><li>Number of spare devices 0
 
</li><li>Number of spare devices 0
</li><li>select which partitions to use.</li></ol>
+
</li><li>select which partitions to use. Generally they will be sda1 and sdb1 or hda1 or hdb1. Generally the numbers will match and the different letters are for different hard drives.
 
+
</li><li>At this point the installation may become unresponsive this is the hard drives already syncing. Repeat steps 3 to 7 with each pair of partitions you have created.
generally they will be sda1 and sdb1 or hda1 or hdb1 generally the numbers will match and the different letters are for different hard drives
+
</li><li>Once done, select finish.</li></ol>
{i} at this point the installation may become unresponsive this is the hard drives already syncing, time for a food break.
+
<ol><li>Repeat steps 3 to 7 with each pair of partitions you have created.
+
</li><li>once done select finish.</li></ol>
+
  
 
==== Formatting ====
 
==== Formatting ====
第49行: 第46行:
 
</li><li>Go to Use as Select Ext 3 for your normal partitions or swap area for your swap partition
 
</li><li>Go to Use as Select Ext 3 for your normal partitions or swap area for your swap partition
 
</li><li>If you select Ext 3 then select your mount point if you only have one partition for ext 3 select /
 
</li><li>If you select Ext 3 then select your mount point if you only have one partition for ext 3 select /
</li><li>Repeat for each RAID partition</li></ol>
+
</li><li>Repeat for each RAID partition.</li></ol>
  
 
Select "Finish partitioning and write changes to disk"
 
Select "Finish partitioning and write changes to disk"
 
==== Notes ====
 
==== Notes ====
 
Installation continues as normal.
 
Installation continues as normal.
From this point in your hard drive lights will probably be on continuously this is the hard drives syncing up, it's probably best just leaving your computer alone waiting for the RAID to sync then to continue with the installation.
+
From this point on, your hard drive lights will probably be on continuously. This indicates the array syncing. The system can be used normally and even rebooted while the array syncs.
 
=== Adding GRUB to 2nd drive ===
 
=== Adding GRUB to 2nd drive ===
Known problems with GRUB and RAID configurations in anything but RAID1
+
Known problems with GRUB and RAID configurations in anything but RAID 1
 
GRUB should be installed on all hard drives.
 
GRUB should be installed on all hard drives.
 
If your drives are /sda and /sdb, the first drive will automatically be configured with GRUB but the second drive will not.  To add it:
 
If your drives are /sda and /sdb, the first drive will automatically be configured with GRUB but the second drive will not.  To add it:
第66行: 第63行:
 
grub> quit</nowiki></pre>
 
grub> quit</nowiki></pre>
 
=== Updating startup script ===
 
=== Updating startup script ===
Everytime the computer boots-up it scans the available hard-drives to try and identify any RAID array.  Most of the time this is easy and takes place instantaneously.  If one of the drives is unusable, however, then the computer needs to operate the remaining drive in 'degraded' mode.  If the bad drive failed during regular operation, then the computer will have already removed it from the configuration of the array.  If the drive had previously been working, however, and failed spontaneously during power-up or boot-up, then the computer needs to figure it out on-the-fly.
+
Every time the computer boots, it scans the available hard-drives to try and identify any RAID array.  Most of the time this is easy and takes place instantaneously.  If one of the drives is unusable, however, then the computer needs to operate the remaining drive in 'degraded' mode.  If the bad drive failed during regular operation, then the computer will have already removed it from the configuration of the array.  If the drive had previously been working, however, and failed spontaneously during power-up or boot-up, then the computer needs to figure it out on-the-fly.
 
The script which tries to detect a failed drive is called 'initramfs' and, as of Ubuntu 8.04, the default code in this script completely fails.  The procedure below adds an additional step so that it will succeed.
 
The script which tries to detect a failed drive is called 'initramfs' and, as of Ubuntu 8.04, the default code in this script completely fails.  The procedure below adds an additional step so that it will succeed.
 
1. Update the 'initramfs' boot script,
 
1. Update the 'initramfs' boot script,
第85行: 第82行:
 
/sbin/mdadm --assemble --scan
 
/sbin/mdadm --assemble --scan
 
log_end_msg
 
log_end_msg
 +
# If you use logical volume on raid partition, is better waith some seconds or the boot will fail!
 +
sleep 10
 
fi</nowiki></pre>
 
fi</nowiki></pre>
 
4. Save the change and exit the editor.
 
4. Save the change and exit the editor.
第97行: 第96行:
 
> sudo update-initramfs -k all -u</nowiki></pre>
 
> sudo update-initramfs -k all -u</nowiki></pre>
 
=== Resources ===
 
=== Resources ===
http://ubuntuforums.org/showthread.php?t=408461
+
* http://ubuntuforums.org/showthread.php?t=408461
http://man-wiki.net/index.php/8:mdadm
+
* http://man-wiki.net/index.php/8:mdadm
 +
* https://wiki.ubuntu.com/HotplugRaid Keeping your data synced and mirrored on external drives.
 +
* http://en.wikipedia.org/wiki/RAID
 +
* http://en.wikipedia.org/wiki/Mdadm
 
=== Using mdadm ===
 
=== Using mdadm ===
 
==== Checking the status of your RAID ====
 
==== Checking the status of your RAID ====
2 useful commands to check the status are:
+
Two useful commands to check the status are:
 
<pre><nowiki>
 
<pre><nowiki>
 
cat /proc/mdstat </nowiki></pre>
 
cat /proc/mdstat </nowiki></pre>

2008年10月19日 (日) 12:24的版本

How to install Ubuntu onto a Linux Software RAID system

Introduction

RAID is a method of using multiple hard drives to act as one, reducing the probability of catastrophic data loss in case of drive failure. RAID is implemented in either software (where the operating system knows about both drives and actively maintains both of them) or hardware (where a special controller makes the OS think there's only one drive and maintains the drives 'invisibly'). The RAID software included with current versions of Linux (and Ubuntu) is based on the 'mdadm' driver and works very well, better even than many so-called 'hardware' RAID controllers. NOTE: Many aftermarket motherboards tout 'hardware RAID' but it's really not. Instead, it's a software driver with a slight hardware 'assist' from the motherboard; these systems are known as "FakeRAID" in the Linux community. If you're doing a new install, it is better to use the standard Linux drivers. If you're trying to dual-boot an existing FakeRAID setup, or you're insistent on using it even on a new install, you need to follow these instructions, FakeRaidHowto.

Requirements

  • The "Alternate" install CD for *buntu if you're building a desktop system. If you're building a server, the server install CD includes the necessary options. Getting Ubuntu Alternate Install disk
  • At least two hard drives, preferably the same mode, size, etc.

After a successful install, you should also manually fix 2 shortcomings in the default configuration:

  • Install GRUB boot-loader on second drive
  • Update startup script to detect a failed drive

Installing

How to Burn an ISO Follow the install instruction for an Alternate Install until you get to partitioning the disks How to do a Ubuntu Alternate Install

Partitioning the disk

For a 2 hard drive system in RAID 1 configuration. (repeat steps for additional hard drives) Warning: this will remove all data on hard drives. See DrivesAndPartitions for more information.

  1. Select "Manual" as your partition method.
  2. Select your 1st hard drive, and agree to "Create a new empty partition table on this device ?"
  3. Repeat step 2 with your 2nd hard drive.
  4. Select the "FREE SPACE" on the 1st drive then select "Create a new partition"
  5. Select the size (suggestion, normally you want a root partition major part of the hard drive and swap which is 1.5 times the amount of ram )
  6. Select Primary, then Beginning.
  7. Select the "Use as:" by default this is "Ext3 journalling file system" we want to change that to "physical volume for RAID"
  8. Select if the partition is the main "/" partition select "bootable flag" and set it to "on"
  9. Select "Done setting up the partition"

10. Repeat steps 4 to 10 for the 2nd hard drive and the other partitions.

Configuring the RAID

  1. Once you have complete your partitioning in the main "Partition Disks" page select "Configure Software RAID"
  2. Select "Yes"
  3. Select "Create new MD drive"
  4. Select RAID1, or type of RAID you want (RAID0 RAID1 RAID5)
  5. Number of devices 2 or the amount of hard drives you have
  6. Number of spare devices 0
  7. select which partitions to use. Generally they will be sda1 and sdb1 or hda1 or hdb1. Generally the numbers will match and the different letters are for different hard drives.
  8. At this point the installation may become unresponsive this is the hard drives already syncing. Repeat steps 3 to 7 with each pair of partitions you have created.
  9. Once done, select finish.

Formatting

You now have a list of your hard drives and your RAID drives. We will now format and set the mount point for other RAID drives. Treat the RAID drive as a local hard drive and format and mount accordingly

  1. Select Partition.
  2. Go to Use as Select Ext 3 for your normal partitions or swap area for your swap partition
  3. If you select Ext 3 then select your mount point if you only have one partition for ext 3 select /
  4. Repeat for each RAID partition.

Select "Finish partitioning and write changes to disk"

Notes

Installation continues as normal. From this point on, your hard drive lights will probably be on continuously. This indicates the array syncing. The system can be used normally and even rebooted while the array syncs.

Adding GRUB to 2nd drive

Known problems with GRUB and RAID configurations in anything but RAID 1 GRUB should be installed on all hard drives. If your drives are /sda and /sdb, the first drive will automatically be configured with GRUB but the second drive will not. To add it:

> sudo grub
grub> device (hd1) /dev/sdb
grub> root (hd1,0)
grub> setup (hd1)
grub> quit

Updating startup script

Every time the computer boots, it scans the available hard-drives to try and identify any RAID array. Most of the time this is easy and takes place instantaneously. If one of the drives is unusable, however, then the computer needs to operate the remaining drive in 'degraded' mode. If the bad drive failed during regular operation, then the computer will have already removed it from the configuration of the array. If the drive had previously been working, however, and failed spontaneously during power-up or boot-up, then the computer needs to figure it out on-the-fly. The script which tries to detect a failed drive is called 'initramfs' and, as of Ubuntu 8.04, the default code in this script completely fails. The procedure below adds an additional step so that it will succeed. 1. Update the 'initramfs' boot script,

> gksudo gedit /usr/share/initramfs-tools/scripts/local

2. Find the comment,

# We've given up, but we'll let the user fix matters if they can".

3. Just *before* this comment, add the following:

# The following code was added to allow degraded RAID arrays to start
if [ ! -e "${ROOT}" ] || ! /lib/udev/vol_id "${ROOT}" >/dev/null 2>&1; then
# Try mdadm and allow degraded arrays to start in case a drive has failed
log_begin_msg "Attempting to start RAID arrays and allow degraded arrays"
/sbin/mdadm --assemble --scan
log_end_msg
# If you use logical volume on raid partition, is better waith some seconds or the boot will fail!
sleep 10
fi

4. Save the change and exit the editor. 5. Finally, update the boot image to use the updated script,

> sudo update-initramfs -u

Troubleshooting

Swap space doesn't come up, error message in dmesg Provided the RAID is working fine this can be fixed with

> sudo update-initramfs -k all -u

Resources

Using mdadm

Checking the status of your RAID

Two useful commands to check the status are:

cat /proc/mdstat 
sudo mdadm --query --detail /dev/md* 

( where * is the partition number)