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!

Sunday, January 23, 2011

DMRAID on Linux with SATA fakeraid

Source for SuSE
Source for Ubuntu
Not the same as mdraid!
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:
  1. 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)
    Comment by uberto — April 1, 2008 @ 11:55 pm | Reply
  2. Bottom line
    I don’t know where the problem you’re experiencing may happen… it seems you successfully configured your dmraid device don’t you? If you boot from a live CD, get dmraid package installed, you’re able to read/write from the raid device, aren’t you? So it should be a problem with phase 3, a grub problem or a mount problem. You should double check your grub configuration, /boot/grub/menu.lst and /etc/fstab
    Anyway, thanks for your great feedback! If you need more help drop me a mail, maybe I’ll be able to give you more advices, even if I’m also a noob in linux :)
    You may check also on these pagese:
If you had previously installed the drive with Windows XP running Intel Matrix Raid drivers, there may be a hidden partition or hidden partition data on the drive that the bios sees.
I tried removing it with Windows diskpart clean all command (had to use command line from safe boot on one of the two mirrors with the RAID disabled in BIOS because diskpart did not support the clean command from the Windows install disk) and it ‘pretended’ to wipe the entire disk back to 0′s for 12 hours and never finished, so I downloaded Derek’s Boot and Nuke instead, and that DID clean the disk in 3 hours.
Tricky thing is you must have a clean disk in order for the Matrix RAID bios to detect a clean disk, otherwise it will still think it is part of a RAID volume, even after you wipe the partitions off it, because the data is hidden and Windows will not remove it, ever. At least, not with the OEM XP version I bought with my box. Despite the claims on the Windows ‘help’ and on Microsoft’s web site about the diskpart clean all utility command, it doe NOT work on my system. All it can do is remove all the visible partitions but it will not clean the entire disk, ever.
Others said it will do it on their USB flash cards etc. but it never did fix my drive. I suspect it only removes the visible partitions and never actually cleans the disk, just sits there looping on no-ops or something. My drive light flickers dimly but never lights up like it does when accessing files or using the format command or running DBAN to wipe it, so I suspect it is a sham command.

No comments: