Bienvenido! - Willkommen! - Welcome!

Bitácora Técnica de Tux&Cía., Santa Cruz de la Sierra, BO
Bitácora Central: Tux&Cía.
Bitácora de Información Avanzada: Tux&Cía.-Información
May the source be with you!

Tuesday, May 14, 2013

DMRAID on Ubuntu with SATA fakeraid
The problem
Ubuntu (and Debian) doesn’t have support for the SATA RAID (also called FakeRAID since some of the functionality is provided by software) controllers being shipped on recent motherboards. The software to handle FakeRAID arrays in Linux is DMRAID. How do I install such systems?
Preliminary Operations
You will need to configure your RAID using the bios utility (Ctrl+M for me on startup) : just select your disks, create the logical unit selecting your desired raid mode (0 or 1 for me), save and boot with a desktop live CD.
Note: in this example I’m using Fujitsu Siemens Primergy RX100 S4 equipped with two 160Gb SATA drives, and I’m creating a RAID0 array, with Ubuntu Linux 7.10 Gutsy Gibbon

1st phase – create your partitions

To create your partitions you’ll need that your RAID is reconized from your system. Unfortunately, at the time I’m writing, Ubuntu does not include DMRAID support in its install procedure, so you’ll need to start with a live CD, activate DMRAID support and proceed to partitioning.
  • start your system with an Ubuntu Desktop CD (select your language if needed)
  • open a terminal (CTRL-ALT-F1), set a new root password wih “sudo passwd root”
  • go on with “su – ” (digit your password)
  • edit /etc/apt/sources.list, uncomment universe packages
  • “apt-get update”
  • install dmraid: “apt-get install dmraid”
  • Launch fdisk specifying the shorter device you find under /dev/mapper/dxxx (dxxx is the file device with shorted name, es.: dxxxa28 is the correct one, dxxxa281 the wrong one)
  • create a primary partition of 316GB, the other with the remaining space (we’ll use it for swap)
    • n
    • p
    • 1
    • +316GB
  • create a primary partition with the remaining space:
    • n
    • p
    • 2
  • change second partition type:
    • t
    • 2
    • 82
  • save with “w”,
  • restart your system with “reboot”
2nd phase – installing a minimal ubuntu
To format your partitions you’ll need DMRAID module loaded. So you’ll need to repeat the first six previous steps.
  • format your root partition
    • mkfs -t ext3 /dev/mapper/dxxx1 (select the device ending with 1)
  • prepare a local area for the installation procedure: create a local folder, mount your formatted partition on that folder, bind and mount the necessary stuff
    • mkdir /target
    • mount /dev/mapper/dxxx1 /target
    • mkdir /target/dev
    • mount  – - bind /dev/ /target/dev
    • mkdir /target/proc
    • mount -t proc proc /target/proc
    • mkdir /target/sys
    • mount -t sysfs sys /target/sys
  • proceed installing a minimal ubuntu
    • apt-get install debootstrap
    • debootstrap gutsy /target
  • copy essential files on your partition
    • cp /etc/apt/sources.list /target/etc/apt/
    • cp /etc/resolv.conf /target/etc/
    • cp /etc/hosts /target/etc/
    • cp /etc/network/interfaces /target/etc/network/
  • switch on your new system, re-mount /proc, /sys, /dev
    • mount  – - bind /dev/ /target/dev
    • mount -t proc proc /target/proc
    • mount -t sysfs sys /target/sys
    • chroot /target
  • install a basic ubuntu system
    • apt-get update
    • apt-get install language-pack-en
    • apt-get install ubuntu-standard linux-generic dmraid grub
  • create a user, if you want
    • useradd pippo
    • passwd pippo
    • mkdir /home/pippo
    • chown pippo /home/pippo
  • set root password
    • passwd root
3rd phase – boot loader configuration
Yes, you’ll need to configure grub
  • copy grub essential files
    • mkdir /boot/grub
    • cp /usr/lib/grub/i386-pc/stage1 /boot/grub/
    • cp /usr/lib/grub/i386-pc/stage2 /boot/grub/
    • cp /usr/lib/grub/-pc/* /boot/grub/
      This will copy the staging file for the various filesystem in your boot partition. In my example the directory is “/usr/lib/grub/i386-pc/” and the files that are copied are “e2fs_stage1_5″, “jfs_stage1_5″,…
  • configure di grub
    • grub (enters grub interactive shell)
    • device (hd0) /dev/mapper/dxxx (the shorter, so the logical disk, not the partition)
    • root (hd0,0)
    • setup (hd0)
    • quit (exit from grub shell)
    • update-grub (update grub files)
  • configure grub menu
    • edit grub menu.lst: “vi /boot/grub/menu.lst”
    • check groot is pointing to hd0,0 (it should be necessary to uncomment that line)
    • check that savedefault is commented (normally is)
    • modify, inside “kernel” items, the “root” value to “/dev/mapper/dxxx1″ (your root partition)
  • configure static mount under /etc/fstab
# /etc/fstab: static file system information.
proc /proc proc defaults 0 0
/dev/mapper/ddf1_LogicalDrive_01 / ext3 defaults 0 1
/dev/mapper/ddf1_LogicalDrive_02 none swap sw 0 0

  • reboot :)
Bottom line
Well, you’ve done! Remember that if you mounted a RAID0 device Linux at startup will probe your disks and he’ll wrongly detect a bad partition table: ignore error messages
Little tips:
36 thoughts on “DMRAID on Ubuntu with SATA fakeraid” uberto
Try the kernel raid functionality, it’s much more stable and safe than the bios driven one. It could be a bit faster too.
See (among others)

No comments: