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 <enter>
    • p <enter>
    • 1<enter>
    • <enter>
    • +316GB
  • create a primary partition with the remaining space:
    • n <enter>
    • p <enter>
    • 2 <enter>
    • <enter>
    • <enter>
  • change second partition type:
    • t <enter>
    • 2 <enter>
    • 82 <enter>
  • save with “w”, <enter>
  • 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.
#
# <file system> <mount point> <type> <options> <dump> <pass>
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 http://osdir.com/ml/linux.ataraid/2006-10/msg00019.html

Little tips:

Links
http://www.ubuntu-in.org/wiki/SATA_RAID_Howto
https://help.ubuntu.com/community/FakeRaidHowto
http://salaros.blogspot.com/2007/07/installare-ubuntu-704-su-raid0-in-dual.html

36 thoughts on “DMRAID on Ubuntu with SATA fakeraid

  1. Thanks, I’m currently using it somewhere, but if I have a fakeraid I alway prefee DMRAID because:
    – it will easily work in a dual boot mode
    – arrays may be rebuilt using BIOS (even if OS is lost)
    – performance are almost equal (in both cases the CPU will do most of the work)

  2. Very interesting, but unfortunately I didn’t get it to work. Ended up with Grub loading and then a list of I/O erros, when experimenting with my Fujitsu-Siemens Primergy Econel 102 S2 with two 160Gb SATA drives, installing Ubuntu 7.10 Gutsy Gibbon.

    I’m sort of a newbie, so it was probably because I did something wrong when getting stuck. Here is a bit of feedback…

    “edit /etc/apt/sources.list, uncomment universe packages”
    – I didn’t know how to edit, but in the end managed to do a “vi /etc/apt/sources.list” (and get out again)

    “mount –bind /dev/ /target/dev”
    – resulted in an error, but “mount –-bind /dev/ /target/dev” worked

    “cp /etc/network/interfaces /etc/network/”
    – wouldn’t copy to same location, so I guessed “cp /etc/network/interfaces /target/etc/network/”

    “cp /usr/lib/grub/i386-pc/”
    – didn’t work, so I guessed “cd /usr/lib/grub/i386-pc/”

    “modify, inside “kernel” items”
    – so this would be those to or three instances at the end of the file?

    And then I got totally stuck when editing /etc/fstab. Should I erase the lines that were already in the file? I chose to, and then rebooted, and got the I/O errors.

  3. Topic 1
    > “edit /etc/apt/sources.list, uncomment universe packages”
    > – I didn’t know how to edit, but in the end managed to do
    > a “vi /etc/apt/sources.list” (and get out again)
    >
    Right, vi should do the job 🙂 You should uncomment universe packages.
    The contents of the /etc/apt/sources.list file may look something like this:

    ## sources.list
    ## General comments about the sources.list file
    deb http://archive.ubuntu.com/ubuntu dapper main restricted
    deb-src http://archive.ubuntu.com/ubuntu dapper main restricted

    ## Comment about the ‘Update’ repositories
    ## Comments about the role of the updates
    deb http://archive.ubuntu.com/ubuntu dapper-updates main restricted
    deb-src http://archive.ubuntu.com/ubuntu dapper-updates main restricted

    ## Comment on the ‘Universe’ repositories
    ## Comment about the support limitations of Universe & Multiverse
    ## repositories as well as licence restrictions and update policies.
    ## Please satisfy yourself as to your rights to use the software.
    # deb http://archive.ubuntu.com/ubuntu dapper universe multiverse
    # deb-src http://archive.ubuntu.com/ubuntu dapper universe multiverse

    You just have to uncomment this last two lines (remove ‘# ‘ from the start of the line)

    Topic 2:
    > “mount –bind /dev/ /target/dev”
    > – resulted in an error, but
    > “mount –-bind /dev/ /target/dev” worked
    >
    This is a wordpress/theme/whatever issue: in the text two dashes are present… uhm… I’ll put a space between them

    Topic 3:
    > “cp /etc/network/interfaces /etc/network/”
    > – wouldn’t copy to same location, so I guessed
    > “cp /etc/network/interfaces /target/etc/network/”
    >
    You’re right, I’ll fix it in the article 🙂

    Topic 4:
    > “cp /usr/lib/grub/i386-pc/”
    > – didn’t work, so I guessed “cd /usr/lib/grub/i386-pc/”
    >
    I completely miss a piece of code 🙂 I’ll fix in in the article
    It should be read:

    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”,…

    Topic 5
    > “modify, inside “kernel” items…”
    > – so this would be those to or three instances at the
    > end of the file?
    >
    Yes, your menu.lst will look something like this:
    title Ubuntu 7.10, kernel 2.6.22-14-generic
    root (hd0,0)
    kernel /boot/vmlinuz-2.6.22-14-generic root=/dev/mapper/ddf1_LogicalDrive_01 ro
    initrd /boot/initrd.img-2.6.22-14-generic

    title Ubuntu 7.10, kernel 2.6.22-14-generic (recovery mode)
    root (hd0,0)
    kernel /boot/vmlinuz-2.6.22-14-generic root=/dev/mapper/ddf1_LogicalDrive_01 ro single
    initrd /boot/initrd.img-2.6.22-14-generic

    title Ubuntu 7.10, memtest86+
    root (hd0,0)
    kernel /boot/memtest86+.bin

    Topic 6
    > And then I got totally stuck when editing /etc/fstab.
    > Should I erase the lines that were already in the file?
    > I chose to, and then rebooted, and got the I/O errors.
    >
    Yes, you have to redefine standard mount points. Apart from /proc (standard) you will have to configure mount point / (your root directory) on dmraid device 01 and select your swap partition (device 02)

    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:
    https://help.ubuntu.com/community/FakeRaidHowto
    http://www.ubuntu-in.org/wiki/SATA_RAID_Howto

  4. Right, I tried and failed again, and will send you an email request then. I think that maybe I’ve misunderstood how to name the root partition in /boot/grub/menu.lst and /etc/fstab, since I get this error message right before Grub fails: “ALERT! /dev/mapper/ddf1_4c534920202020808627c3000000003527711500000a281 does not exist. Dropping to a shell!”

    • I followed the steps in the tutorial and everything seemed to be working fine, until reboot. I’m getting the same error message as rokur “ALERT! /dev/mapper/… does not exist. Dropping to shell!”

      I’ve double checked my menu.lst file and fstab files and they are setup according to the instructions as far as I can tell.

      Did you figure out why this was happing to rokur?

  5. Hallo.
    After I followed all Your steps, when I try to boot Ubuntu from grub, i get a message saying the root string is false (/dev/mapper/xxx1). How can i fix it?
    Thx

  6. It would be great if you could update this posting to include better explanations of the steps (the theory behind each step I mean). It would be a great help for those of us familiar with the concepts, but not the system. For example, what is the mapper directory? when is it created? What are the partition steps (where you just have the commands listed)? What is the theory behind the partition layout? Is swap raided? Is boot raided? Can the computer boot from raid (both hard drives)?

    In any case, thanks for the instructions.

  7. I think you’ve got a great tutorial here, but to be honest, I guess I’m a little too green to understand it all.

    I’m currently trying to install Ubuntu 8.04 Desktop with RAID 5 and have been failing miserably. I have FakeRAID on the motherboard (Intel ICH8R) and I’ve tried that and software raid with no luck. The Ubuntu installer doesn’t seem to even acknowledge the FakeRAID (though I now understand why from reading your post) and when setting up software RAID 5, neither grub nor lilo will install (they generate fatal errors).

    I read something that said neither grub nor lilo will work on RAID 5 period (unless it’s hardware RAID) which was rather disappointing.

    One thing I’ve noticed though, is that I’ve been trying to set up all 4 of my disks as one great big RAID 5 partition assigned to / (root). Some of the tutorials I’ve been reading make it sound like I should be creating SEVERAL partitions. I’m not really sure if I need to or not. I fail to see the need for a swap partition (I have 8GB of DDR2-800 ram in the box), but maybe I do need all those partitions?

    Your tutorial is somewhat easy to follow for a complete linux noob, but when you get to the parts about editing files, well… I don’t have the vi commands memorized (except for how to quit!) and most linux noobs have probably never even used it. It might be a good idea to add a list of the basic vi commands they’ll need to get those edits done.

    Some clarification on whether or not grub would boot from a raid 5 partition or not and if not, I guess we just set up a /boot partition using raid 1? How big should this partition be? I don’t want to waste space I don’t have to…

    Thanks again for the tutorial. Hopefully I don’t end up staying up *all* night on this. I’m going to try the software raid route again and create a raid 1 boot partition and a small swap partition and see if I can manage to get this beast running. I’d really much rather do the FakeRAID thing as it makes things a lot easier for me if a hard drive ever does die.

    What would really be awesome is if Ubuntu:

    a) Had that dmraid thing built into the installer (these FakeRAID controllers are commonplace now).

    b) Was a little more intuitive about the partitioning and RAID setup stuff so n00bs like me could just say “I wanna use raid 5, with these disks, please make it happen” without all the partitioning and crap. I shouldn’t need to *know* Linux to install it on my machine.

    Maybe I’m asking too much?

    I’m saving your page to my Google notebook so I can post my results later. 🙂

  8. Wow, I really want to set-up the software RAID, but this is just too much. Ubuntu has to automate this process.

  9. I just did this today. Worked really well. Now I am trying to figure out how to break it. I pulled a drive. The OS throws a system change error. But when I try to do an ls -l on /etc for example I get an infinit it seems list of I/O errors. I figured, you loose a drive it keeps chugging along but with errors. I didnt expect it to crash the OS. But when you shut down, put drive back in, then boot back up, shes good as new.

    RAID1 on a new HP DL320 G5p with the embedded Intel RAID. Two 160GB Seagate drives.

  10. Man, i’m having a problem when i have to repeat the six previous steps, when i install dmraid it doesn’t create nothing at /dev/mappper/xxxxx , where before it created a “via_xxxxxxxxxx”, something like this…what can i do?

  11. Hi, I just upgraded to Ubuntu 8.04 and I’m trying to access Raid Volumes which are created by the Intel Storage manager on Windows. It works nicely with a Knoppix Live CD but not with Ubuntu.
    I’m already stuck at the first problem, I can’t install dmraid.

    When I’m entering “sudo apt-get install dmraid”
    I get the message ‘Couldn’t find package dmraid’. Synaptic package manager doesn’t find it either. Help! Is dmraid still available on 8.04?

    Cheers,
    Martin

  12. Hi.. please help.

    I have installed dmraid on my Ubuntu 8.04 server. I have mirrored 2 SATA 320GB hard drives on my Intel Software RAID motherboard – S3210SHLC

    The setup is like this –

    80GB Ubuntu – non RAID
    320GB x 2 – isw – RAID mirror – volume label – abraid203 – dmraid – mounted on /home1

    My dmraid was working properly until one of my hard disks failed. I put in a new 320 GB as a replacement.
    In the Intel RAID utility (bios/post) – it shows my raid volume “Status” as “REBUILD” – but does not give me an option to Rebuild in the utility itself. I repeat – there is no option to REBUILD RAID in the intel utility.

    It gives the message “RAID will be Rebuilt in the Operating System”
    I left the PC on for a day but my RAID doesnot rebuild on it’s own.

    Here is the biggest question “HOW DO I REBUILD MY RAID USING dmraid?”

    My RAID status in linux is currently as follows

    dmraid -r
    /dev/sdc: isw, “isw_eedegdeef”, GROUP, ok, 625142445 sectors, data@ 0
    /dev/sdb: isw, “isw_eedegdeef”, GROUP, ok, 625142445 sectors, data@ 0

    dmraid -s
    *** Group superset isw_eedegdeef
    –> Active Subset
    name : isw_eedegdeef_abraid203
    size : 625137920
    stride : 128
    type : mirror
    status : ok
    subsets: 0
    devs : 2
    spares : 0

    i give the command

    fdisk /dev/mapper/isw_eedegdeef_abraid203

    Command (m for help): v
    625137927 unallocated sectors

    it verifies the new hard disk as unallocated sectors.

    I’m stuck at this point. If dmraid doenot have an option to rebuild then the only option is to change the motherboard or get a seperate RAID card and create a new RAID set.

    Thanks,

    Please reply if you can help.

  13. very difficult to follow, looks like I am back to vista 64, annoying that vista only asks for a raid driver and everything just works compared to this.

  14. Thanks, this did the trick, and it’s still required with Ubuntu 8.10 which doesn’t include dmraid either.

    You might want to note a few things:
    1) This process works but with a few tweaks if the Ubuntu partition is not the first one. In my case, Windows is on my first partition (yeah, I should get rid of that…). So I had to tweak the fdisk commands (e.g., create partitions 2 and 3, not 1 and 2) and the grub commands a bit to make it work (e.g., “(hd0,1)” not “(hd0,0)).

    2) Afterwards, I think you should warn folks that you will truly have a minimal install. This means no GUI desktop, for example. You might want to give a link or pointer on installing gnome, which is what most newbies would have expected to see.

  15. @15: can you just rebuild in Bios?

    With my promise running Fakeraid (dmraid) I can have it rebuild in bios… However… that is really suboptimum, as it can’t be running and utilized while it is rebuilding… Does anyone have an answer as to whether or not there is a way (manually is fine) to rebuild the dmraid array while running (assume raid 1 ofcourse, as a failed drive in raid 0 means SOL).

    Thanks

  16. I tried that with the Kubuntu 8.04.1 desktop CD and the PC boots and it runs, no problem.
    But when u add with the root a user “tuffi” and login in with tuffi, i see only:

    $_

    and i cannot do anything.

    what to must i do?

    Tuffi

  17. Pingback: Fileserver Linux con RAID software e LVM: consigli? - Matteo Moro
  18. Pingback: Ubuntu 9.04 Fake RAID problems | Atlantic Linux Blog
  19. I know this is opposite to the article but I really need some help. I am asking for a friend of mine. As far as I know he is not using RAID in BIOS (will check) and he has only one SATA drive. But still fdisk -l is reporting it as nvidia_raid_member, subsequently not naming it properly sda, etc.
    Maybe a leftover from the disk being used in raid array, or he was playing with raid, don’t know right now. How to eliminate this raid_member and would that have danger for the data on the drive? I would appreciate some help, googling didn’t help so far (except finding this article).
    Thanks. Cheers.

    • 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.

  20. Hi,
    Thank you very much for giving such a good procedure, Please solve me this problem which i am facing,

    After editing /etc/apt/sources.list by removing comments and i am trying to use “apt-get update” its showing an error saying FIle not found Please solve this problem for me as soon as possible.

    Please Drop a mail to my Email id

    Thanks a lot.

  21. Thanks , I’ve recently been looking for information approximately this subject for ages and yours is the best I have discovered so far. However, what concerning the bottom line? Are you sure concerning the supply?

  22. The next time I learn a blog, I hope that it doesnt disappoint me as much as this one. I mean, I know it was my option to learn, but I actually thought youd have something fascinating to say. All I hear is a bunch of whining about one thing that you can repair in the event you werent too busy searching for attention.

  23. hello guys, i need (really need) some help here.. i just installed oneiric ocelot (ubuntu 11.10) few weeks ago and i run it with win7 (dual boot). the installation worked well but after i finished the installation a problem occurred, oneiric seemed wouldn’t read my partition. in my win7, i divide my hdd into 2 partitions, C and D, and oneiric doesn’t read the partition D.. when i want to pick some files from D, an error dialog box popped-up, it looks like this:

    “Error mounting: mount exited with exit code 13: $MFTMirr does not match $MFT (record 0).
    Failed to mount ‘/dev/sda5’: Input/output error
    NTFS is either inconsistent, or there is a hardware fault, or it’s a
    SoftRAID/FakeRAID hardware. In the first case run chkdsk /f on Windows
    then reboot into Windows twice. The usage of the /f parameter is very
    important! If the device is a SoftRAID/FakeRAID then first activate
    it and mount a different device under the /dev/mapper/ directory, (e.g.
    /dev/mapper/nvidia_eahaabcc1). Please see the ‘dmraid’ documentation
    for more details.”

    i’m not an expert in computer an its peripherals but i do want to use my laptop in legal and honor way, fyi my laptop spec: ACER ASPIRE 4755G, NVIDIA GeForce GT 540M, 4 GB (originally only 2 GB, due to my work instensity i had to add some GBs), 640 GB HDD, DVD-Super Multi DL drive.
    i would really appreciate your help guys, and i’m sorry if i wrote this comment not in proper english because i’m not an english speaker, 🙂 i’m from indonesia.

  24. Pingback: Amazon Geschenkgutscheine

Leave a reply to uberto Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.