特殊:Badtitle/NS100:Installation/SoftwareRAID:修订间差异
小 新页面: {{From|https://help.ubuntu.com/community/Installation/SoftwareRAID}} {{Languages|UbuntuHelp:Installation/SoftwareRAID}} How to install Ubuntu onto a '''''Linux Software RAID''''' system =... |
小无编辑摘要 |
||
(未显示同一用户的6个中间版本) | |||
第1行: | 第1行: | ||
{{From|https://help.ubuntu.com/community/Installation/SoftwareRAID}} | {{From|https://help.ubuntu.com/community/Installation/SoftwareRAID}} | ||
{{Languages|UbuntuHelp:Installation/SoftwareRAID}} | {{Languages|UbuntuHelp:Installation/SoftwareRAID}} | ||
How to | How to create RAID using '''''Ubuntu Software RAID'''''. Including RAID 0, 1, 5 and 6. | ||
Ubuntu 9.10 provides very easy way to build RAID. You can build a RAID system using Ubuntu user interface, requires no CLI anymore! | |||
Note: Be aware of the fragile state of RAID support in Ubuntu and what it takes to get a reliable raid setup (https://wiki.ubuntu.com/ReliableRaid), but most of them has fixed since Ubuntu 8.10. | |||
=== Introduction === | === Introduction === | ||
RAID | RAID is a method of using multiple hard drives to act as one, there are 2 purpose of RAID: | ||
The RAID software included with current versions of Linux (and Ubuntu) is based on the 'mdadm' driver and works very well | * Expand drive capacity: RAID 0. If you have 2 x 500 GB HDD then total space become 1 TB | ||
* Prevent data loss in case of drive failure: RAID 1, RAID 5, and RAID 6. You can combine RAID 0 to other RAID, e.g RAID 0 + 1 become RAID 10. | |||
There are 3 ways to create RAID: | |||
<ol><li>Software-RAID: Where the RAID created by software. | |||
</li><li>Hardware-RAID: A special controller used to build RAID. RAID hardware faster, no CPU overload and can be used for any OS | |||
</li><li>FakeRAID: Since RAID hardware is very expensive, many motherboard manufacturers use multi-channel controllers with special BIOS features to perform RAID. This implementation is faster than software RAID. Read [[UbuntuHelp:FakeRaidHowto|FakeRaidHowto]] for details.</li></ol> | |||
The RAID software included with current versions of Linux (and Ubuntu) is based on the 'mdadm' driver and works very well. | |||
=== Requirements === | === Requirements === | ||
* | * If you're building a server, the server install CD includes the necessary options. | ||
* At least | * If you're building a desktop then you need the "Alternate" install CD for Ubuntu. Read [[UbuntuHelp:GettingUbuntu#head-40b5bcdbc1d4ec7b8149519dfd4f08c7fa274559| Getting Ubuntu Alternate Install disk]] and [[UbuntuHelp:Installation#head-194b248381c71c37f7b187c6b814bbe7e31d91d6| How to do a Ubuntu Alternate Install]] | ||
* [[UbuntuHelp:BurningIsoHowto|How to Burn an ISO]] | |||
* At least 2 hard drives, preferably same size | |||
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 (this step is not need if you use Ubuntu 9.10) | ||
* Update startup script to detect a failed drive | * Update startup script to detect a failed drive | ||
=== Installing === | === Installing === | ||
Install Ubuntu until you get to partitioning the disks | |||
https://help.ubuntu.com/community/Installation/SoftwareRAID?action=AttachFile&do=get&target=ubuntu_raid_00.png | |||
==== Partitioning the disk ==== | ==== Partitioning the disk ==== | ||
'''Warning: the /boot filesystem cannot use any softRAID level other than 1''' with the stock Ubuntu bootloader. If you want to use some other RAID level for most things, you'll need to create separate partitions and make a RAID1 device for /boot. | |||
'''Warning this will remove all data on hard drives''' | '''Warning: this will remove all data on hard drives.''' | ||
1. Select "Manual" as your partition method | |||
https://help.ubuntu.com/community/Installation/SoftwareRAID?action=AttachFile&do=get&target=ubuntu_raid_01.png | |||
2. Select your hard drive, and agree to "Create a new empty partition table on this device ?" | |||
https://help.ubuntu.com/community/Installation/SoftwareRAID?action=AttachFile&do=get&target=ubuntu_raid_02.png https://help.ubuntu.com/community/Installation/SoftwareRAID?action=AttachFile&do=get&target=ubuntu_raid_03.png | |||
3. Select the "FREE SPACE" on the 1st drive then select "automatically partition the free space | |||
https://help.ubuntu.com/community/Installation/SoftwareRAID?action=AttachFile&do=get&target=ubuntu_raid_04.png https://help.ubuntu.com/community/Installation/SoftwareRAID?action=AttachFile&do=get&target=ubuntu_raid_05.png | |||
4. Ubuntu will create 2 partitions: / and swap, as shown below: | |||
https://help.ubuntu.com/community/Installation/SoftwareRAID?action=AttachFile&do=get&target=ubuntu_raid_06.png | |||
5. On / partition select "bootable flag" and set it to "on" | |||
https://help.ubuntu.com/community/Installation/SoftwareRAID?action=AttachFile&do=get&target=ubuntu_raid_06.png | |||
6. Repeat steps 2 to 5 for the other hard drive | |||
10. | As you see Ubuntu 9.10 makes RAID creation very easy. No need to define partition manually anymore! Ubuntu 9.10 also use ext4 the latest Linux file system. | ||
==== Configuring the RAID ==== | ==== Configuring the RAID ==== | ||
<ol><li>Once you have complete your partitioning in the main "Partition Disks" page select "Configure Software RAID" | <ol><li>Once you have complete your partitioning in the main "Partition Disks" page select "Configure Software RAID" | ||
</li><li>Select "Yes" | </li><li>Select "Yes" | ||
</li><li>Select "Create new MD drive" | </li><li>Select "Create new MD drive" | ||
</li><li>Select | </li><li>Select RAID type: RAID 0, RAID 1, RAID 5 or RAID 6 | ||
</li><li>Number of devices 2 | </li><li>Number of devices. RAID 0 and 1 need 2 drives. 3 for RAID 5 and 4 for RAID 6. | ||
</li><li>Number of spare devices 0 | </li><li>Number of spare devices. Enter 0 if you have no spare drive. | ||
</li><li>select which partitions to use. | </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. | |||
</li><li>Once done, select finish.</li></ol> | |||
</li><li> | |||
==== Formatting ==== | ==== Formatting ==== | ||
Ubuntu 9.10 will automatically format your partitions. | |||
==== Boot Loader ==== | |||
There are several problems reported by previous version of Ubuntu. But Ubuntu 9.10 already fixes them. In case you next HDD won't boot then simply install Grub there. | |||
< | #grub-install /dev/sdb | ||
</li><li> | #grub-install /dev/sdc | ||
==== Boot from Degraded Disk ==== | |||
If default HDD fail then RAID will ask you to boot from degraded disk. In best practice, as specially if you put your server on remote area then you may make this automatically. | |||
Since Ubuntu 8.10 there is a new feature to boot automatically if default RAID disk fail. Simply: | |||
<ol><li>edit this file /etc/initramfs-tools/conf.d/mdadm | |||
</li><li>change "BOOT_DEGRADED=false" to "BOOT_DEGRADED=true"</li></ol> | |||
NB: | |||
* Additionally, this can be specified on the kernel boot line with the bootdegraded=[true|false] | |||
* You also can use #dpkg-reconfigure mdadm rather than CLI! | |||
Now, you have completed the step of making RAID in a few minutes! | |||
=== | === Test your RAID now! === | ||
The very importing part of RAID building is ... TESTING if your RAID works! Simply follow these step to test your RAID: | |||
<ol><li>shutdown your server | |||
</li><li>remove the power and cable data of your first drive | |||
< | </li><li>start your server, see if your server can boot from degraded disk!</li></ol> | ||
=== Troubleshooting === | === Troubleshooting === | ||
==== Swap space doesn't come up, error message in dmesg ==== | |||
Provided the RAID is working fine this can be fixed with | Provided the RAID is working fine this can be fixed with | ||
* sudo update-initramfs -k all -u | |||
=== Using mdadm === | === Using mdadm === | ||
==== Checking the status of your RAID ==== | ==== Checking the status of your RAID ==== | ||
Two useful commands to check the status are: | |||
* cat /proc/mdstat | |||
cat /proc/mdstat | This will show output something similar to | ||
Personalities : [raid1] [raid6] [raid5] [raid4] | |||
sudo mdadm --query --detail /dev/md* | md5 : active raid1 sda7[0] sdb7[1] | ||
62685504 blocks [2/2] [UU] | |||
md0 : active raid1 sda1[0] sdb1[1] | |||
256896 blocks [2/2] [UU] | |||
md6 : active raid5 sdc1[0] sde1[2] sdd1[1] | |||
976767872 blocks level 5, 64k chunk, algorithm 2 [3/3] [UUU] | |||
From this information you can see that the available personalities on this machine are "raid1, raid6, raid4, and raid5" which means this machine is setup to use raid devices configured in a raid1, raid6, raid4 and raid5 configuration. | |||
You can also see in the three example meta devices that there are two raid 1 mirrored meta devices. These are md0 and md5. You can see that md5 is a raid1 array and made up of disk /dev/sda partition 7, and /dev/sdb partition 7, containing 62685504 blocks, with 2 out of 2 disks available and both in sync. | |||
The same can be said of md0 only it is smaller (you can see from the blocks parameter) and is made up of /dev/sda1 and /dev/sdb1. | |||
md6 is different in that we can see it is a raid 5 array, striped across 3 disks. These are /dev/sdc1, /dev/sde1 and /dev/sdd1, with a 64k "chunk" size which is basically a "write" size. Algorithm 2 shows it is a write algorithm patern 2 which is "left disk to right disk" writing across the array. You can see that all 3 disks are present and in sync. | |||
* sudo mdadm --query --detail /dev/md* | |||
( where * is the partition number) | ( where * is the partition number) | ||
----- | ==== Disk Array Operation ==== | ||
Note: You can add, remove disks or set them as faulty without stopping an array. | |||
1. To stop an array, type: | |||
* $ sudo mdadm --stop /dev/md0 | |||
* Where /dev/md0 is the array device. | |||
2. Remove a Disk from an Array | |||
* $ sudo mdadm --remove /dev/md0 /dev/sda1 | |||
* Where /dev/md0 is the array device and /dev/sda is the faulty disk. | |||
3. Add a Disk to an Array | |||
* $ sudo mdadm --add /dev/md0 /dev/sda1 | |||
* Where /dev/md0 is the array device and /dev/sda is the new disk. | |||
* Note: This is not the same as "growing" the array! | |||
4.Start an Array, to reassemble (start) an array that was previously created: | |||
* $ mdadm --assemble --scan | |||
* mdadm will scan for defined arrays and start assembling it. Use this to track its status: | |||
* $ cat /proc/mdstat | |||
=== Resources === | |||
* http://ubuntuforums.org/showthread.php?t=408461 | |||
* 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 | |||
Thanks to Ubuntu 9.10 team which makes the RAID building very easy. | |||
[[category:UbuntuHelp]] | [[category:UbuntuHelp]] |
2010年5月19日 (三) 22:51的最新版本
文章出处: |
{{#if: | {{{2}}} | https://help.ubuntu.com/community/Installation/SoftwareRAID }} |
点击翻译: |
English {{#ifexist: {{#if: UbuntuHelp:Installation/SoftwareRAID | UbuntuHelp:Installation/SoftwareRAID | {{#if: | :}}Installation/SoftwareRAID}}/af | • {{#if: UbuntuHelp:Installation/SoftwareRAID|Afrikaans| [[::Installation/SoftwareRAID/af|Afrikaans]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Installation/SoftwareRAID | UbuntuHelp:Installation/SoftwareRAID | {{#if: | :}}Installation/SoftwareRAID}}/ar | • {{#if: UbuntuHelp:Installation/SoftwareRAID|العربية| [[::Installation/SoftwareRAID/ar|العربية]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Installation/SoftwareRAID | UbuntuHelp:Installation/SoftwareRAID | {{#if: | :}}Installation/SoftwareRAID}}/az | • {{#if: UbuntuHelp:Installation/SoftwareRAID|azərbaycanca| [[::Installation/SoftwareRAID/az|azərbaycanca]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Installation/SoftwareRAID | UbuntuHelp:Installation/SoftwareRAID | {{#if: | :}}Installation/SoftwareRAID}}/bcc | • {{#if: UbuntuHelp:Installation/SoftwareRAID|جهلسری بلوچی| [[::Installation/SoftwareRAID/bcc|جهلسری بلوچی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Installation/SoftwareRAID | UbuntuHelp:Installation/SoftwareRAID | {{#if: | :}}Installation/SoftwareRAID}}/bg | • {{#if: UbuntuHelp:Installation/SoftwareRAID|български| [[::Installation/SoftwareRAID/bg|български]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Installation/SoftwareRAID | UbuntuHelp:Installation/SoftwareRAID | {{#if: | :}}Installation/SoftwareRAID}}/br | • {{#if: UbuntuHelp:Installation/SoftwareRAID|brezhoneg| [[::Installation/SoftwareRAID/br|brezhoneg]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Installation/SoftwareRAID | UbuntuHelp:Installation/SoftwareRAID | {{#if: | :}}Installation/SoftwareRAID}}/ca | • {{#if: UbuntuHelp:Installation/SoftwareRAID|català| [[::Installation/SoftwareRAID/ca|català]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Installation/SoftwareRAID | UbuntuHelp:Installation/SoftwareRAID | {{#if: | :}}Installation/SoftwareRAID}}/cs | • {{#if: UbuntuHelp:Installation/SoftwareRAID|čeština| [[::Installation/SoftwareRAID/cs|čeština]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Installation/SoftwareRAID | UbuntuHelp:Installation/SoftwareRAID | {{#if: | :}}Installation/SoftwareRAID}}/de | • {{#if: UbuntuHelp:Installation/SoftwareRAID|Deutsch| [[::Installation/SoftwareRAID/de|Deutsch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Installation/SoftwareRAID | UbuntuHelp:Installation/SoftwareRAID | {{#if: | :}}Installation/SoftwareRAID}}/el | • {{#if: UbuntuHelp:Installation/SoftwareRAID|Ελληνικά| [[::Installation/SoftwareRAID/el|Ελληνικά]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Installation/SoftwareRAID | UbuntuHelp:Installation/SoftwareRAID | {{#if: | :}}Installation/SoftwareRAID}}/es | • {{#if: UbuntuHelp:Installation/SoftwareRAID|español| [[::Installation/SoftwareRAID/es|español]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Installation/SoftwareRAID | UbuntuHelp:Installation/SoftwareRAID | {{#if: | :}}Installation/SoftwareRAID}}/fa | • {{#if: UbuntuHelp:Installation/SoftwareRAID|فارسی| [[::Installation/SoftwareRAID/fa|فارسی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Installation/SoftwareRAID | UbuntuHelp:Installation/SoftwareRAID | {{#if: | :}}Installation/SoftwareRAID}}/fi | • {{#if: UbuntuHelp:Installation/SoftwareRAID|suomi| [[::Installation/SoftwareRAID/fi|suomi]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Installation/SoftwareRAID | UbuntuHelp:Installation/SoftwareRAID | {{#if: | :}}Installation/SoftwareRAID}}/fr | • {{#if: UbuntuHelp:Installation/SoftwareRAID|français| [[::Installation/SoftwareRAID/fr|français]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Installation/SoftwareRAID | UbuntuHelp:Installation/SoftwareRAID | {{#if: | :}}Installation/SoftwareRAID}}/gu | • {{#if: UbuntuHelp:Installation/SoftwareRAID|ગુજરાતી| [[::Installation/SoftwareRAID/gu|ગુજરાતી]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Installation/SoftwareRAID | UbuntuHelp:Installation/SoftwareRAID | {{#if: | :}}Installation/SoftwareRAID}}/he | • {{#if: UbuntuHelp:Installation/SoftwareRAID|עברית| [[::Installation/SoftwareRAID/he|עברית]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Installation/SoftwareRAID | UbuntuHelp:Installation/SoftwareRAID | {{#if: | :}}Installation/SoftwareRAID}}/hu | • {{#if: UbuntuHelp:Installation/SoftwareRAID|magyar| [[::Installation/SoftwareRAID/hu|magyar]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Installation/SoftwareRAID | UbuntuHelp:Installation/SoftwareRAID | {{#if: | :}}Installation/SoftwareRAID}}/id | • {{#if: UbuntuHelp:Installation/SoftwareRAID|Bahasa Indonesia| [[::Installation/SoftwareRAID/id|Bahasa Indonesia]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Installation/SoftwareRAID | UbuntuHelp:Installation/SoftwareRAID | {{#if: | :}}Installation/SoftwareRAID}}/it | • {{#if: UbuntuHelp:Installation/SoftwareRAID|italiano| [[::Installation/SoftwareRAID/it|italiano]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Installation/SoftwareRAID | UbuntuHelp:Installation/SoftwareRAID | {{#if: | :}}Installation/SoftwareRAID}}/ja | • {{#if: UbuntuHelp:Installation/SoftwareRAID|日本語| [[::Installation/SoftwareRAID/ja|日本語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Installation/SoftwareRAID | UbuntuHelp:Installation/SoftwareRAID | {{#if: | :}}Installation/SoftwareRAID}}/ko | • {{#if: UbuntuHelp:Installation/SoftwareRAID|한국어| [[::Installation/SoftwareRAID/ko|한국어]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Installation/SoftwareRAID | UbuntuHelp:Installation/SoftwareRAID | {{#if: | :}}Installation/SoftwareRAID}}/ksh | • {{#if: UbuntuHelp:Installation/SoftwareRAID|Ripoarisch| [[::Installation/SoftwareRAID/ksh|Ripoarisch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Installation/SoftwareRAID | UbuntuHelp:Installation/SoftwareRAID | {{#if: | :}}Installation/SoftwareRAID}}/mr | • {{#if: UbuntuHelp:Installation/SoftwareRAID|मराठी| [[::Installation/SoftwareRAID/mr|मराठी]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Installation/SoftwareRAID | UbuntuHelp:Installation/SoftwareRAID | {{#if: | :}}Installation/SoftwareRAID}}/ms | • {{#if: UbuntuHelp:Installation/SoftwareRAID|Bahasa Melayu| [[::Installation/SoftwareRAID/ms|Bahasa Melayu]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Installation/SoftwareRAID | UbuntuHelp:Installation/SoftwareRAID | {{#if: | :}}Installation/SoftwareRAID}}/nl | • {{#if: UbuntuHelp:Installation/SoftwareRAID|Nederlands| [[::Installation/SoftwareRAID/nl|Nederlands]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Installation/SoftwareRAID | UbuntuHelp:Installation/SoftwareRAID | {{#if: | :}}Installation/SoftwareRAID}}/no | • {{#if: UbuntuHelp:Installation/SoftwareRAID|norsk| [[::Installation/SoftwareRAID/no|norsk]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Installation/SoftwareRAID | UbuntuHelp:Installation/SoftwareRAID | {{#if: | :}}Installation/SoftwareRAID}}/oc | • {{#if: UbuntuHelp:Installation/SoftwareRAID|occitan| [[::Installation/SoftwareRAID/oc|occitan]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Installation/SoftwareRAID | UbuntuHelp:Installation/SoftwareRAID | {{#if: | :}}Installation/SoftwareRAID}}/pl | • {{#if: UbuntuHelp:Installation/SoftwareRAID|polski| [[::Installation/SoftwareRAID/pl|polski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Installation/SoftwareRAID | UbuntuHelp:Installation/SoftwareRAID | {{#if: | :}}Installation/SoftwareRAID}}/pt | • {{#if: UbuntuHelp:Installation/SoftwareRAID|português| [[::Installation/SoftwareRAID/pt|português]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Installation/SoftwareRAID | UbuntuHelp:Installation/SoftwareRAID | {{#if: | :}}Installation/SoftwareRAID}}/ro | • {{#if: UbuntuHelp:Installation/SoftwareRAID|română| [[::Installation/SoftwareRAID/ro|română]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Installation/SoftwareRAID | UbuntuHelp:Installation/SoftwareRAID | {{#if: | :}}Installation/SoftwareRAID}}/ru | • {{#if: UbuntuHelp:Installation/SoftwareRAID|русский| [[::Installation/SoftwareRAID/ru|русский]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Installation/SoftwareRAID | UbuntuHelp:Installation/SoftwareRAID | {{#if: | :}}Installation/SoftwareRAID}}/si | • {{#if: UbuntuHelp:Installation/SoftwareRAID|සිංහල| [[::Installation/SoftwareRAID/si|සිංහල]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Installation/SoftwareRAID | UbuntuHelp:Installation/SoftwareRAID | {{#if: | :}}Installation/SoftwareRAID}}/sq | • {{#if: UbuntuHelp:Installation/SoftwareRAID|shqip| [[::Installation/SoftwareRAID/sq|shqip]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Installation/SoftwareRAID | UbuntuHelp:Installation/SoftwareRAID | {{#if: | :}}Installation/SoftwareRAID}}/sr | • {{#if: UbuntuHelp:Installation/SoftwareRAID|српски / srpski| [[::Installation/SoftwareRAID/sr|српски / srpski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Installation/SoftwareRAID | UbuntuHelp:Installation/SoftwareRAID | {{#if: | :}}Installation/SoftwareRAID}}/sv | • {{#if: UbuntuHelp:Installation/SoftwareRAID|svenska| [[::Installation/SoftwareRAID/sv|svenska]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Installation/SoftwareRAID | UbuntuHelp:Installation/SoftwareRAID | {{#if: | :}}Installation/SoftwareRAID}}/th | • {{#if: UbuntuHelp:Installation/SoftwareRAID|ไทย| [[::Installation/SoftwareRAID/th|ไทย]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Installation/SoftwareRAID | UbuntuHelp:Installation/SoftwareRAID | {{#if: | :}}Installation/SoftwareRAID}}/tr | • {{#if: UbuntuHelp:Installation/SoftwareRAID|Türkçe| [[::Installation/SoftwareRAID/tr|Türkçe]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Installation/SoftwareRAID | UbuntuHelp:Installation/SoftwareRAID | {{#if: | :}}Installation/SoftwareRAID}}/vi | • {{#if: UbuntuHelp:Installation/SoftwareRAID|Tiếng Việt| [[::Installation/SoftwareRAID/vi|Tiếng Việt]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Installation/SoftwareRAID | UbuntuHelp:Installation/SoftwareRAID | {{#if: | :}}Installation/SoftwareRAID}}/yue | • {{#if: UbuntuHelp:Installation/SoftwareRAID|粵語| [[::Installation/SoftwareRAID/yue|粵語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Installation/SoftwareRAID | UbuntuHelp:Installation/SoftwareRAID | {{#if: | :}}Installation/SoftwareRAID}}/zh | • {{#if: UbuntuHelp:Installation/SoftwareRAID|中文| [[::Installation/SoftwareRAID/zh|中文]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Installation/SoftwareRAID | UbuntuHelp:Installation/SoftwareRAID | {{#if: | :}}Installation/SoftwareRAID}}/zh-hans | • {{#if: UbuntuHelp:Installation/SoftwareRAID|中文(简体)| [[::Installation/SoftwareRAID/zh-hans|中文(简体)]]}}|}} {{#ifexist: {{#if: UbuntuHelp:Installation/SoftwareRAID | UbuntuHelp:Installation/SoftwareRAID | {{#if: | :}}Installation/SoftwareRAID}}/zh-hant | • {{#if: UbuntuHelp:Installation/SoftwareRAID|中文(繁體)| [[::Installation/SoftwareRAID/zh-hant|中文(繁體)]]}}|}} |
{{#ifeq:UbuntuHelp:Installation/SoftwareRAID|:Installation/SoftwareRAID|请不要直接编辑翻译本页,本页将定期与来源同步。}} |
{{#ifexist: :Installation/SoftwareRAID/zh | | {{#ifexist: Installation/SoftwareRAID/zh | | {{#ifeq: {{#titleparts:Installation/SoftwareRAID|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:Installation/SoftwareRAID|1|-1|}} | zh | | }}
How to create RAID using Ubuntu Software RAID. Including RAID 0, 1, 5 and 6. Ubuntu 9.10 provides very easy way to build RAID. You can build a RAID system using Ubuntu user interface, requires no CLI anymore! Note: Be aware of the fragile state of RAID support in Ubuntu and what it takes to get a reliable raid setup (https://wiki.ubuntu.com/ReliableRaid), but most of them has fixed since Ubuntu 8.10.
Introduction
RAID is a method of using multiple hard drives to act as one, there are 2 purpose of RAID:
- Expand drive capacity: RAID 0. If you have 2 x 500 GB HDD then total space become 1 TB
- Prevent data loss in case of drive failure: RAID 1, RAID 5, and RAID 6. You can combine RAID 0 to other RAID, e.g RAID 0 + 1 become RAID 10.
There are 3 ways to create RAID:
- Software-RAID: Where the RAID created by software.
- Hardware-RAID: A special controller used to build RAID. RAID hardware faster, no CPU overload and can be used for any OS
- FakeRAID: Since RAID hardware is very expensive, many motherboard manufacturers use multi-channel controllers with special BIOS features to perform RAID. This implementation is faster than software RAID. Read FakeRaidHowto for details.
The RAID software included with current versions of Linux (and Ubuntu) is based on the 'mdadm' driver and works very well.
Requirements
- If you're building a server, the server install CD includes the necessary options.
- If you're building a desktop then you need the "Alternate" install CD for Ubuntu. Read Getting Ubuntu Alternate Install disk and How to do a Ubuntu Alternate Install
- How to Burn an ISO
- At least 2 hard drives, preferably same size
After a successful install, you should also manually fix 2 shortcomings in the default configuration:
- Install GRUB boot-loader on second drive (this step is not need if you use Ubuntu 9.10)
- Update startup script to detect a failed drive
Installing
Install Ubuntu until you get to partitioning the disks
Partitioning the disk
Warning: the /boot filesystem cannot use any softRAID level other than 1 with the stock Ubuntu bootloader. If you want to use some other RAID level for most things, you'll need to create separate partitions and make a RAID1 device for /boot. Warning: this will remove all data on hard drives. 1. Select "Manual" as your partition method
2. Select your hard drive, and agree to "Create a new empty partition table on this device ?"
3. Select the "FREE SPACE" on the 1st drive then select "automatically partition the free space
4. Ubuntu will create 2 partitions: / and swap, as shown below:
5. On / partition select "bootable flag" and set it to "on"
6. Repeat steps 2 to 5 for the other hard drive
As you see Ubuntu 9.10 makes RAID creation very easy. No need to define partition manually anymore! Ubuntu 9.10 also use ext4 the latest Linux file system.
Configuring the RAID
- Once you have complete your partitioning in the main "Partition Disks" page select "Configure Software RAID"
- Select "Yes"
- Select "Create new MD drive"
- Select RAID type: RAID 0, RAID 1, RAID 5 or RAID 6
- Number of devices. RAID 0 and 1 need 2 drives. 3 for RAID 5 and 4 for RAID 6.
- Number of spare devices. Enter 0 if you have no spare drive.
- 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.
- 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.
- Once done, select finish.
Formatting
Ubuntu 9.10 will automatically format your partitions.
Boot Loader
There are several problems reported by previous version of Ubuntu. But Ubuntu 9.10 already fixes them. In case you next HDD won't boot then simply install Grub there.
- grub-install /dev/sdb
- grub-install /dev/sdc
Boot from Degraded Disk
If default HDD fail then RAID will ask you to boot from degraded disk. In best practice, as specially if you put your server on remote area then you may make this automatically. Since Ubuntu 8.10 there is a new feature to boot automatically if default RAID disk fail. Simply:
- edit this file /etc/initramfs-tools/conf.d/mdadm
- change "BOOT_DEGRADED=false" to "BOOT_DEGRADED=true"
NB:
- Additionally, this can be specified on the kernel boot line with the bootdegraded=[true|false]
- You also can use #dpkg-reconfigure mdadm rather than CLI!
Now, you have completed the step of making RAID in a few minutes!
Test your RAID now!
The very importing part of RAID building is ... TESTING if your RAID works! Simply follow these step to test your RAID:
- shutdown your server
- remove the power and cable data of your first drive
- start your server, see if your server can boot from degraded disk!
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
Using mdadm
Checking the status of your RAID
Two useful commands to check the status are:
- cat /proc/mdstat
This will show output something similar to Personalities : [raid1] [raid6] [raid5] [raid4] md5 : active raid1 sda7[0] sdb7[1] 62685504 blocks [2/2] [UU] md0 : active raid1 sda1[0] sdb1[1] 256896 blocks [2/2] [UU] md6 : active raid5 sdc1[0] sde1[2] sdd1[1] 976767872 blocks level 5, 64k chunk, algorithm 2 [3/3] [UUU] From this information you can see that the available personalities on this machine are "raid1, raid6, raid4, and raid5" which means this machine is setup to use raid devices configured in a raid1, raid6, raid4 and raid5 configuration. You can also see in the three example meta devices that there are two raid 1 mirrored meta devices. These are md0 and md5. You can see that md5 is a raid1 array and made up of disk /dev/sda partition 7, and /dev/sdb partition 7, containing 62685504 blocks, with 2 out of 2 disks available and both in sync. The same can be said of md0 only it is smaller (you can see from the blocks parameter) and is made up of /dev/sda1 and /dev/sdb1. md6 is different in that we can see it is a raid 5 array, striped across 3 disks. These are /dev/sdc1, /dev/sde1 and /dev/sdd1, with a 64k "chunk" size which is basically a "write" size. Algorithm 2 shows it is a write algorithm patern 2 which is "left disk to right disk" writing across the array. You can see that all 3 disks are present and in sync.
- sudo mdadm --query --detail /dev/md*
( where * is the partition number)
Disk Array Operation
Note: You can add, remove disks or set them as faulty without stopping an array. 1. To stop an array, type:
- $ sudo mdadm --stop /dev/md0
- Where /dev/md0 is the array device.
2. Remove a Disk from an Array
- $ sudo mdadm --remove /dev/md0 /dev/sda1
- Where /dev/md0 is the array device and /dev/sda is the faulty disk.
3. Add a Disk to an Array
- $ sudo mdadm --add /dev/md0 /dev/sda1
- Where /dev/md0 is the array device and /dev/sda is the new disk.
- Note: This is not the same as "growing" the array!
4.Start an Array, to reassemble (start) an array that was previously created:
- $ mdadm --assemble --scan
- mdadm will scan for defined arrays and start assembling it. Use this to track its status:
- $ cat /proc/mdstat
Resources
- http://ubuntuforums.org/showthread.php?t=408461
- 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
Thanks to Ubuntu 9.10 team which makes the RAID building very easy.