Installing with Fake RAID

From ArchWiki
Revision as of 12:45, 8 November 2007 by Loosec (Talk | contribs) (Simple guide on how to install Arch on BIOS (Onboard) RAID with dmraid)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


History

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 do, among other nice things like LVM and EVMS, the same kind of work as ATARAID in 2.4. While the new code handling the RAID's I/O still runs in the kernel, device-mapper stuff is generally configured by a userspace application. It was clear that when using the device-mapper for RAID, detection would go to userspace.

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 have BIOS functions on it. Most common ones are: Promise Fasttrack controllers as well as HPT 37x, Intel, VIA and LSI. Also serial ata RAID controllers like Silicon Image Medley and Nvidia Nforce are supported by the program.

Disclaimer

Backup all data before playing with RAID

General Description

The purpose of this doc is to be able to create one single drive from a set of sata/ide drives using the onboard Fake-RAID controller and thereby opening up the possibility for dualbooting with other operating systems. We will be booting with GRUB from this RAID-device.

This guide uses a mix of the regular install, the quickinstall, dmraid and a custom pkgbuild by uwolfer.
Note: You NEED to build the dmraid package on a working system and somehow bring it to the installation since it is still in AUR.

Outline

  1. Preparation
  2. Boot the Installer CD
  3. Install dmraid
  4. Partition the RAID Set
  5. Reboot [if needed]
  6. Create and Mount the Main Filesystems
  7. Install and Configure Arch
  8. Install Grub on the RAID Set
  9. Unmount Filesystems and Reboot

Procedure

Preparation

Preferably use an existing archlinux system for this.

Archlinux

Print out the guides you need.
Get the latest core image.
Get uwolfers PKGBUILD and make it: http://bugs.archlinux.org/task/4762?getfile=1500

# tar xvvzf dmraid.tar.gz
# sudo makepkg

Copy the whole content of this folder to the installer cd-image and burn it. Or put it on a USB-stick, slightly simpler.
Burn the cd-image.

Backup all important files, seriously. All partitions on the target disks will be overwritten.
Reboot

BIOS

Enter your BIOS and enable the proper raid controllers and channels. Make your CD-drive First Boot Priority. Save and Exit BIOS. Enter your RAID BIOS setup utility and create your Stripe or Mirror.

Boot the installer CD

If your screen can handle it consider adding vga=795 as a boot option. Don't worry about the raid-devices here, we need to install dmraid first.

Install dmraid

I am going to assume this is added to the installer CD root directory dmraid and arch finds the CD under /dev/sr0

$ mount /dev/sr0 /src
$ pacman -A /src/dmraid/dmraid-1.0.0.rc14-1-i686.pkg.tar.gz
$ dmraid -ay
$ ls -l /dev/mapper/


Example:

/dev/mapper/control           <-- This is created by device-mapper
/dev/mapper/nvidia_geceiece   <-- This is the whole RAID set.
/dev/mapper/nvidia_geceiece1  <-- This is the first partition on this RAID set

If you do not find anything bud /dev/mapper/control then dmraid does not support your controller. Your options are to use Software RAID, this means no dualbooted RAID system, or get a supported controller.

Partition the RAID Set

Example:

/dev/mapper/your_raid_set   <-- This is the whole RAID set.
/dev/mapper/your_raid_set1  <-- Used as /boot
/dev/mapper/your_raid_set2  <-- Used as swap
/dev/mapper/your_raid_set3  <-- Used as /

Create the proper partitions, deactivate all RAID devices and reactivate the newly created RAID devices.

$ cfdisk /dev/mapper/your_raid_set
$ dmraid -an
$ dmraid -ay
$ ls /dev/mapper

Reboot [if needed]

If you do not get any new /dev/mapper/your_raid_set1 etc a reboot will fix this. Just install dmraid again like in the previous step.

Create and Mount the Main Filesystems

$ mke2fs /dev/mapper/your_raid_set1
$ mkswap /dev/mapper/your_raid_set2
$ mke2fs -j /dev/mapper/your_raid_set3
$ mount /dev/mapper/your_raid_set3 /mnt/
$ mkdir /mnt/boot
$ mount /dev/mapper/your_raid_set1 /mnt/boot/

