个人工具

UbuntuHelp:FakeRaidHowto

来自Ubuntu中文

跳转至: 导航, 搜索
Warning
FakeRAID is not supported by Ubuntu. Trying to install Ubuntu on such a partition could easily result in the loss of all your data.

How to install Ubuntu onto a fakeRAID system

目录

Introduction

What is fakeRAID?

In the last few years, a number of hardware products have come onto the market claiming to be IDE or SATA RAID controllers. These have shown up in a number of desktop/workstation motherboards and lower-end servers such as the HP DL360 G5, if ordered without the optional RAID card. Virtually none of these are true hardware RAID controllers. Instead, they are simply multi-channel disk controllers combined with special BIOS configuration options and software drivers to assist the OS in performing RAID operations. This gives the appearance of a hardware RAID, because the RAID configuration is done using a BIOS setup screen, and the operating system can be booted from the RAID. With the advent of Terabyte disk drives, FakeRAID is becoming a popular option for entry-level small business servers to simply mirror 2 1.5 TB drives, and dispense with an expensive hardware RAID 5 array. Older Windows versions required a driver loaded during the Windows install process for these cards, but that is changing as it has already changed in FreeBSD (which has FakeRAID support built into the ATAPI disk driver). Under Linux, which has built-in softRAID functionality that pre-dates these devices, the hardware is normally seen for what it is -- multiple hard drives and a multi-channel IDE/SATA controller. Hence, fakeRAID.

Why not use a linux software raid?

If you have arrived here after researching this topic on the Internet, you know that a common response to this question is, "I don't know if you can actually do that, but why bother -- Linux has built-in softRAID capability." Also, it's not clear that there is any performance gain using hardware fakeRAID under Linux instead of the built-in softRAID capability; the CPU still ends up doing the work. The most common reason for using fakeRAID is in a dual-boot environment, where both Linux and Windows must be able to read and write to the same RAID partitions. Multiboot configurations are common among cross-over users trying Linux out, for people forced to use Windows for work, and for other reasons. These people shouldn't have to add a separate hard drive just so they can boot Linux. FakeRAID allows these users to access partitions interchangeably from either Linux or Windows. Another reason for using FakeRAID is if you define a disk mirror and a hard drive crashes, you can down the system and replace the failed drive and rebuild the mirror from the BIOS without having to boot into the operating system. This wiki describes how to get Linux to see the RAID as one disk and boot from it in the same way that windows will install on this type of device. This document is constantly updated by users like you and is a "living" document to which your contributions are welcome.

Notes

General Notes

