# FAKERAID/dmraid on non-boot drive

## Caligatio

Hello All,

I just started playing with Gentoo this last week and got it working relatively successfully on my laptop and have a "working" install now on my desktop.  Unfortunately I've ran into a slight problem with desktop as I have a pre-existing FAKERAID 1 array being used by Windows 7.  I've looked on the wiki and on these forums trying to find a situation/solution that matches mine but have had little luck.

According to the wiki (http://en.gentoo-wiki.com/wiki/RAID/NVRAID_with_dmraid), it's best to use genkernel to compile in dmraid as a 3rd party module.  I believe this is only needed if you need to use the array for booting purposes which I do not.  However, it does seem to be the favored way of using FAKERAID arrays.  I would like to keep my custom (working) kernel settings which seems to be a possibility by specifying the "--kernel-config" flag to genkernel.  Does this mean I need to copy out my /usr/src/linux/.config out to an external directory and point the flag there?

The other possibility I thought of was using some sort of loadable module for dmraid which looks to have been attempted on the forums (https://forums.gentoo.org/viewtopic-t-719573.html) but abandoned.  Is this worth looking into?

Last question, I've manually run "dmraid -ay" and my /dev/mapper directory contains 2 "files": isw_bhidieehic_Data and isw_bhidieehic_Data1.  I only have 1 partition on the drive so I was wondering why there are two files?

Thanks in advance for any help!

----------

## Caligatio

Well after some searching (I really should have realized this), the numbers after the dev mapper names are the partition numbers

----------

## NeddySeagoon

Caligatio,

Windows supports two sorts of software raid. Windows dynamic disks and the customary fake raid.

Either dmraid setup should work but be aware that genkernel may not use the same version of dmraid as you get with emerge.

That can be important. dmraid cannot be built into the kernel, so you are forced to use an initrd if you need to boot from an initrd volume, if not, dmraid is started like any other service.

----------

## Caligatio

Thanks for the reply!

This is going to sound silly, but how does one start the dmraid service?  "rc-update add dmraid default" does not work.. is it called something else?

----------

## NeddySeagoon

Caligatio,

Look in /etc/init.d to see what its called.

It will be there after you have emerged dmraid

rc-update is right.

Use

```
 /etc/init.d/<dmraid> start
```

to start it from the command line. Substitute the correct name for <dmraid>

----------

## Caligatio

There's nothing that looks like dmraid in my init.d directory:

NetworkManager  checkroot    dbus           fuse      local       netmount   reboot.sh     shutdown.sh       udev-postmount

acpid           clock        depscan.sh     gpm       localmount  nscd       rmnologin     sshd              urandom

alsasound       consolefont  device-mapper  hald      lvm         numlock    rsyncd        syslog-ng         vixie-cron

bluetooth       consolekit   dmcrypt        halt.sh   modules     pciparm    runscript.sh  udev              xdm

bootmisc        crypto-loop  dmeventd       hostname  net.eth0    pwcheck    samba         udev-dev-tarball  xdm-setup

checkfs         cupsd        functions.sh   keymaps   net.lo      pydoc-2.6  saslauthd     udev-mount

I tried LVM but it complained about being written for baselayout-2

----------

## NeddySeagoon

Caligatio,

Its probably device-mapper, as that's what the dm in dmraid stands for.

device-mapper may well have a configuration file in /etc/conf.d/ you need to set up too.

----------

## Caligatio

Neddy,

I do appreciate all the help.  I tried starting devicemapper with "/etc/init.d/devicemapper start" but got the following error:

* The device-mapper init script is written for baselayout-2

 * Please do not use it with baselayout-1

I did a little Googling and ran across http://www.gentoo.org/doc/en/openrc-migration.xml  Is it possible to "upgrade" to baselayout-2?

----------

## NeddySeagoon

Caligatio,

dmraid should work with baselayout1, just not with that script. Upgrading is harmless, I'be been using baselayout2 for almost 3 years and its in the process of being stabilised now, so you would be an early adopter.

----------

## Caligatio

Is there a way to make this work without making an initrd image and still using baselayout-1?  It seems I've ran into the same problem encountered in the forum link I provided in my first post.

----------

## NeddySeagoon

Caligatio,

It should work with emerge dmraid.  I'm not sure if it needs a startup script but the kernel module will need to be loaded.

With baselayout1, that may be enough.

Loading the kernel module should make your dmraid devices appear in /dev, then you can mount them in the normal way.

The initrd is needed only when root is on a dmraid volume, sice dmraid cannot be read from root nor can it be built in the kernel.

----------

## Caligatio

Simply emerging dmraid does not install any sort of usable init.d script or a kernel module (that I can find).  Do I have to compile the module myself?

----------

## NeddySeagoon

Caligatio,

I've just built dmraid here ... heres some interesting messages from the on screen output ...

```
* Determining the location of the kernel source code

 * Found kernel source directory:

 *     /usr/src/linux

 * Found kernel object directory:

 *     /lib/modules/2.6.32-gentoo-r3/build

 * Found sources for kernel version:

 *     2.6.32-gentoo-r3

```

so it builds against the kernel at /usr/src/linux, which is normal for 3rd party kernel modules.

It installs the following files   

```
 usr/sbin/dmevent_tool

   usr/sbin/dmraid

   usr/lib64/libdmraid-events-isw.so

   usr/lib64/libdmraid.so

   usr/lib64/libdmraid.a

ecompressdir: bzip2 -9 /usr/share/man
```

which is a bit odd, as there are no .ko files there. 

The man page 

```
man dmraid
```

 says  *Quote:*   

>  "dmraid -ay" activates all software RAID sets discovered.

 

I can't test as I use kernel raid here. Don't just try the command above, read the man page first.

----------

## Caligatio

I did in fact try that exact command (as noted in my first post) but I'm not sure if it's possible to run that "normal" command prior to /etc/fstab being parsed.  If there is, that would greatly simplify my life.

----------

## NeddySeagoon

Caligatio,

Sorry about that. Its been a while since I played with dmraid.

You can edit the init script, to run that command before /etc/fstab is parsed.

You can write an init script and add it to the right runlevel so its run before /etc/fstab. I'm not sure that thats possible without using an initrd.

You can cheat ...

Add the following to /etc/conf.d/local ... in the start part.

```
dmraid -ay

mount -a
```

That runs dmraid -av as the last thing before you see the login prompt, then feeds /etc/fstab to mount again.

This has no effect on mounted filesystems but non mounted ones will be mounted.

----------

## Simba7

I've bumped into a problem, too.

I setup a RAID on a Sil3512A card. Well, the only option is libdmraid-events-isw.so, but I need sil. What happened?

It keeps giving me the error "libdmraid-events-sil.so: cannot open shared object file: No such file or directory"

----------