Install and Configure Arch

We will use three consoles, the quickinstall script to get all files on the system, the setup gui to configure the system and chroot to install grub.
tty1: /arch/quickinstall and chroot
tty2: /arch/setup
tty3: fdisk and later cfdisk to easily find the correct partitions

Install packages

$ /arch/quickinstall cd /mnt/ /src/core/pkg/
$ mount -t sysfs none /mnt/sys
$ mount -t proc none /mnt/proc
$ mount -o bind /dev /mnt/dev

It is now necessary to add dmraid to the installed system. This should be done before we chroot into /mnt so we do not get problems with filesystem size beeing too limited.
Install dmraid and update nodes (to help GRUB)

$ pacman --root /mnt/ -A /src/dmraid/dmraid-1.0.0.rc14-1-i686.pkg.tar.gz
$ chroot /mnt/ /bin/bash/
$ dmsetup mknodes
$ ls /dev/mapper

The dmraid package is installed, the dmraid hook and install scripts are put in place and it's time to configure the system.

Setup Arch

Switch to 'tty2 and run:

$ /arch/setup 

Go directly to the System configuration menu and let the installer use it's autodetect features, you do not need to enable any software raid, encryption or lvm features for this to work.
Edit mkinitcpio.conf and add dmraid to the HOOKS line. It is probably a good idea to do this right after 'sata'. You should alsa check that your sata driver was properly found by the autoconfig and put inside MODULES.
Save and exit this menu. As the kernel is regenerated check for Running hook [dmraid] and see that it installs properly.

Install Grub on the RAID Set

Choose Install Bootloader from the arch setup menu and choose GRUB.
Find and choose /dev/mapper/your_raid_set. We are not installing on software RAID if the installer asks. The installation will fail, but not before it has copied all necessary files to /mnt/boot/.
Do not exit the gui installer, this will unmount the filesystems we previously mounted for dmraid install and chroot.

Note: This part is copied/remembered from a gentoo wiki about dmraid and dualboot.

Switch to tty3, run fdisk and print out the geometry of our RAID Set. Cylinders, Heads, Sectors.

$ fdisk /dev/mapper/your_raid_set
fdisk> p
fdisk> q

Write down C H S, in my case 18079 255 63
Switch to tty1, the chrooted environment. Install GRUB:

$ grub-install --device-map=/dev/null
grub> device (hd0) /dev/mapper/your_raid_set
grub> geometry (hd0) C H S
If this was entered correctly GRUB will spit out a list of partitions found on this RAID set.
grub> root (hd0,0)
grub> setup (hd0,0)
grub> quit

Edit menu.lst to boot from your root partition.

$ nano -w /boot/grub/menu.lst

Change root=/dev/sda3 to root=/dev/mapper/your_raid_set3 where this is your root partition.
Edit /etc/fstab and add your mountpoints:

$ echo" /dev/mapper/your_raid_set3 /	 ext3	defaults  0  1" >> /etc/fstab
$ echo" /dev/mapper/your_raid_set2 swap  swap 	defaults  0  0" >> $ /etc/fstab
$ echo" /dev/mapper/your_raid_set1 /boot ext2 	defaults  0  0" >> /etc/fstab

Exit the chrooted environment.
Switch back to the gui installer (tty2) and configure anything you want, just don't mess with any settings earlier created in mkinitcpio.
Exit installer, unmount filesystems, reboot and remove installer CD.

$ umount /mnt/*
$ umount /mnt
$ reboot

DualBoot Windows Xp

As a sidenote, if you are doing this installation you probably want to dualboot it with Windows Xp.
A good procedure for this would be:

  • Look at the gentoo guide below and combine it properly with this guide.

External Links

Bug report on adding dmraid to the installer cd: http://bugs.archlinux.org/task/4762
Forum thread that lead to this guide: http://bbs.archlinux.org/viewtopic.php?id=22038
Gentoo Wiki page that greatly contributed: http://gentoo-wiki.com/HOWTO_Gentoo_Install_on_Bios_(Onboard)_RAID