/!\ Ubiquity will fail when installing grub, and will not automatically add dmraid to the new installation. this need to be done manually. (the Installation guide for 8.10 and 9.04 contain the step required to manually install these items. /!\ 'Alternate CD' is different to the standard Ubuntu iso download. Trying to install a fakeRAID Ubuntu with the standard iso using the Alternate CD install method will fail. /!\ The Live CD is not present in any server install ISOs. Use the desktop iso. /!\ It's critical to have dmraid loaded if your in a dual-boot environment, with the /dev/mapper/XX entries. If you install to the drives without this running you WILL have access to the section of the hard drive that the disk metadata is located on that the controller uses, and you can wipe it out or damage it, ruining your array. If your FakeRAID array is striped, not mirrored, you will scramble all your data if this happens.

RAID-1

/!\ You should be aware that dmraid (especially the dm-raid1 target of the device mapper) currently (including kernel version 2.6.17) supports the mirroring with RAID-1, but it has no error handling. When a block on one disk fails a failure reaches up to the application level, currently it doesn't try to read from the second disk. It only mirrors all data to the second disk. So it secures the system from data loss, but the system can nonetheless crash. There exists patches for the 2.6.17 kernel series which enables a higher read speed and error handling in failure case, but until now they are not incorporated. External links regarding RAID-1: Running Ubuntu On a Fakeraid/1 array described how to adapt the original HOWTO to a RAID-1 (mirroring) array.

RAID-5

Since version 8.10 (Intrepid Ibex) Ubuntu has RAID5 support built into the kernel loading the right module. also dmraid is now in the 'main' respository, and can be installed without reconfiguring apt. Once dmraid is running, the live installer can handle installing to the raid.

Installation

Warning
Always when installing something of this magnitude make sure that you back up anything of importance.

Ubuntu 9.10 ( Karmic Koala)

The automatic installer may or may not work out of the box. When I tried it, it didn't work the first time and I had to manually install dmraid. But it did work the second time on the same machine, (with disks that had been wiped) The problem appears to be installing grub2 Use the LiveCD method

  • Boot the system with the Live CD
  • Run the partitioner program gpartd (System->Gpart)

9.10 loads dmraid automatically so you should see for a disk device /dev/mapper/pdc_feddabdf or some suchlike if dmraid detected and can use a fakeraid partition

  • Setup an extended partition using whatever space your going to allocate for Ubuntu

or the entire drive. Setup a minimum of 2 logical partitions in the extended partition, the first will be formatted ext4 and the last swap. Set the type on the swap partition to swap. Format the first partition. Exit gpart

  • Run the installer. When it gets to it's partitioner, change the mount point on the first

partition to / DO NOT format it! Do NOT make any partition changes! The installer partitioner does not understand dmraid partitions properly

  • In the installer summary screen right before the copy process starts, click the Advanced button. Change the boot partition (this is the MSDOS-style "parent" partition not the Linux partitions) to /dev/mapper/pdc_feddabdf (or whatever dmraid lists as your fakeraid partition) Make sure the checkbox is clicked to boot from this disk. note that the installer will modify grub2 to point to the correct logical partition /dev/mapper/pdc_feddabdf1 or whatever / is on.
  • When the installer finishes DO NOT REBOOT, the new system will be mounted on /target. If you rebooted then run the terminal screen and mount the /dev/mapper/pdc_feddabddf4 (root) partition (this is the target the installer put the root on) on some convenient directory (/tmp/tmp or some such) chroot that directory (/target or whatever it's mounted on)
  • Run the command "apt-get install dmraid" If your lucky you will get a message back saying that the system didn't need to do anything as the installer will have correctly built initrd for grub to include dmraid. Otherwise this will update dmraid and rebuild the grub init to load dmraid. Exit the terminal and click reboot, or type "shutdown -r now" at the terminal window
  • When the system comes back up login and verify that /dev/mapper/pdc_feddabdf (or whatever dmraid names your

fakeraid) exists, and use df to verify that the system is mounted on it. (it will say it at the top)

Ubuntu 9.04 (Jaunty Jackalope)

Alternate CD Installation

/!\ MAKE SURE YOU BACK UP ANYTHING OF IMPORTANCE!!! Intrepid users and up can now install directly to SATA RAID with no additional setup or configuration required. The installer will prompt you to activate the RAID partitions, which will make them available to the partitioner and allow you to continue with the installation as normal.<
> After defragmenting your existing fakeRAID system and resizing the volume to free space, load the Alternate CD.

Install Options

When Ubuntu splash screen loads, choose the default choice Install Ubuntu.

Language

Choose the default language for your installation.

Keyboard Layout

Select your keyboard layout.

Hardware
  • -|Detecting Hardware|- watch the screen
  • -|Scanning CD - ROM|- or not
  • -|Loading additional components|-
  • -|Detecting network|-
  • -|configuring the network with DHCP|-
Network

Enter a host name.

Time Zone

Select your time zone.

Disk Detection
  • -| Detecting disks and all other hardware |-
  • -| [!] Detect Disks |-

/!\ If the following doesn't appear this method will likely fail to load the Linux fakeRAID support and this method is not for you! "One or more drives containing Serial ATA RAID configurations have been found. Do you wish to activate these RAID devices?" Select yes.

Partition
  • -| [!!] Partition Disks |-
Guided - resize serial ATA RAID isw_chihadihib_ARRAY3 (partition

The following assumes you picked Manual

  • -| [!!] Partition Disks |-
Guided partitioning
serial ATA RAID isw_chihadihib_ARRAY3 () - 640.1 GB Linux device-m
 #1 primary 74.0 MB fat 16
 #2 primary 16.1 GB ntfs
 #3 primary 334.4 GN B ntfs
 pri/log 289.5 GB FREE SPACE

the following assumes you pick the free space you emptied in Windows pri/log 289.5 GB FREE SPACE

  • -| [!!] Partition Disks |-
Create a new partition
  • -| [!!] Partition Disks |- New partition size

the total free space will be selected BUT change it to allow for a swap partition at least the size of your RAM. In this example 277.7 GB to allow for a 11G swap partition

  • -| [!!] Partition Disks |-
Logical
  • -| [!!] Partition Disks |-
Beginning
  • -| [!!] Partition Disks |-

strangely you chose "use as Ext3 journalling file system" if you want to change that option

  • -| [!!] Partition Disks |- Ext3 journalling file system

chose Ext4 journalling file system if you prefer use as Ext4 journalling file system

  • -| [!!] Partition Disks |-

leave the mount point / chose Done setting up the partition

  • -| [!!] Partition Disks |- Guided partitioning
serial ATA RAID isw_chihadihib_ARRAY3 () - 640.1 GB Linux device-m
#1 primary 74.0 MB fat 16
#2 primary 16.1 GB ntfs
#3 primary 334.4 GN B ntfs
#4 logical 277.7 GB f ext4 /
logical 11.8 GB FREE SPACE

Choose logical 11.8 GB FREE SPACE

  • -| [!!] Partition Disks |-
Create a new partition
  • -| [!!] Partition Disks |- New partition size
11.8 GB
  • -| [!!] Partition Disks |-

again select use as Ext3 journalling file system to change it

  • -| [!!] Partition Disks |- tab to choose swap area
  • -| [!!] Partition Disks |- tab to chose done setting up the partition
  • -| [!!] Partition Disks |- Guided partitioning
 serial ATA RAID isw_chihadihib_ARRAY3 () - 640.1 GB Linux device-m
 #1 primary 74.0 MB fat 16
 #2 primary 16.1 GB ntfs
 #3 primary 334.4 GN B ntfs
 #4 logical 277.7 GB f ext4 /
 #5 logical 11.8 GB f swap swap 

/!\ Remember the partition that has Windows on it. In this case the third one on the first disk, which would be (hd0,2) as disks and partition numbers start at 0. Choose Finish Partitioning to write changes to disk.

  • -| [!!] Partition Disks |- Write the changes to disk? tab to choose <Yes>
  • -| Partitions formatting |-
Finish the Install

39. -| Installing the base system |- watch the screen or not 40. -| [!!} Setup users and passwords|- Full name of the new user enter your name 41. -| [!} Setup users and passwords|- Username 42. -| [!} Setup users and passwords|- Choose a password for the new user: 43. -| [!} Setup users and passwords|- Reenter password to verify: 44. -| [!} Setup users and passwords|- Encrypt home directory?

45. -| Configuring apt |- 46. -| [!] Configure the package manager |- HTTP proxy adjust or just hit enter 47. -| Configuring apt |- 48. -| Select and install software |- Retrieving file n of 863 Preparing x Configuring x ... 49. -| Configuring Grub |- If everything is to plan you will get a message such as: The following other operating systems have been detected Windows Vista (loader) Install the GRUB boot loader to the master boot record

  • . -| Finishing the installation |- Ejecting CD ROM
  • . -| [!!] Finish the installation |- Installation complete

At this point on boot Grub will either give you an option to boot into Windows or Ubuntu or just Ubuntu. If the installer fails (it did on two occasions for me) to provide a Windows boot option you have to add it manually to `/boot/grub/menu.lst`. Before making changes, backup the current version. Recall the Windows partition from above, in this case (hd0,2).

sudo gedit /boot/grub/menu.lst

Add the following menu option.

title           Windows
rootnoverify (hd0,2)
makeactive
chainloader +1

If you don’t remember which partition has Windows find the mounted partitions.

$ cd /dev/mapper/
$ ls

Note the name of the RAID volume or array. For example, something like isw_chihadihib_ARRAY.

$ sudo fdisk isw_chihadihib_ARRAY
Command (m for help): p

Disk isw_chihadihib_ARRAY: 640.1 GB, 640132714496 bytes
255 heads, 63 sectors/track, 77825 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xb0000000

               Device Boot      Start         End      Blocks   Id  System
isw_chihadihib_ARRAY1               1           9       72261   de  Dell Utility
isw_chihadihib_ARRAY2              10        1968    15728640    7  HPFS/NTFS
isw_chihadihib_ARRAY3   *        1968       42628   326606844    7  HPFS/NTFS
isw_chihadihib_ARRAY4           42629       77825   282719902+   5  Extended
isw_chihadihib_ARRAY5           42629       76390   271193233+  83  Linux
isw_chihadihib_ARRAY6           76391       77825    11526606   82  Linux swap / Solaris

In this case Windows is on the third partition, (hd0,2).

Live CD Installation (Ubiquity graphical installer)

/!\ MAKE SURE YOU BACK UP ANYTHING OF IMPORTANCE!!! This Section shows you how to install Ubuntu using the Ubiquity graphical installer found on the Live CD.

  1. If you need more information about any given read any of the additional information below
  2. Boot the Live CD
  3. Open a terminal
  4. Enter the following commands

(skip the first one if you are doing RAID 0 or 1)

  1. $ sudo modprobe dm-raid4-5
  2. $ sudo apt-get install -y dmraid
  3. $ sudo swapoff -a

disables erroneous use of the backing swap partitions if you are reinstalling

  1. $ sudo dmraid -ay
    1. Now check that you can view the partitions in the raid array with this command
  2. $ ls -l /dev/mapper/

OUTPUT:

 
control             isw_beeaakeeaa_five
      

we will be using the array /dev/mapper/isw_beeaakeeaa_five in this example.

  1. Create partitions on your raid array with your preferred partition manager, or do so using the partitioning tool provided in ubiquity (partitioning with ubiquity installer have not been tested)
    1. $ sudo cfdisk /dev/mapper/isw_beeaakeeaa_five
  2. We used /dev/mapper/isw_beeaakeeaa_five5 partition as Ubuntu root partition in this example.
  3. Begin the install process
    1. If doing a guided install make sure you select the raid partition. if you are going to do a manual install make sure you do not create a partition on any of the disks that make up the raid partition.
    2. On the last step before installing, click the Advanced options and uncheck the install boot loader option. We will install grub (the boot loader later).
    3. After installer finishes, close ubiquity installer without rebooting the machine.
  4. Install dmraid and grub in your new Ubuntu installation:
    1. $ sudo mount /dev/mapper/isw_beeaakeeaa_five5 /target/

    if this fails maybe the /target directory is already mounted if not then some debuging will be required. If any more information can be provided related to this issue place add your knowledge to this document

    1. $ sudo mount --bind /dev /target/dev/
    2. $ sudo mount -t proc proc /target/proc/
    3. $ sudo mount -t sysfs sys /target/sys/
    4. $ sudo cp /etc/resolv.conf /target/etc/resolv.conf
    5. $ sudo chroot /target/
    6. # apt-get update
    7. # apt-get install -y dmraid
    8. # apt-get install -y grub
    9. # mkdir /boot/grub
    10. # cp /usr/lib/grub/x86_64-pc/* /boot/grub/
    11. # grub --no-curses

    you will now be at the grub prompt grub>

    1. grub> device (hd0) /dev/mapper/isw_beeaakeeaa_five
    2. grub> find /boot/grub/stage1

    OUTPUT:

    find /boot/grub/stage1
    (hd0,4)
         

    make a note of the output from this command it will be needed later. in my case I have my linux partition as the first extended partition you most likely will have different results (remember that grub starts partition numbers in zero, so partition 5 for linux is partition 4 for grub).

    1. grub> root (hd'x','x')

    replace 'x' with the partition number from the previous step

    1. Install grub on your disk (or partition if you prefer boot your computer with another boot manager)
      1. grub> setup (hd'x')

      replace 'x' with the values gathered in the previous step or grub> setup (hd'x','x') to install grub on the partition. YOU WILL NEED ANOTHER BOOT MANAGER TO START YOUR COMPUTER

      1. grub> quit
        1. # update-grub

        say yes to creating a menu.lst

        1. now open the newly created menu list and make the following changes. Any editor can be used it is not required that you use nano # nano /boot/grub/menu.lst
          1. Change

          # groot=(hd0,0) TO # groot=(hd0,'x') root option in the boot entries to root (hd0,'x') Replace the 'x' with the partition that was found earlier

          1. Add the Windows boot entry if need be.
              title 		Windows
              rootnoverify (hd0,0)   # use the correct partition for Windows, of course
              makeactive
              chainloader +1
          2. For all Ubuntu-related boot entries, such as
               title	 Ubuntu ...
               root          (hd0,0)
               ...

          change (hd0,0) to (hd'x','x') (in my case, Linux partition was not the first one, and without these changes I would get grub "Error 17" after reboot). You can use the uuid of the mapped raid partition in a grub menu.lst uuid field instead of the root (hd'x','x') field; look in /dev/disk/by-uuid with 'ls -l'.

          1. Save and exit nano. or what ever text editor you are using.
            1. # update-grub
              1. make sure the new install of Ubuntu loads the raid module kernel
            2. # echo dm-raid4-5 >> /etc/initramfs-tools/modules
            3. # update-initramfs -u
            4. # nano /etc/modules

            and add 'dm-raid4-5' if not exists

            1. Reboot and verify both Ubuntu and the existing Windows partition boot if Windows is installed.

            Ubuntu 8.10 (Intrepid Ibex) Installation

            Alternate CD Installation

            /!\ MAKE SURE YOU BACK UP ANYTHING OF IMPORTANCE!!! {*} According to the|latest FakeRAID spec, Intrepid users can now install directly to SATA RAID with no additional setup or configuration required. This is is not yet supported in the Ubiquity graphical installer so you must use the Alternate Install CD. The installer will prompt you to activate the RAID partitions, which will make them available to the partitioner and allow you to continue with the installation as normal.

            Live CD Installation (Ubiquity graphical installer)

            /!\ MAKE SURE YOU BACK UP ANYTHING OF IMPORTANCE!!! In Short

            • Boot the Ubuntu Live CD and select Start Ubuntu without changes to the computer
            • From a terminal, run sudo apt-get install dmraid
            • Check /dev/mapper to ensure the raid was correctly detected
            • Run the installer (ubiquity), install as normal. Deselect installing grub - it will just fail anyway (but it makes no real difference if you don't)
            • From a terminal, run sudo chroot /target
            • Install dmraid to the new installation by running sudo apt-get install dmraid from the chroot environment.
            • Install grub.

            the following process has been successful on Nvidia and Intel fakeraid.

            1. Boot the Live CD
            2. Open a terminal
            3. Enter the following commands
              1. ubuntu@ubuntu:~$ sudo apt-get install -y dmraid
              2. ubuntu@ubuntu:~$ sudo modprobe dm-raid4-5
              3. ubuntu@ubuntu:~$ sudo dmraid -ay

              NOTE: If an "ERROR" is reported at this stage due to RAID failure. From the system menu, select administration, then load the Synaptics Package Manager. In the search/locate field type dmraid. When it finds the three entries, mark all for complete removal, And Apply. When it is done, simply select them again, and re-install. Problem Solved!

              1. ubuntu@ubuntu:~$ cd /dev/mapper/
              2. ubuntu@ubuntu:/dev/mapper$ ls

              OUTPUT:

              control           isw_cdccfaedhh_Vol
                   

              Make a note of the raid partition for use later. in this example the raid partitions name is isw_cdccfaedhh_Vol

              1. begin the install process
                1. if doing a guided install make sure you select the raid partition. if you are going to do a manual install make sure you do not create a partition on any of the disks that make up the raid partition.
                2. on the last step before installing click the advanced options and uncheck the install boot loader option. we will install grub(the boot loader later)
              2. once the install has finished check to see what order you partition tables came out to be. By doing the following
                1. ubuntu@ubuntu:/dev/mapper$ sudo fdisk isw_cdccfaedhh_Vol

                you will now be taken to a prompt for fdisk. (the prompt will be "Command (m for help):")

                1. Command (m for help): p

                OUTPUT:

                Disk isw_cdccfaedhh_Vol: 1500.3 GB, 1500315648000 bytes
                255 heads, 63 sectors/track, 182402 cylinders
                Units = cylinders of 16065 * 512 = 8225280 bytes
                Disk identifier: 0x000f28d8
                
                             Device Boot      Start         End      Blocks   Id  System
                isw_cdccfaedhh_Vol1               1        2490    20000893+   b  W95 FAT32
                isw_cdccfaedhh_Vol2            2491      182402  1445143140    5  Extended
                isw_cdccfaedhh_Vol5            2491        3735    10000431   83  Linux
                isw_cdccfaedhh_Vol6            3736        4482     6000246   82  Linux swap / Solaris
                isw_cdccfaedhh_Vol7            4483      182402  1429142368+  83  Linux
                
                   

                isw_cdccfaedhh_Vol1 Root partition isw_cdccfaedhh_Vol5 Storage partition isw_cdccfaedhh_Vol6 will be my windows partition isw_cdccfaedhh_Vol7 Linux swap partition 1.#7 ubuntu@ubuntu:/dev/mapper$ sudo mount isw_cdccfaedhh_Vol1 /target/ if this fails because the /target directory is busy reboot to the live cd and repeat all parts of step 4 until this command works. once you have access to /target then continue on

                1. ubuntu@ubuntu:/dev/mapper$ sudo mount --bind /dev /target/dev/
                2. ubuntu@ubuntu:/dev/mapper$ sudo mount -t proc proc /target/proc/
                3. ubuntu@ubuntu:/dev/mapper$ sudo mount -t sysfs sys /target/sys/
                4. ubuntu@ubuntu:/dev/mapper$ sudo cp /etc/resolv.conf /target/etc/resolv.conf
                5. ubuntu@ubuntu:/dev/mapper$ sudo chroot /target/
                6. root@ubuntu:/# apt-get update
                7. root@ubuntu:/# apt-get install -y dmraid
                8. root@ubuntu:/# apt-get install -y grub
                9. root@ubuntu:/# mkdir /boot/grub
                10. root@ubuntu:/# cp /usr/lib/grub/x86_64-pc/* /boot/grub/
                11. root@ubuntu:/# grub --no-curses

                this command will present you with the grub propmt . if you get an error check you syntax odds are you have typed something wrong.

                1. grub> device (hd0) /dev/mapper/isw_cdccfaedhh_Vol

                OUTPUT:

                device (hd0) /dev/mapper/isw_cdccfaedhh_Vol
                     
                1. grub> find /boot/grub/stage1

                OUTPUT:

                find /boot/grub/stage1
                (hd0,0)
                     
                • make a note of this line you will need it later.
                • in my case I have my Linux partition as the first partition you most likely will have different results
                1. grub> root (hdx,x)
                • replace the x value with the values gathered in the previous step
                1. grub> setup (hdx)
                • replace x with the values gathered in the previous step

                OUTPUT:

                setup (hd0)
                Checking if "/boot/grub/stage1" exists... yes
                Checking if "/boot/grub/stage2" exists... yes
                Checking if "/boot/grub/e2fs_stage1_5" exists... yes
                Running "embed /boot/grub/e2fs_stage1_5 (hd0)"...  16 sectors are embedded. succeeded
                Running "install /boot/grub/stage1 (hd0) (hd0)1+16 p (hd0,0)/boot/grub/stage2/boot/grub/menu.lst"... succeeded
                
                Done.
                  
                1. grub> quit
                  1. root@ubuntu:/# update-grub

                  say yes to creating a munu.lst

                  Searching for GRUB installation directory ... found: /boot/grub
                  Searching for default file ... Generating /boot/grub/default file and setting the default boot   entry to 0
                  Searching for GRUB installation directory ... found: /boot/grub
                  Testing for an existing GRUB menu.lst file ... 
                  
                  Could not find /boot/grub/menu.lst file. Would you like /boot/grub/menu.lst generated for you? (y/N) y
                  Searching for splash image ... none found, skipping ...
                  Found kernel: /boot/memtest86+.bin
                  Found kernel: /boot/vmlinuz-2.6.27-7-generic
                  Found kernel: /boot/memtest86+.bin
                  Updating /boot/grub/menu.lst ... done
                      
                  1. root@ubuntu:/# nano /boot/grub/menu.lst
                  2. Changed
                  # groot=(hd0,0)
                      

                  to

                  # groot=(hd0,x)
                      

                  replace the x with the partition you found earlier.

                  1. Changed this in the boot entries also.
                  2. Add the Windows boot entry. if needed

                  use the correct drive and partition for your Windows install. replacing the x's with the correct values

                  title 		Windows
                  rootnoverify (hdx,x)
                  makeactive
                  chainloader +1
                  
                  1. Changed the delay to a value that makes since for you and comment the 'hiddenmenu' option.

                  Noted that savedefault was set to false.

                  1. Save and exit nano.
                  2. update-grub and kept the local file.
                  3. Reboot and verify all operating system installations

                  Ubuntu 8.0.4 LTS (Hardy Heron)

                  dmraid is not loaded during the install CD boot for the server or alternate distros. Here are the general instructions for this:

                  • Boot the desktop CD and select the Live CD Run Ubuntu without affecting your computer
                  • Go to System > Administration > Software Sources and put a check in the universe box software repository. Exit and let it reload the package listing.
                  • Go to System > Administration > Synaptic Package Manager and search for and install the dmraid package

                  This next part has to be done at the command line in a terminal

                  • List the contents of /dev/mapper, there should be a listing for the fakeraid array there.
                  • Manually partition the fakeraid array of at least 2 partitions, one swap and

                  the other will be on root.

                  • write the partition info then exit fdisk, then type "sudo reboot"

                  This version of Ubuntu must be rebooted to recognize partition changes. Repeat the previous steps to load the dmraid. You can start the GUI installer from the desktop now and complete the install. Three caveats, The GUI partitioner will duplicate the partition listings on the base array, these need to be set "unused" during the install. Only the partitions you created earlier must be active The installer will not install grub properly. This must be done from the command terminal before exiting and rebooting. This installation is the same as version 7.04 (Feisty Fawn) Some Fakeraid card combinations trigger a bug introduced in 8.04 where on reboot, even with dmraid loaded, /dev/mapper only has a "control" file in it. The bug is not in dmraid, it is in how the initrd image is created, and it is fixed in 9.10 If you have a system that won't boot after installation, boot the Live CD and load dmraid then look at /dev/mapper, if it is empty then you have this bug. if your system DOES boot then look at the partitions with df - if they are NOT mounted on /dev/mapper/XXX_XXXXXX then your system is only running on the first hard drive, and you have no mirroring.

                  Ubuntu 7.04 (Feisty Fawn) And Older versions

                  {*} This procedure has been tested with Ubuntu 7.04 (Feisty Fawn). Your results may vary with other versions.

                  Install dmraid
                  GUI
                  • Boot the Ubuntu CD and select Start or Install Ubuntu
                  • Go to System > Administration > Software Sources and add the universe software repository (not required for 8.10 Intrepid or later).
                  • Go to System > Administration > Synaptic Package Manager and install the dmraid package.
                  • Go to Applications > Accessories > Terminal and run
                  sudo dmraid -ay
                  
                  Command Line
                  Install from command line:
                  sudo apt-get install dmraid
                  
                  and run
                  sudo dmraid -ay
                  

                  /!\ If you get errors or "No|RAID disks", you need to repair these before you continue.

                  Optional: Resize your Windows partition

                  If you want to dual-boot windows, you may need to resize your Windows partition to make space for Ubuntu. Most linux-based GUI tools won't properly work with fakeRAID devices, but the unix command-line combination of ntfsresize and fdisk is extremely reliable. Windows Vista users should use the Vista Partition Manager.

                  Partition the RAID Array

                  Before we can create filesystems (what Window users call "formatting"), we must slice the disk up into the partitions that hold those filesystems. You can use gparted to create and delete partitions and filesystems if you like, but we do not recommend this because:

                  1. at this time, it can not refresh the partition table after it modifies it, so you will need to change the partitions, then quit gparted, then run dmraid -ay from the command prompt to detect the new partitions, and then restart gparted before you can format the partitions.
                  2. it generates a number of erroneous error messages that cause confusion and make it difficult to tell if the process was successful
                  3. several people have become stuck at this point because of (a) and (b).

                  While it IS possible to use gparted for this, until it improves, we recommend command-line utilities for partitioning and the creation of filesystems:

                  • fdisk: partitioning (and creation of filesystems on some platforms)
                  • parted: partitioning and creation of filesystems
                  • mkfs: creation of filesystems

                  At a minimum, this should include a root partition and a swap partition (this configuration is recommended for new users). For a multi-user desktop, you may want root, swap, and home. In my case, I wanted to isolate my Windows and Linux files at the primary partition level, so I created an extended partition to hold several logical linux partitions. Also, I wanted a separate /boot partition as a security measure, so I created logical partitions for root, boot, and swap. Also, since you can only have four primary partitions on a DOS-labeled disk, using an extended partition gives me the flexibility to add more linux partitions later if I want them. If I decide to serve web apps or something, I might want logical partitions for boot, root, swap, tmp, var, usr, and home.

                  Partition Filesystem Size Description
                  /dev/hda1 ext2 32M Boot partition
                  /dev/hda2 (swap) 512M Swap partition
                  /dev/hda3 ext3 Rest of the disk Root partition

                  or

                  Partition Filesystem Size Description
                  /dev/hda1 ext2 32M Boot partition
                  /dev/hda2 (swap) 512M Swap partition
                  /dev/hda3 ext3 5G tmp
                  /dev/hda4 ext3 5G var
                  /dev/hda5 ext3 2G usr
                  /dev/hda6 ext3 2G home
                  /dev/hda7 ext3 Rest of the disk Root partition

                  Familiarize yourself with the tools by using the man pages (i.e., "man fdisk", "man parted", "man mkfs"). Work with partitions and filesystems as root (sudo) or the kernel may not be able to re-read the partition table until you reboot. Create the partitions (the actual commands will vary depending on your choice of tool(s)). A good source of information: http://www.linuxplanet.com/linuxplanet/tutorials/3174/1/

                  View Raid disk
                  sudo dmraid -ay
                  

                  The result of my configuration

                  RAID set "sil_aiaedgdcafah" already active
                  
                  NOTE: In the following examples change /dev/mapper/via_hfciifae to your device e.g. /dev/mapper/sil_aiaedgdcafah
                  Viewing the Current Partition Layout

                  Type p to display your disk's current partition configuration

                  sudo fdisk /dev/mapper/via_hfciifae
                  Command (m for help): p
                  
                  Removing Partitions
                  WARNING: Only remove partitions you don't want kept!

                  We will first remove all existing partitions from the disk. Type d to delete a partition. For instance, to delete an existing /dev/mapper/via_hfciifae

                  Command (m for help): d
                  Partition number (1-4): 1
                  

                  The partition has been scheduled for deletion. It will no longer show up if you type p, but it will not be erased until your changes have been saved. If you made a mistake and want to abort without saving your changes, type q immediately and hit enter and your partition will not be deleted. Now, assuming that you do indeed want to wipe out all the partitions on your system, repeatedly type p to print out a partition listing and then type d and the number of the partition to delete it. Eventually, you'll end up with a partition table with nothing in it:

                  Disk /dev/mapper/via_hfciifae: 30.0 GB, 30005821440 bytes
                  240 heads, 63 sectors/track, 3876 cylinders
                  Units = cylinders of 15120 * 512 = 7741440 bytes
                  
                  Device Boot    Start       End    Blocks   Id  System
                  
                  Command (m for help):
                  

                  Now that the in-memory partition table is empty, we're ready to create the partitions. We will use a default partitioning scheme as discussed previously. Of course, don't follow these instructions to the letter if you don't want the same partitioning scheme!

                  Creating the Boot Partition

                  We first create a small boot partition. Type n to create a new partition, then p to select a primary partition, followed by 1 to select the first primary partition. When prompted for the first cylinder, hit enter. When prompted for the last cylinder, type +32M to create a partition 32 Mbyte in size:

                  Command (m for help): n
                  Command action
                    e   extended
                    p   primary partition (1-4)
                  p
                  Partition number (1-4): 1
                  First cylinder (1-3876, default 1): (Hit Enter)
                  Using default value 1
                  Last cylinder or +size or +sizeM or +sizeK (1-3876, default 3876): +32M
                  

                  Now, when you type p, you should see the following partition printout:

                  Command (m for help): p
                  
                  Disk /dev/mapper/via_hfciifae: 30.0 GB, 30005821440 bytes
                  240 heads, 63 sectors/track, 3876 cylinders
                  Units = cylinders of 15120 * 512 = 7741440 bytes
                  
                  Device Boot    Start       End    Blocks   Id  System
                  /dev/?          1        14    105808+  83  Linux
                  

                  We need to make this partition bootable. Type a to toggle the bootable flag on a partition and select 1. If you press p again, you will notice that an * is placed in the "Boot" column.

                  Creating the Swap Partition

                  Let's now create the swap partition. To do this, type n to create a new partition, then p to tell fdisk that you want a primary partition. Then type 2 to create the second primary partition, /dev/hda2 in our case. When prompted for the first cylinder, hit enter. When prompted for the last cylinder, type +512M to create a partition 512MB in size. After you've done this, type t to set the partition type, 2 to select the partition you just created and then type in 82 to set the partition type to "Linux Swap". After completing these steps, typing p should display a partition table that looks similar to this:

                  Command (m for help): p
                  
                  Disk /dev/mapper/via_hfciifae: 30.0 GB, 30005821440 bytes
                  240 heads, 63 sectors/track, 3876 cylinders
                  Units = cylinders of 15120 * 512 = 7741440 bytes
                  
                  Device Boot    Start       End    Blocks   Id  System
                  /dev/? *           1        14    105808+  83  Linux
                  /dev/?            15        81    506520   82  Linux swap
                  
                  Creating the Root Partition

                  Finally, let's create the root partition. To do this, type n to create a new partition, then p to tell fdisk that you want a primary partition. Then type 3 to create the third primary partition, /dev/hda3 in our case. When prompted for the first cylinder, hit enter. When prompted for the last cylinder, hit enter to create a partition that takes up the rest of the remaining space on your disk. After completing these steps, typing p should display a partition table that looks similar to this:

                  Command (m for help): p
                  
                  Disk /dev/mapper/via_hfciifae: 30.0 GB, 30005821440 bytes
                  240 heads, 63 sectors/track, 3876 cylinders
                  Units = cylinders of 15120 * 512 = 7741440 bytes
                  
                  Device Boot    Start       End    Blocks   Id  System
                  /dev/?    *        1        14    105808+  83  Linux
                  /dev/?            15        81    506520   82  Linux swap
                  /dev/?            82      3876  28690200   83  Linux
                  
                  Saving the Partition Layout

                  To save the partition layout and exit fdisk, type w. Now that your partitions are created, you can now continue with Creating Filesystems.

                  Creating Filesystems
                  Filesystems?

                  The Linux kernel supports various filesystems. We'll explain ext2, ext3, ReiserFS, XFS and JFS as these are the most commonly used filesystems on Linux systems. ext2 is the tried and true Linux filesystem but doesn't have metadata journaling, which means that routine ext2 filesystem checks at startup time can be quite time-consuming. There is now quite a selection of newer-generation journaled filesystems that can be checked for consistency very quickly and are thus generally preferred over their non-journaled counterparts. Journaled filesystems prevent long delays when you boot your system and your filesystem happens to be in an inconsistent state. ext3 is the journaled version of the ext2 filesystem, providing metadata journaling for fast recovery in addition to other enhanced journaling modes like full data and ordered data journaling. ext3 is a very good and reliable filesystem. It has an additional hashed b-tree indexing option that enables high performance in almost all situations. You can enable this indexing by adding -O dir_index to the mke2fs command. In short, ext3 is an excellent filesystem. ReiserFS is a B*-tree based filesystem that has very good overall performance and greatly outperforms both ext2 and ext3 when dealing with small files (files less than 4k), often by a factor of 10x-15x. ReiserFS also scales extremely well and has metadata journaling. As of kernel 2.4.18+, ReiserFS is solid and usable as both general-purpose filesystem and for extreme cases such as the creation of large filesystems, the use of many small files, very large files and directories containing tens of thousands of files. XFS is a filesystem with metadata journaling which comes with a robust feature-set and is optimized for scalability. We only recommend using this filesystem on Linux systems with high-end SCSI and/or fibre channel storage and an uninterruptible power supply. Because XFS aggressively caches in-transit data in RAM, improperly designed programs (those that don't take proper precautions when writing files to disk and there are quite a few of them) can lose a good deal of data if the system goes down unexpectedly. JFS is IBM's high-performance journaling filesystem. It has recently become production-ready and there hasn't been a sufficient track record to comment positively nor negatively on its general stability at this point.

                  Applying a Filesystem to a Partition

                  To create a filesystem on a partition or volume, there are tools available for each possible filesystem:

                  Filesystem Creation Command
                  ext2 mke2fs
                  ext3 mke2fs -j
                  reiserfs mkreiserfs
                  xfs mkfs.xfs
                  jfs mkfs.jfs

                  On exiting fdisk, it may report that the partition table will not be reread until after a reboot, you can get dmraid to reread the partition table with

                  sudo dmraid -r
                  
                  Create Filesystems on the RAID Array

                  Now "format" each partition (create filesystems). In my case I used fdisk and ran a mk2fs on /dev/mapper/via_hfciifae5 and mkreiserfs on /dev/mapper/via_hfciifae7. You can also do this with parted. Or you can exit your partitioning tool and use mkfs (e.g., "mkfs.ext3" and "mkfs.reiserfs") to create the filesystems. Create swap with "mkswap /dev/mapper/etc." and "swapon /dev/mapper/etc.". (Use the man pages.) Be sure to repeat "mkfs" for all the new partitions!

                  mkfs -t ext3 /dev/mapper/via_hfciifae5
                  mkfs -t reiserfs /dev/mapper/via_hfciifae7
                  
                  Activating the Swap Partition

                  mkswap is the command that is used to initialize swap partitions

                  mkswap /dev/mapper/etc
                  

                  To activate the swap partition, use swapon

                  swapon /dev/mapper/etc
                  

                  The command dmraid -r will show how the partitions have been mapped in RAID: In my case:

                  via_hfciifae  -- the raw raid volume
                  via_hfciifae1 -- the NTFS partition
                  via_hfciifae5 -- /boot
                  via_hfciifae6 -- swap
                  via_hfciifae7 -- /
                  

                  Alternatively, with a RAID0 striped array you may see

                  sudo dmraid -r
                  /dev/sda: via, "via_eafhdaegfb", stripe, ok, 488397167 sectors, data@ 0
                  /dev/sdb: via, "via_eafhdaegfb", stripe, ok, 488397167 sectors, data@ 0
                  

                  Also try sudo dmraid -s for information about you RAID set(s).

                  Mount the Temporary File Structure

                  Next, I created a temporary file structure to hold my new installation while I construct it, I and mounted two sets of directories to it: a) Mounted the new partitions I had created for / and /boot (so could install packages to them). b) Mounted the currently running, /dev, /proc, and /sys filesystems, so I could use these to simulate a running system within my temporary file structure. Use sudo or "sudo passwd" and su. If you use su, you do not need to prefix each line below with sudo. We will for consistency.

                  sudo mkdir /target
                  sudo mount -t reiserfs /dev/mapper/via_hfciifae7 /target
                  cd /target
                  sudo mkdir boot dev cdrom proc sys
                  sudo mount -t ext2 /dev/mapper/via_hfciifae5 /target/boot
                  sudo mount --bind /dev /target/dev
                  # added: mount the cdrom to install packages from ubuntu ISO
                  sudo mount --bind /cdrom /target/cdrom
                  sudo mount -t proc proc /target/proc
                  sudo mount -t sysfs sysfs /target/sys
                  
                  Install the Base System
                  sudo apt-get install debootstrap
                  
                  # install base system
                  sudo debootstrap feisty /target  # or breezy etc
                  
                  # copy configuration files
                  sudo cp /etc/apt/sources.list /target/etc/apt
                  sudo cp /etc/resolv.conf /target/etc
                  sudo cp /etc/hosts /target/etc/hosts
                  sudo cp /etc/network/interfaces /target/etc/network
                  
                  # run in the now installed system as a chroot
                  sudo chroot /target
                  
                  # You are now superuser so do not need sudo
                  
                  # Add packages from the ubuntu install CD/DVD
                  apt-cdrom -m add
                  
                  # Update the apt repository
                  apt-get update
                  
                  # replace en with the two-letter identifier for your language
                  apt-get install language-pack-en
                  
                  # for other languages than english, you need to (replace sv_SE to what corresponds to your language):
                  export LANG=sv_SE.UTF-8
                  
                  # exit, remount proc+sysfs, then chroot again
                  exit
                  sudo mount -t proc proc /target/proc
                  sudo mount -t sysfs sysfs /target/sys
                  sudo chroot /target
                  
                  apt-get install dmraid
                  

                  /!\ If dmraid returns errors, see the Troubleshooting section at the end of this document

                  apt-get install grub # or other bootloader
                  
                  # if unsure of your kernel, run 'apt-cache search linux-'
                  apt-get install linux-386 # or k7, k8, k8-smp, etc
                  

                  /!\ The installer may ask you some questions:

                  1. Q: Create a symbolic link? A: Yes (press SPACE)
                  2. Q: You need to configure your bootloader. A: ok (TAB, SPACE)
                  3. Q: Do you want to abort now? A: No (TAB, SPACE)
                  apt-get install ubuntu-standard # or minimal or base (dapper)
                  
                  # fix https://issues.rpath.com/browse/RPL-1297
                  killall acpid
                  
                  # Optional: you can install this later if you like
                  apt-get install ubuntu-desktop  # or ubuntu-server, xubuntu-desktop, etc
                  
                  # You MUST add a user
                  # (you can do this in a second window while waiting for apt-get
                  #  if you sudo chroot /target first)
                  useradd alice # your name instead of alice
                  passwd alice
                  mkdir /home/alice
                  chown alice /home/alice
                  
                  # duplicate the root line except with your username instead of the word root to give your new user access to sudo
                  visudo
                  

                  Note: If you are installing ubuntu-desktop, you will need to add your user to several groups in order to use sound, among other things. When you create a full administrator using the GUI, it places your user in the following groups: adm dialout cdrom floppy audio dip plugdev scanner admin So, to add your created user to those groups:

                  usermod -a -G adm,dialout,cdrom,floppy,audio,dip,plugdev,scanner,admin alice  # following the previous conventions, put your user instead of alice
                  

                  Also, the typical Ubuntu setup has the initial user in the "admin" group, and places the admin group in the sudoers file, not your user, like so:

                  visudo
                  
                  # in the file that appears, place this at the bottom
                  %admin  ALL=(ALL) ALL
                  
                  Set Up the Bootloader for RAID

                  Now that you have the debian core, ubuntu-base, linux kernel, dmraid, grub, and ubuntu-desktop installed, you can proceed with the bootloader. If you haven't completed these successfully, don't attempt to proceed, you will just exacerbate any problem you have at this point. We will demonstrate the installation of GRUB (Grand Unified Bootloader), but there are several alternatives (e.g., LILO). The key information here is how the normal process for use of the bootloader had to be modified to accomodate the RAID mappings, so this general process should be useful regardless of your choice of bootloader.

                  Install the Bootloader Package

                  Now you need to run the grub shell. In a non-RAID scenario, one might use grub-install, but we cannot because it cannot see the RAID device mappings and therefore cannot set up correct paths to our boot and root partitions. So we will install and configure grub manually as follows: First, make a home for GRUB and put the files there that it needs to get set up:

                  mkdir /boot/grub
                  cp /usr/lib/grub/<your-cpu-arch>-pc/stage1 /boot/grub/
                  cp /usr/lib/grub/<your-cpu-arch>-pc/stage2 /boot/grub/
                  cp /usr/lib/grub/<your-cpu-arch>-pc/<the staging file for your boot partition's filesystem> /boot/grub
                  

                  The "staging files" look like: "e2fs_stage1_5" (for ext2 or 3); "reiserfs_stage1_5" (for reiserfs); "xfs_stage1_5" (and so on). It is safe to copy them all to your /boot/grub. Next, go into the grub shell:

                  grub
                  

                  You should now see the grub prompt. Next, tell GRUB which device is the boot device:

                  device (hd0) /dev/mapper/via_hfciifae
                  

                  In my case, it was the RAID array mapped as /dev/mapper/via_hfciifae. Next, tell GRUB where all the stuff is that is needed for the boot process:

                  root (hd0,4)
                  

                  /!\ This is one of the most common sources of error, so we will explain this in excruciating detail. From GRUB's perspective, "root" is whatever partition holds the contents of /boot. For most people, this is simply your linux root (/) partition. E.g., if / is your 2nd partition on the RAID you indicated above as hd0, you would say "root (hd0,1)". Remember that GRUB starts counting partitions at 0. The first partition is 0, the second is 1, and so on. In my case, however, I have a separate boot partition that GRUB mounts read-only for me at boot time (which helps keep it secure). It's my 5th partition, so I say "root (hd0,4)" So, if I have a system where /dev/mapper/via_x array has been partitioned so that /dev/mapper/via_x1 is going to be / and /dev/mapper/via_x2 will be /boot I need to type the following because /boot is mounted on the second partition of array hd0

                  device (hd0) /dev/mapper/via_x
                  root (hd0,1)
                  

                  If I only have one non-swap partition, /dev/mapper/via_x1 that is going to be / and no separate /boot, the /boot folder will be on this partition, so

                  device (hd0) /dev/mapper/via_x
                  root (hd0,0)
                  

                  Hint: A way to find out the right disk + partition to you /boot is to type the following on the grub command line:

                  find /boot/grub/stage1
                  

                  This should return something in the format of (hdX,Y) Optional: IF GRUB complains about bad cylinder numbers (i.e, if it did not complain, skip this part about fdisk and geometry): You may need to tell it about the device's geometry (cylinders, heads, and sectors per track. You can find this information out by using fdisk (quit GRUB) with the command: fdisk (fdisk -l /dev/mapper/via_hfciifae) ...then reenter the GRUB shell and use the command: geometry (hd0) 9001 255 63 Next, now that you've successfully established the "device" and "root", you can go ahead and instantiate GRUB on the boot device. This sets up the stage 1 bootloader in the device's master boot record and the stage 2 boot loader and grub menu in your boot partition:

                  setup (hd0)
                  quit
                  
                  Configure the Bootloader

                  Now run update-grub:

                  update-grub
                  

                  This adds your newly installed linux kernel, and the associated initial ram disk image, to the boot options menu that grub presents during start-up. You will find this menu in the boot/grub directory. We need to edit this menu.lst file as follows. (CAUTION: Get this right - this is a common source of error and mistakes result in kernel panic upon reboot, so no typos.): a) "root=": Correct the path that points to the linux root (in several places). update-grub configures hda1 as root because, not being dmraid-aware, it can't find your current root-device. Put the correct device mapping for your linux root. So put your equivalent of:

                  root=/dev/mapper/via_hfciifae7
                  

                  every place you see "root=" (only where you see root and the equal sign). This goes in all the places where update-grub defaulted to root=/dev/hda1 or just left it blank like root= . Make sure you change this in the Automagic defaults section as well as in each of the multiple alternatives sections that follow. (Important: the Automagic defaults section is nested and therefore uses ## to indicate comments and # to indicate the actual defaults that is uses. So don't "un-comment" the default lines when you edit them. In other words, leave the #). When you update your kernel later on, update-grub will use these defaults so it won't ignorantly "assume hda1" and send your system into a kernel panic when you boot. This ought to end up looking something like:

                  #kopt=root=/dev/mapper/via_hfciifae7 ro
                  

                  b) "groot": If necessary, correct the grub root. In places, you will see other lines that also refer to "root" (or "groot") but use syntax such as root (hd0,1) instead of a path. As described earlier, these refer to the "root" for grub's purposes, which is actually your /boot. Also, remember grub's syntax uses partition numbering beginning with zero. So, if you have a separate /boot partition, these lines should instead show something like:

                  root (hd0,4)
                  

                  (The same information we used while working with grub interactively earlier.) Change this both for the Automagic defaults as well as for each alternative, including the memtest option. c) An additional edit is required IF you are using a separate /boot partition. The path pointing to the linux root must be RELATIVE to the grub "root" (your /boot). So if you are using a separate boot partition, the paths in grub's menu.lst file that help grub locate the linux kernel and initrd will not begin with "/boot", and you should delete that portion of the path. For example, 模板:Update-grub} initially spat out this:

                  title           Ubuntu, kernel 2.6.15-29-amd64-k8
                  root            (hd0,0)
                  kernel          /boot/vmlinuz-2.6.15-29-amd64-k8 root= ro quiet splash
                  initrd          /boot/initrd.img-2.6.15-29-amd64-k8
                  savedefault
                  boot
                  

                  ... and because I have a separate boot partition and opted not to use a grub splash image (which you can learn about elsewhere), my editing looked like this...

                  title           Ubuntu, kernel 2.6.15-29-amd64-k8
                  root            (hd0,4)
                  kernel          /vmlinuz-2.6.15-29-amd64-k8 root=/dev/mapper/via_hfciifae7 ro quiet
                  initrd          /initrd.img-2.6.15-29-amd64-k8
                  

                  /!\ Note that I removed "savedefault". If you leave this in, you will get a "file not found" error when you try to boot (you also can't set use default=saved up top as it shows in the menu.lst file's example). Every time you run update-grub you need to manually remove savedefault. Again, if you are not using a separate boot partition, you can leave /boot in the paths. The "boot" command you would issue at the grub prompt is implied, so you can leave it out of the menu file. d) To add a static boot stanza for Windows, you can use and change the example in the menu.lst file or the following:

                  title Windows XP
                    rootnoverify (hd0,0)
                    chainloader +1
                  
                  Put it at the bottom, below where it says ### END DEBIAN AUTOMAGIC KERNELS LIST. Or if for some unforgivable reason you want your computer to boot Windows by default, you can put it up front above where it says
                  ### BEGIN DEBIAN AUTOMAGIC KERNELS LIST
                  

                  e) Close the gaping security hole! First, set a password where the example shows it. Users who cannot provide this password will be prevented from using any locked menu entries, prevented from editing the bootlines, and prevented from dropping to a command prompt. To do this, in the console type:

                  grub-md5-crypt
                  

                  When it prompts you "Password:", it's asking what you want to be the GRUB password (not your user password, the root password, or anything else). You will be prompted to enter it twice, then it will spit out the MD5 hash that you need to paste into menu.lst. This line should end up looking something like the following (obviously, the MD5 hash of YOUR password goes where "$1$gLhU0/$aW78kHK1'Qf'V3'P2b2zn'Uoe/" is shown):

                  password --md5 $1$gLhU0/$aW78kHK1QfV3P2b2znUoe/
                  

                  Then, to keep your "recovery mode" boot alternative(s) locked each time update-grub runs, set

                  lockalternative=true
                  

                  Unless you do this, anybody will be able to seize root simply by rebooting your computer (e.g., cutting power to it) and selecting your "recovery mode" menu entry when it reboots, or editing the normal bootline to include 'single' mode. You can also add "lock" to any static menu alternatives you have created (insert it on a line just below the title, so it locks the entire set of options described). f) Test automagic kernels settings (also completes the locking of alternatives). It is better to find errors now than a month from now when you've forgotten all this stuff and the kernel gets updated. - first, make a backup of menu.lst - then run update-grub again - watch for errors and re-examine menu.lst for discrepancies - correct as needed.

                  Ubuntu 5.10: Reconfigure Initramfs for RAID

                  /!\ This chapter is only required for Ubuntu 5.10. Otherwise it should be skipped. In recent years there has been a trend to try and pull a bunch of code out of the kernel and into EarlyUserspace. This includes stuff like nfsroot configuration, md software RAID, lvm, conventional partition/disklabel support, and so on. Early user space is set up in the form of an initramfs which the boot loader loads with the kernel, and this contains user mode utilities to detect and configure the hardware, mount the correct root device, and boot the rest of the system. Hardware fakeRAID falls into this category of operation. A device driver in the kernel called device mapper is configured by user mode utilities to access software RAIDs and partitions. If you want to be able to use a fakeRAID for your root filesystem, your initramfs must be configured to detect the fakeRAID and configure the kernel mapper to access it. So we need to add dmraid to the initramfs. Debian and Ubuntu supports this by way of a set of shell scripts and configuration files placed in /etc/mkinitramfs/. We must tailor these to include dmraid by plugging in two simple scripts and adding a one-line entry to a configuration file. The only real challenge here is to make sure you don't inadvertently screw up the syntax with a typo. Note that in Ubuntu 6.06, this is taken care of by the dmraid package itself.

                  Configure mkinitramfs

                  First, create a new file as /etc/mkinitramfs/scripts/local-top/dmraid . (If you are lazy or don't like to keyboard, you can open this how-to in the browser and copy the text.) /!\ the line: PREREQ="udev" gave me circular-dependency issues so I replaced it with PREREQ="" and my issue was resolved

                  #!/bin/sh
                  
                  PREREQ="udev"
                  
                  prereqs()
                  {
                          echo "$PREREQ"
                  }
                  
                  case $1 in
                  # get pre-requisites
                  prereqs)
                          prereqs
                          exit 0
                          ;;
                  esac
                  
                  modprobe -q sata_nv
                  modprobe -q dm-mod
                  
                  # Uncomment next line if you are using RAID-1 (mirror)
                  # modprobe -q dm-mirror
                  
                  /sbin/dmraid -ay
                  

                  Second, create another new file as /etc/mkinitramfs/hooks/dmraid. (Again for the lazy, you can copy it from your browser. Also, it's only slightly different, so if you are manually typing it for some reason, you may want to start with a copy of the first script.)

                  #!/bin/sh
                  
                  PREREQ=""
                  
                  prereqs()
                  {
                  	echo "$PREREQ"
                  }
                  
                  case $1 in
                  # get pre-requisites
                  prereqs)
                  	prereqs
                  	exit 0
                  	;;
                  esac
                  
                  . /usr/share/initramfs-tools/hook-functions
                  
                  copy_exec /sbin/dmraid /sbin
                  
                  exit 0
                  

                  Third, mark both of these new initramfs scripts as executable:

                  chmod +x /etc/mkinitramfs/hooks/dmraid
                  chmod +x /etc/mkinitramfs/scripts/local-top/dmraid
                  

                  Last, add the line dm-mod to the file /etc/mkinitramfs/modules. Make sure the file ends with a newline. If you use a RAID-1 (mirror), include dm-mirror as well.

                  Update the initrd

                  Now the big moment -- use initramfs to update the initrd file. Below, I show the kernel I installed at that time, but stuff following "img-" and following "-c -k " must reflect the version YOU are using (e.g., "2.6.15-29-amd64-k8-smp" or whatever). Two commands

                  rm /boot/initrd.img-2.6.12-9-k7
                  update-initramfs -c -k 2.6.12-9-k7
                  

                  Preconfigure the New System

                  {*} This section applies to all Ubuntu versions. Ensure that you are still operating as root within the new (temporary) system (i.e., your prompt will be root@ubuntu#. If not, chroot /target again: sudo chroot /target (The process from here forward is the same as any bootstrap / network installation, and there are other sources to refer to for more detail.) UBUNTU 5.10: Enter the command base-config new to configure system defaults.

                    • UBUNTU 6.06 - 7.10: base-config is deprecated in Dapper Drake, so we have to manually configure the new base system.

                  The following steps have been pulled from [1]. I've only included the steps we haven't covered above.

                  Configure Keyboard

                  apt-get install console-data #or "dpkg-reconfigure console-data" if console-data is already installed.
                  

                  Note that the keyboard cannot be set while in the chroot, but will be configured for the next reboot.

                  Configure Networking

                  To configure networking, edit /etc/network/interfaces, /etc/resolv.conf, and /etc/hostname.

                  nano /etc/network/interfaces
                  

                  Here are some simple examples from /usr/share/doc/ifupdown/examples;:

                  # /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
                  # See the interfaces(5) manpage for information on what options are
                  # available.
                  
                  # We always want the loopback interface.
                  #
                  auto lo
                  iface lo inet loopback
                  
                  # To use dhcp:
                  #
                  # auto eth0
                  # iface eth0 inet dhcp
                  
                  # An example static IP setup: (broadcast and gateway are optional)
                  #
                  # auto eth0
                  # iface eth0 inet static
                  #     address 192.168.0.42
                  #     network 192.168.0.0
                  #     netmask 255.255.255.0
                  #     broadcast 192.168.0.255
                  #     gateway 192.168.0.1
                  

                  Enter your nameserver(s) and search directives in /etc/resolv.conf:

                  nano /etc/resolv.conf
                  

                  A simple /etc/resolv.conf:

                  search hqdom.local\000
                  nameserver 10.1.1.36
                  nameserver 192.168.9.100
                  

                  Enter your system's host name (2 to 63 characters):

                  echo UbuntuHostName > /etc/hostname
                  

                  Change "UbuntuHostName" to whatever you'd like it to be. If you have multiple network cards, you should arrange the names of driver modules in the /etc/modules file into the desired order. Then during boot, each card will be associated with the interface name (eth0, eth1, etc.) that you expect.

                  Configure Locales

                  To configure your locale settings to use a language other than English, install the locales support package and configure it:

                  apt-get install locales
                  dpkg-reconfigure locales
                  

                  NOTE: Before using locales with character sets other than ASCII or latin1, please consult the appropriate localization HOWTO.

                  Mount your FileSystems

                  It will be helpful to configure your fstab file at this point. One easy way to do this is:

                  cat /etc/mtab
                  

                  (select and copy everything)

                  nano /etc/fstab
                  

                  (paste everything) Then delete everything except the proc line, and the lines that refer to your RAID partitions. It might end up something like this (yours will vary - people asked for examples):

                  #FileSystem                     MountPoint      Type       Options      Dump/Pass
                  
                  proc                            /proc           proc       rw              0 0
                  /dev/mapper/via_hfciifae5       /boot           ext3       defaults        0 2
                  /dev/mapper/via_hfciifae7       /               reiserfs   notail,noatime  0 1
                  /dev/mapper/via_hfciifae6       none            swap       sw              0 0
                  

                  or

                  #[fs                       ]  [fs_mount][fs_type][ fs_opts ][dmp][pass]
                  /dev/mapper/nvidia_bggfdgec2    /boot     ext3    defaults    0    1
                  /dev/mapper/nvidia_bggfdgec3    none      swap    sw          0    0
                  proc                            /proc     proc    rw          0    0
                  

                  Finally you are ready to reboot. This first time, select the "recovery mode" option. When it asks, you want to "perform maintenance". Set the root password:

                  passwd
                  

                  (more is needed here, or a reference to whatever replaces the howto that describes a general debootstrap install)

                  Upgrading to Ubuntu 6.06 (Dapper Drake)

                  The dmraid package in Ubuntu 6.06 has the necessary scripts included (under /usr). After upgrading the dmraid package, you can therefore delete the old scripts that you've made (under /etc). To be sure the package scripts are baked into the initrd, update the initrd again by reconfiguring dmraid:

                  sudo rm /etc/mkinitramfs/hooks/dmraid
                  sudo rm /etc/mkinitramfs/scripts/local-top/dmraid
                  sudo dpkg-reconfigure dmraid
                  

                  Fakeraid support in Ubuntu 6.10 (Edgy Eft)

                  The fakeraid support in the Desktop (live) installer is disabled due to different problems. Use the "Alternate" install cd. See bug #54246 for some issues and workarounds. The original Edgy version of dmraid is broken for many people. A newer version has been released in Feisty, and this package has been reported to work fine in Edgy (and Dapper) as well. See also FakeRaidEdgy for a happy-ending story that might help you.

                  Fakeraid support in Ubuntu 7.04 (Feisty Fawn)

                  The Desktop CD installer still has no/poor support for fakeraids. Upgrading from an existing Edgy installation is no problem, just remember to edit /boot/grub/menu.lst and remove the "savedefault" entries again when the upgrade has finished. You can try to use the installer though. Here is a description how to do that [2]

                  Troubleshooting: User Contributions

                  1. Ubuntu 6.06 LTS on 1 June 2006:

                  Install of dmraid failed to configure, indicating it was unable to start the dmraid initscript. This may have been some kind of error on my part. I was able to fix this with 'dpkg-reconfigure dmraid' I add it here as a possibly useful tip should this turn out to be systematic problem that others encounter. Also, install dmraid first, then the kernel, in order to use the initramfs scripts that are now part of the 6.06 distribution. One possible source of error is that if you have several kernels installed, only one initrd gets updated, and that you therefore might boot with an old initrd where the dmraid modules and hooks are missing; To avoid this, run update-initramfs -u -k <version> where <version> would be the kernel version you would like to boot with, in the format given by uname -r. 2.#2 18 June 2006: Another user reported this same problem. dpkg-reconfigure did not work for him, but he reports that after reinstalling dmraid "like ten times" it magically worked. To help reduce the likelihood of this occuring, I have separated the package installs to separate lines (above) to help ensure things are completed in what I'm guessing to be the best order. 3.#3 08 June 2007: I've followed this tutorial but used a knoppix 5.1.1 CD and installed Debian lenny. I encountered one more problem that seems to be a bug in GRUB and is described here: "ALERT! does not exist" at boot with ICH7. I've used the stage files from the feisty+mem_lower.tgz to overwrite my Debian lenny files, because the Ubuntu debian package had some unresolvable dependencies. 4.#4 22 June 2007: The File Not Found error from Grub when the savedefault option is used in menu.lst is because the file /boot/grub/default does not exist. I manually created this file by executing 'sudo grub-set-default 0' from within the installed system. This should also work when initially setting up Grub, as described above. Adding this file eliminates the need to remove the savedefault option from the menu.lst each time you run update-grub (eg, after a kernel upgrade). 5.#5 21 Oct 2007 Gutsy uses linux-generic as the kernel which loads optimizations at runtime. Instead of "apt-get install linux-386 # or k7, k8, k8-smp, etc" simply use "apt-get install linux-generic". 6.#6 30 Nov 2008 I followed this instructions to the letter, but I got grub error 15 (File not found) during boot, although all the file were on place. However, grub didn't know which device should be scanned to find all the required files. I found out, that one important file was missing: device.map informing grub about the devices. So I created one in the grub directory (/boot/grub/) and add the following entry:

                  (hd0) /dev/mapper/isw_deebyaid_RaidMatrix_Linux 
                  

                  (Replace isw_deebyaid_RaidMatrix_Linux with your RAID device.) This solved my error 15 issue. 7.#7 15 Jan 2009 I've just managed to make work a Gigabyte MA78GPM-DS2H motherboard RAID controller in RAID-1 mode. This is a pdc controller. I configured RAID using BIOS, launched 'try Ubuntu' mode and added dmraid as described at the top of the page. Unfortunately, I've got the following error:

                  dmraid -ay 
                  ERROR: creating degraded mirror mapping for pdc_xxxxx
                  

                  dmraid -r noticed only the second disk of the pair. More strangely, after reboot, BIOS launched an alarm that one of the disks is nonfunctional. The alarm gone after hard reset. Now the solution: go to BIOS, delete your configuration and create it again. But this time change two options: - "Gigabyte bonduary" to "NO" - "Fast Init" to "NO" This time the RAID matrix and both devices are detected fine. I am now waiting until Ubuntu is installed, hopefully grub part will be easy... Regards. 8.#8 26 Jan 2009 I followed these instructions - Method 2 in long - and they worked perfectly EXCEPT for booting Windows. Windows was an XP installation on a single ATA drive that wasn't part of the (new) RAID. The system BIOS was set to boot SCSI (which meant it was booting the RAID). GRUB couldn't make windows boot - it stalled on the final step. I found the answer here: http://users.bigpond.net.au/hermanzone/p15.htm#Chainloading_Windows_using_map_commands The section is "Chainloading Windows on a non-first hard disk". The problem lies with Windows - it expects to be on the first drive. In the Windows section of Menu.lst, I now have:

                  title          Windows XP
                  rootnoverify   (hd1,0)
                  makeactive
                  map   (hd0)  (hd1)
                  map   (hd1)  (hd0)
                  chainloader    +1
                  

                  hd0 is my (booting) RAID as seen by GRUB. hd1 is my (non-booting) ATA drive with windows in the first partition (hd1,0). The two map commands fool Windows into thinking it is on the first drive. This works. 9.#9 25 Apr 2009 This is a GREAT tutorial! I have learned much about my hardware and Ubuntu. I have an Asus A8V motherboard and had Gutsy running on it for some time. The moment I activated SATA raid (with two new drives), I could not boot my computer. Adding "pci=nomsi" to the kernel line in Grub or the F6 boot options on the Live CD, fixed it. Possibly because of the above issue (or not?) I could not set the raid set for boot in the BIOS. I am currently using an ide drive for the boot partition. I also have Ubuntu installed on the ide drive """for emergencies""". Another good trick is to create a Live CD partition on a hard drive! See: https://help.ubuntu.com/community/Installation/FromHardDriveWithFloppies this allows very fast installation! I am using the six partition method with boot (ide drive) and the rest on raid. For some reason, the initramfs image did not get sent to my boot partition and the raid OS would not boot. If you suspect this, mount your root partition without mounting the boot partition and look in the boot directory (/target/boot). It may be hiding there. I have found that gparted does not work correctly (for me). I used fdisk and mkfs. Another strange situation is, during Live CD installation, the partition section shows multiple lines for each of the raid partitions. Some of these had "no number". I installed to the partitions "with" numbers and deselected the "no number" partition for swap use. This allowed the installation to work. Also, if you are using a Live CD install, ""do not"" deselect grub install. It could wreck any previous grub instalaltion. 10.#10 A Striping with Fake Root (9.04 ubuntu) Since I skipped the step installing raid 4-5 (modprobe dm-raid4-5), I later skipped installing the module (echo dm-raid4-5 >> /etc/initramfs-tools/modules). Since I don't need the dm-raid4-5 module in the modules, I need to add rmraid, which I just used nano to edit the modules file and added a new line: rmraid I then had to run the following command from above (as noted in the modules file): update-initramfs -u The last thing I had to do was edit my /boot/grub/menu.lst It had placed root=/dev/hda1, which needed to be replaced by my root=/dev/mapper/Mapper_Device_ID I also poured salt in my wound, if you'd like to see how, reed my forum post: http://ubuntuforums.org/showthread.php?p=7281944#post7281944 11.#11 9.10 bits & pieces Would it be possible for someone to update for ubuntu 9.10 - the partitioning section in particular is confusing. Added something about Alternate CD at the top - hope people don't mind, but if you're new to Ubuntu, you don't know what this is and don't realise that it's an official thing which you need to download. My windows boot drive has 139gb free space according to Windows' 'Computer Management' app, but only 27mb according to the ubuntu installer's partitioning app - hence I can't install it. After 2 tries to get started on linux and each time discovering it'll likely be thrice as hard as I thought it would be the time before (an example. Also saw the number of times partitions appear in the Ubuntu problems fixlist), I'm now asking myself (/the ubuntu braintrust) "should I persevere with Ubuntu, given that it's clearly not going to be the the antidote to windows? is setting up a dual-boot on a raid1 array a task so technically complex that it's not at all demonstrative of the experience one can expect when using the OS in general?" 12.#12 9.10 How-To I have provided a post on the forums instructing how-to install 9.10 using fakeraid here. Basically you install using the live cd (alternate no longer required in 9.10) then boot into the live cd to remove GRUB2 and install+configure GRUB legacy. GRUB2 currently does not have the means to boot a fakeraid setup and is rumored to be fixed in time for 10.4's release. 13.#13 10.04 Installation on isw fakeraid Had to work around the installer. Q&A'ed it in question 108677 in launchpad. Trick was using chmod on the disc's root partition! Just mount the root partition into the /media folder. Then sudo chmod 755 /media/fake {*} Please contribute your lessons learned here.