Menu

RAID with mdadm & samba

Help
2008-01-04
2013-05-09
  • Clair Talbothays

    I have mostly followed ewanrg's blog post (http://kuso.cc/36pj) to set up a software RAID on Windows. In particular, I would like to group a bunch of small thumb drives into a single accessible disk. Basic system concept looks like this:

    Windows <-> [Samba < coLinux guest OS > mdadm] <-> thumb drive array

    coLinux networking and Samba both worked fine. For coLinux to recognize the two thumb drives I was testing with, I created empty files on each, using mkFile from coLinux File Utils, and directed them to two available block devices (cobd) in the config. Then I typed

    mdadm --create --verbose /dev/md0 --level=0 --raid-devices=2 /dev/cobd6 /dev/cobd7

    which only yielded a "error opening /dev/md0: No such ..." message (I forgot the actual wording). I tried the --auto switch, too, no good. However there are more than ten /dev/md* already in the system after boot.

    I suspect that the problem is kernel-wise. During the boot process, I noticed that udev and mdadm both failed to initiate. udev required a kernel version greater than 2.6.15 and mdadm said "failed to load MS subsystem." Both ewanrg and coLinux wiki's instructions on kernel patching appeared Greek to me, so initially I skipped the process. I have used mdadm on Kubuntu Feisty to do the same thing before, and it went smoothly. Could someone identify the problem for me and give me instructions on what to do next? Many thanks in advance.

    My system configuration:
    coLinux 0.7.1 (official) on Windows XP Pro SP2
    Debian 4.0r0 (Etch) image also from official downloads (2.6.12 kernel)
    rootfs at cobd0, no swap
    installed only TAP driver. Static IP address, bridging, and private connection all work.
    installed pump, samba, and mdadm through apt-get

     
    • Henry N.

      Henry N. - 2008-01-08

      If you wand to use udev and/or newer kernel, should use coLinux version 0.7.2 with udev-enabled kernel 2.6.22 from http://www.colinux.org/snapshots/. Kernel 2.6.22 was compiled with CONFIG_HOTPLUG=y, the base for udev.

      Raid (specialy CONFIG_MD) is not enabled in all the kernel configs.

      Sure, you can enable the md. But some has reported October 2006, that raid with md on cobd was not usable. There also exist some tips for using raid on coLinux:
      http://sourceforge.net/tracker/index.php?func=detail&aid=1569947&group_id=98788&atid=622063

      After fixing the read function for cobd (SVN revision 639, 645, 2007-07-08), this can be fixed the raid problem now. Nobody has tested it. This "read" changes are included in current version 0.7.1 and 0.7.2.

      You should download coLinux source and build the kernel with enabled MD and RAID. Follow "Building a coLinux kernel" in the file doc/building. The script bin/build-kernel.sh would be also helpfully for this steps. (Cross-tools and daemons not need to rebuild.)

       
    • Clair Talbothays

      I'd like to thank henryn for his great advice. My mdadm is now functional at least with RAID level -1 (linear). Adding RAID 5 or 6 into kernel is not applicable.

      Here's what I've done:
      1. wget coLinux 0.7.2 stable source snapshot and 2.6.22 kernel (from kernel.org); unpack them in /root
      2. apt-get install build-essential gettext bison flex automake autoconf make patch ncurses-base ncurses-bin ncurses-dev
      3. Follow Chapter 4 of doc/building in the snapshot, namely
      3.1 ~/# cd PathToColinux/patch
          ~/PathToColinux/patch# cat `cat series-2.6.22` > /tmp/sum22
      3.2 ~/linux-2.6.22# patch -p1 < /tmp/sum22
      3.3 ~/linux-2.6.22# cp PathToColinux/conf/linux-2.6.22-config .config
          ~/linux-2.6.22# echo "-co-0.7.2_R" > localversion-cooperative
          R for RAID support.
      3.4 ~/linux-2.6.22# make oldconfig
          ~/linux-2.6.22# make vmlinux
          ~/linux-2.6.22# make modules
          ~/linux-2.6.22# make modules_install
      3.5 ~/linux-2.6.22# make menuconfig
          Browse through Device Drivers -> RAID & LVM, and use spacebar to check the options. I needed only Linear, and I made it built-in support. Originally I checked all options, but the resulting kernel would panic on RAID 5 or 6 during boot. I haven't tried to make them modules.
      3.6 ~/linux-2.6.22# make vmlinux
          If you modularized RAID support, you may need to "make modules" again.
      3.7 Copy the new vmlinux somewhere in Windows such that you can replace the old vmlinux in coLinux directory after you shut coLinux down. I used Samba for transferring files between coLinux and Windows.
      3.8 Start coLinux with the new kernel. I also returned to my clean rootfs image at the beginning, installing samba and mdadm again. "mdadm --create --level=linear" works now.

      As a side note, FreeNAS on QEMU or VMware may be a better choice for my purpose in terms of installation ease.

       
    • Henry N.

      Henry N. - 2008-01-20

      Thanks for your detailed steps.
      MD is enabled for coLinux 0.8.0 now, a snapshot is available.

       

Log in to post a comment.

Monday.com Logo