https://wiki.archlinux.org/api.php?action=feedcontributions&user=Jyrihovila&feedformat=atomArchWiki - User contributions [en]2024-03-29T15:37:40ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=Talk:Install_Arch_Linux_with_Fake_RAID&diff=197767Talk:Install Arch Linux with Fake RAID2012-04-23T16:15:51Z<p>Jyrihovila: </p>
<hr />
<div>==Grub without chroot?==<br />
Could GRUB be installed without chroot? Probably easier to do a pacman -U /pathToPackages/grub* followed by grub-install /dev/mapper/raidSet and skip chroot and the graphical bootloader installation. -- [[Loosec]]<br />
<br />
==Determine number of root devices==<br />
I was getting the "major/minor" error, as detailed at the end of the page. Should be noted (I pulled a fair bit of hair out until I figured this out) that you need to use pacman to install dmraid before you can include it as a mkinitcpio hook, so that it can work. [[User:Patyeon|Patyeon]] 17:50, 14 August 2011 (EDT)<br />
:You are free to try and add it yourself, don't be scared of the wiki :) -- [[User:Kynikos|Kynikos]] 06:02, 15 August 2011 (EDT)<br />
<br />
== Out of date page? ==<br />
<br />
Intel RST (Rapid Storage Technology) recommends using mdadm rather than dmraid for fake raid.<br />
<br />
- 2012-04-23: Updated section Install GRUB to point to vmlinuz-linux and initramfs-linux.img instead of vmlinuz and kernel26.img -Jyri</div>Jyrihovilahttps://wiki.archlinux.org/index.php?title=Install_Arch_Linux_with_Fake_RAID&diff=197740Install Arch Linux with Fake RAID2012-04-23T16:11:59Z<p>Jyrihovila: /* Install GRUB */</p>
<hr />
<div>[[Category:Getting and installing Arch]]<br />
[[Category:File systems]]<br />
{{i18n|Installing with Fake RAID}}<br />
<br />
{{Article summary start}}<br />
{{Article summary text|Provides detailed instructions for installing Arch Linux on "fake RAID" volumes. This guide is intended to supplement the [[Official Arch Linux Install Guide]] or the [[Beginners' Guide]].}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Installing with Software RAID or LVM}}<br />
{{Article summary wiki|Convert a single drive system to RAID}}<br />
{{Article summary heading|Resources}}<br />
{{Article summary link|RAID/Onboard @ Gentoo Linux Wiki|http://en.gentoo-wiki.com/wiki/RAID/Onboard}}<br />
{{Article summary link|Related forum thread|2=http://bbs.archlinux.org/viewtopic.php?id=22038}}<br />
{{Article summary end}}<br />
<br />
The purpose of this guide is to enable use of a RAID set created by the on-board BIOS RAID controller and thereby allow dual-booting of Linux and Windows from partitions '''inside''' the RAID set using GRUB. When using so-called "fake RAID" or "host RAID", the disc sets are reached from {{ic|/dev/mapper/chipsetName_randomName}} and not {{ic|/dev/sdX}}.<br />
<br />
== What is "fake RAID" ==<br />
<br />
From Wikipedia:<br />
<br />
:''Operating system-based RAID doesn't always protect the boot process and is generally impractical on desktop versions of Windows. Hardware RAID controllers are expensive and proprietary. To fill this gap, cheap "RAID controllers" were introduced that do not contain a RAID controller chip, but simply a standard disk controller chip with special firmware and drivers. During early stage boot-up, the RAID is implemented by the firmware. When a protected-mode operating system kernel such as Linux or a modern version of Microsoft Windows is loaded, the drivers take over.''<br />
<br />
:''These controllers are described by their manufacturers as RAID controllers, and it is rarely made clear to purchasers that the burden of RAID processing is borne by the host computer's central processing unit -- not the RAID controller itself -- thus introducing the aforementioned CPU overhead which hardware controllers do not suffer from. Firmware controllers often can only use certain types of hard drives in their RAID arrays (e.g. SATA for Intel Matrix RAID, as there is neither SCSI nor PATA support in modern Intel ICH southbridges; however, motherboard makers implement RAID controllers outside of the southbridge on some motherboards). Before their introduction, a "RAID controller" implied that the controller did the processing, and the new type has become known in technically knowledgeable circles as "fake RAID" even though the RAID itself is implemented correctly. Adaptec calls them "host RAID".''[http://en.wikipedia.org/wiki/RAID]<br />
<br />
See [[Wikipedia:RAID]] or [https://help.ubuntu.com/community/FakeRaidHowto FakeRaidHowto @ Community Ubuntu Documentation] for more information.<br />
<br />
Despite the terminology, "fake RAID" via {{Pkg|dmraid}} is a robust software RAID implementation that offers a solid system to mirror or stripe data across multiple disks with negligible overhead for any modern system. dmraid is comparable to mdraid (pure Linux software RAID) with the added benefit of being able to completely rebuild a drive after a failure '''before''' the system is ever booted.<br />
<br />
== History ==<br />
<br />
In Linux 2.4, the ATARAID kernel framework provided support for fake RAID (software RAID assisted by the BIOS). For Linux 2.6 the device-mapper framework can, among other nice things like [[LVM]] and EVMS, do the same kind of work as ATARAID in 2.4. Whilst the new code handling the RAID I/O still runs in the kernel, device-mapper is generally configured by a userspace application. It was clear that when using the device-mapper for RAID, detection would go to userspace.<br />
<br />
Heinz Maulshagen created the dmraid tool to detect RAID sets and create mappings for them. The controllers supported are (mostly cheap) fake RAID IDE/SATA controllers which contain BIOS functions. Common examples include: Promise FastTrak controllers; HighPoint HPT37x; Intel Matrix RAID; Silicon Image Medley; and NVIDIA nForce.<br />
<br />
== Supported hardware ==<br />
<br />
* Tested with ICH10R on ''2009.08'' (x86_64) -- [[User:Pointone|pointone]] 23:10, 29 November 2009 (EST)<br />
* Tested with Sil3124 on ''2009.02'' (i686) -- [[User:Loosec|loosec]]<br />
* Tested with nForce4 on ''Core Dump'' (i686 and x86_64) -- [[User:Loosec|loosec]]<br />
* Tested with Sil3512 on ''Overlord'' (x86_64) -- [[User:Loosec|loosec]]<br />
* Tested with nForce2 on ''2011.05'' (i686) -- [[User:Jere2001|Jere2001]]; [[User:drankinatty|drankinatty]]<br />
* Tested with nVidia MCP78S on ''2011.06'' (x86_64) -- [[User:drankinatty|drankinatty]]<br />
* Tested with nVidia CK804 on ''2011.06'' (x86_64) -- [[User:drankinatty|drankinatty]]<br />
* Tested with AMD Option ROM Utility using pdc_adma on ''2011.12'' (x86_64)<br />
<br />
For more information on supported hardware, see [http://en.gentoo-wiki.com/wiki/RAID/Onboard RAID/Onboard @ Gentoo Linux Wiki]<br />
<br />
== Backup ==<br />
<br />
{{Warning|Backup all data before playing with RAID. What you do with your hardware is only your own fault. Data on RAID stripes is highly vulnerable to disc failures. Create regular backups or consider using mirror sets. '''Consider yourself warned!'''}}<br />
<br />
== Outline ==<br />
<br />
* Preparation<br />
* Boot the installer<br />
* Load dmraid<br />
* Perform traditional installation<br />
* Install GRUB<br />
<br />
== Preparation ==<br />
<br />
*Open up any needed guides (e.g. [[Beginners' Guide]], [[Official Arch Linux Install Guide]]) on another machine. If you do not have access to another machine, print it out.<br />
*Download the latest Arch Linux install image.<br />
*Backup all important files since everything on the target partitions will be destroyed.<br />
<br />
=== Configure RAID sets ===<br />
<br />
{{Warning|If your drives are not already configured as RAID and Windows is already installed, switching to "RAID" may cause Windows to BSOD during boot.[http://support.microsoft.com/kb/316401/]}}<br />
<br />
*Enter your BIOS setup and enable the RAID controller.<br />
**The BIOS may contain an option to configure SATA drives as "IDE", "AHCI", or "RAID"; ensure "RAID" is selected.<br />
*Save and exit the BIOS setup. During boot, enter the RAID setup utility.<br />
** The RAID utility is usually either accessible via the boot menu (often F8, F10 or CTRL+I) or whilst the RAID controller is initializing.<br />
*Use the RAID setup utility to create preferred stripe/mirror sets.<br />
<br />
{{Tip|See your motherboard documentation for details. The exact procedure may vary.}}<br />
<br />
== Boot the installer ==<br />
<br />
See [[Official Arch Linux Install Guide#Pre-Installation]] for details.<br />
<br />
== Load dmraid ==<br />
<br />
Load device-mapper and find RAID sets:<br />
<br />
# modprobe dm_mod<br />
# dmraid -ay<br />
# ls -la /dev/mapper/<br />
<br />
Example output:<br />
<br />
/dev/mapper/control <- Created by device-mapper; if present, device-mapper is likely functioning<br />
/dev/mapper/sil_aiageicechah <- A RAID set on a Silicon Image SATA RAID controller<br />
/dev/mapper/sil_aiageicechah1 <- First partition on this RAID Set<br />
<br />
If there is only one file ({{ic|/dev/mapper/control}}), check if your controller chipset module is loaded with {{Ic|lsmod}}. If it is, then dmraid does not support this controller or there are no RAID sets on the system (check RAID BIOS setup again). If correct, then you may be forced to use [[Installing with Software RAID or LVM|software RAID]] (this means no dual-booted RAID system on this controller).<br />
<br />
If your chipset module is NOT loaded, load it now. For example:<br />
<br />
# modprobe sata_sil<br />
<br />
See {{ic|/lib/modules/`uname -r`/kernel/drivers/ata/}} for available drivers.<br />
<br />
To test the RAID sets:<br />
<br />
# dmraid -tay<br />
<br />
== Perform traditional installation ==<br />
<br />
Switch to '''tty2''' and start the installer:<br />
<br />
# /arch/setup<br />
<br />
=== Partition the RAID set ===<br />
<br />
*Under '''Prepare Hard Drive''' choose '''Manually partition hard drives''' since the '''Auto-prepare''' option will '''not''' find your RAID sets.<br />
*Choose OTHER and type in your RAID set's full path (e.g. {{ic|/dev/mapper/sil_aiageicechah}}). Switch back to '''tty1''' to check your spelling.<br />
*Create the proper partitions the normal way.<br />
<br />
{{Tip|This would be a good time to install the "other" OS if planning to dual-boot. If installing Windows XP to "C:" then all partitions before the Windows partition should be changed to type [1B] (hidden FAT32) to hide them during the Windows installation. When this is done, change them back to type [83] (Linux). Of course, a reboot unfortunately requires some of the above steps to be repeated.}}<br />
<br />
=== Mounting the filesystem ===<br />
<br />
If -- and this is probably the case -- you do not find your newly created partitions under '''Manually configure block devices, filesystems and mountpoints''':<br />
<br />
*Switch back to '''tty1'''.<br />
<br />
*Deactivate all device-mapper nodes:<br />
# dmsetup remove_all<br />
<br />
*Reactivate the newly-created RAID nodes:<br />
# dmraid -ay<br />
# ls -la /dev/mapper<br />
<br />
*Switch to '''tty2''', re-enter the '''Manually configure block devices, filesystems and mountpoints''' menu and the partitions should be available.<br />
<br />
{{Warning|NEVER delete a partition in cfdisk to create 2 partitions with dmraid after '''Manually configure block devices, filesystems and mountpoints''' have been set. (really screws with dmraid metadata and existing partitions are worthless) Solution: delete the array from the bios and re-create to force creation under a new /dev/mapper ID, reinstall/repartition.}}<br />
<br />
=== Install and configure Arch ===<br />
<br />
{{Tip|Utilize three consoles: the setup GUI to configure the system, a chroot to install GRUB, and finally a cfdisk reference since RAID sets have weird names.<br />
<br />
* '''tty1:''' chroot and grub-install<br />
* '''tty2:''' /arch/setup<br />
* '''tty3:''' cfdisk for a reference in spelling, partition table and geometry of the RAID set<br />
<br />
Leave programs running and switch to when needed.}}<br />
<br />
Re-activate the installer ('''tty2''') and proceed as normal with the following exceptions:<br />
<br />
*Select Packages<br />
**Ensure '''dmraid''' is marked for installation<br />
<br />
*Configure System<br />
**Add '''dm_mod''' to the MODULES line in {{ic|mkinitcpio.conf}}. If using a mirrored (RAID 1) array, additionally add '''dm_mirror'''<br />
**Add '''chipset_module_driver''' to the MODULES line if necessary<br />
**Add '''dmraid''' to the HOOKS line in {{ic|mkinitcpio.conf}}; preferably after '''sata''' but before '''filesystems'''<br />
<br />
== Install GRUB ==<br />
<br />
{{Warning|You can normally specify '''default saved''' instead of a number in {{ic|menu.lst}} so that the default entry is the entry saved with the command '''savedefault'''. If you are using dmraid do not use '''savedefault''' or your array will de-sync and will not let you boot your system.}}<br />
<br />
Please read [[GRUB]] for more information about configuring GRUB. Installation is begun by selecting '''Install Bootloader''' from the Arch installer.<br />
<br />
{{Note|For an unknown reason, the default {{ic|menu.lst}} will likely be incorrectly populated when installing via fake RAID. Double-check the '''root''' lines (e.g. {{Ic|root (hd0,0)}}).<br />
<br />
Additionally, if you did '''not''' create a separate {{ic|/boot}} partition, ensure the kernel/initrd paths are correct (e.g. {{ic|/boot/vmlinuz-linux}} and {{ic|/boot/initramfs-linux.img}} instead of {{ic|/vmlinuz-linux}} and {{ic|/initramfs-linux.img}}.}}<br />
<br />
For example, if you created logical partitions (creating the equivalent of sda5, sda6, sda7, etc.) that were mapped as:<br />
<br />
<pre><br />
/dev/mapper | Linux GRUB Partition<br />
| Partition Number<br />
nvidia_fffadgic |<br />
nvidia_fffadgic5 | / 4<br />
nvidia_fffadgic6 | /boot 5<br />
nvidia_fffadgic7 | /home 6<br />
</pre><br />
<br />
The correct root designation would be '''(hd0,5)''' in this example.<br />
<br />
{{Note|If you use more than one set of dmraid arrays or multiple Linux distributions installed on different dmraid arrays (for example 2 disks in nvidia_fdaacfde and 2 disks in nvidia_fffadgic and you are installing to the second dmraid array (nvidia_fffadgic)), you will need designate the second array's {{ic|/boot}} partition as the GRUB root. In the example above, if nvidia_fffadgic was the second dmraid array you were installing to, your root designation would be root '''(hd1,5)'''.}}<br />
<br />
After saving the configuration file, the GRUB installer will '''FAIL'''. However it will still copy files to {{ic|/boot}}. '''DO NOT GIVE UP AND REBOOT''' -- just follow the directions below:<br />
<br />
*Switch to '''tty1''' and [[chroot]] into our installed system:<br />
<br />
# mount -o bind /dev /mnt/dev<br />
# mount -t proc none /mnt/proc<br />
# mount -t sysfs none /mnt/sys<br />
# chroot /mnt /bin/bash<br />
<br />
*Switch to '''tty3''' and look up the geometry of the RAID set. In order for cfdisk to find the array and provide the proper C H S information, you may need to start cfdisk providing your raid set as the first argument. (i.e. cfdisk /dev/mapper/nvidia_fffadgic):<br />
**The number of '''C'''ylinders, '''H'''eads and '''S'''ectors on the RAID set should be written at the top of the screen inside cfdisk. '''Note:''' cfdisk shows the information in '''H S C''' order, but grub requires you to enter the geometry information in '''C H S''' order.<br />
:Example: <code>18079 255 63</code> for a RAID stripe of two 74GB Raptor discs.<br />
:Example: <code>38914 255 63</code> for a RAID stripe of two 160GB laptop discs.<br />
*GRUB will fail to properly read the drives; the '''geometry''' command must be used to manually direct GRUB:<br />
**Switch to '''tty1''', the chrooted environment.<br />
**Install GRUB on {{ic|/dev/mapper/raidSet}}:<br />
<br />
# dmsetup mknodes<br />
# grub --device-map=/dev/null<br />
<br />
grub> device (hd0) /dev/mapper/raidSet<br />
grub> geometry (hd0) C H S<br />
<br />
Exchange '''C H S''' above with the proper numbers (be aware: they are '''not''' entered in the same order as they are read from cfdisk).<br />
<br />
If geometry is entered properly, GRUB will list partitions found on this RAID set. You can confirm that grub is using the correct geometry and verify the proper grub root device to boot from by using the grub find command. If you have created a separate boot partition, then search for /grub/stage1 with find. If you have no separate boot partition, then search /boot/grub/stage1 with find. Examples:<br />
<br />
grub> find /grub/stage1 # use when you have a separate boot partition<br />
grub> find /boot/grub/stage1 # use when you have no separate boot partition<br />
<br />
Grub will report the proper device to designate as the grub root below (i.e. (hd0,0), (hd0,4), etc...) Then, continue to install the bootloader into the Master Boot Record, changing "hd0" to "hd1" if required.<br />
<br />
grub> root (hd0,0)<br />
grub> setup (hd0)<br />
grub> quit<br />
<br />
{{Note|1=With dmraid >= 1.0.0.rc15-8, partitions are labeled "raidSet'''p1''', raidSet'''p2''', etc. instead of raidSet'''1''', raidSet'''2''', etc. If the setup command fails with "error 22: No such partition", temporary symlinks must be created.[http://bugs.gentoo.org/275566]<br />
<br />
The problem is that GRUB still uses an older detection algorithm, and is looking for {{ic|/dev/mapper/raidSet1}} instead of {{ic|/dev/mapper/raidSetp1}}.<br />
<br />
The solution is to create a symlink from {{ic|/dev/mapper/raidSetp1}} to {{ic|/dev/mapper/raidSet1}} (changing the partition number as needed). The simplest way to accomplish this is to:}}<br />
# cd /dev/mapper<br />
# for i in raidSetp*; do ln -s $i ${i/p/}; done<br />
<br />
Lastly, if you have multiple dmraid devices with multiple sets of arrays set up (say: nvidia_fdaacfde and nvidia_fffadgic), then create the {{ic|/boot/grub/device.map}} file to help GRUB retain its sanity when working with the arrays. All the file does is map the dmraid device to a traditional hd#. Using these dmraid devices, your device.map file will look like this:<br />
<br />
(hd0) /dev/mapper/nvidia_fdaacfde<br />
(hd1) /dev/mapper/nvidia_fffadgic<br />
<br />
And now you are finished with the installation!<br />
<br />
# reboot<br />
<br />
== Troubleshooting == <br />
<br />
=== Booting with degraded array ===<br />
<br />
One drawback of the fake RAID approach on GNU/Linux is that dmraid is currently unable to handle degraded arrays, and will refuse to activate. In this scenario, one must resolve the problem from within another OS (e.g. Windows) or via the BIOS/chipset RAID utility. <br />
<br />
Alternatively, if using a mirrored (RAID 1) array, users may temporarily bypass dmraid during the boot process and boot from a single drive:<br />
<br />
# Edit the '''kernel''' line from the [[GRUB]] menu<br />
## Remove references to dmraid devices (e.g. change {{ic|/dev/mapper/raidSet1}} to {{ic|/dev/sda1}})<br />
## Append {{Ic|<nowiki>disablehooks=dmraid</nowiki>}} to prevent a kernel panic when dmraid discovers the degraded array<br />
# Boot the system<br />
<br />
=== Error: Unable to determine major/minor number of root device ===<br />
<br />
If you experience a boot failure after kernel update where the boot process is unable to determine major/minor number of root device, this might just be a timing problem (i.e. dmraid -ay might be called before /dev/sd* is fully set up and detected). This can effect both the normal and LTS kernel images. Booting the 'Fallback' kernel image should work. The error will look something like this:<br />
<br />
Activating dmraid arrays...<br />
no block devices found<br />
Waiting 10 seconds for device /dev/mapper/nvidia_baaccajap5<br />
Root device '/dev/mapper/nvidia_baaccajap5' doesn't exist attempting to create it.<br />
Error: Unable to determine major/minor number of root device '/dev/mapper/nvidia_baaccajap5'<br />
<br />
To work around this problem:<br />
:* boot the Fallback kernel<br />
:* insert the 'sleep' hook in the HOOKS line of /etc/mkinitcpio.conf after the 'udev' hook like this:<br />
<br />
HOOKS="base udev sleep autodetect pata scsi sata dmraid filesystems"<br />
<br />
:* rebuild the kernel image and reboot<br />
<br />
=== dmraid mirror fails to activate ===<br />
<br />
Does everything above work correctly the first time, but then when you reboot dmraid cannot find the array?<br />
<br />
This is because Linux software raid (mdadm) has already attempted to mount the fakeraid array during system init and left it in an umountable state. To prevent mdadm from running, move the udev rule that is responsible out of the way:<br />
<br />
# cd /lib/udev/rules.d<br />
# mkdir disabled<br />
# mv 64-md-raid.rules disabled/<br />
# reboot</div>Jyrihovila