# device-mapper raid monitoring

## pent0z

i have the rootfs on a hybrid raid0 on 2x sata 120gb disks (at home)

now i'd like to setup a raid1 (mirror) on a marvell sata-2 controller at work, but i've a question:

note: i'm using device-mapper / dmraid

there is some tools that can monitor the state of the single disks such as mdadm? (maybe by looking at /dev/mapper/control ???)... if one of the two disk goes down, how can i know it???

ok... i can know it by rebooting and watch the state of the disks on the raid's bios. but i'd like to know it from a remote machine (better if it can mail me every day the status)

or is better to use the md driver for a mirroring raid solution?

thanks

----------

## NeddySeagoon

pent0z,

You can have dmraid which is software raid (provided by the BIOS) or kernel raid, which is software raid provided by the kernel. 

I would reccomend kernel software raid because its hardware independant. You can move the raid set to any other hardware an it will 'just work'.  With BIOS raid, you only know it will work on the same hardware with the same BIOS. Its not important until something breaks.

----------

## sven_sol

Hi everyone,

I know this is old(ish), but I'm after the same thing.  

I'm using Hybrid raid, (there are reasons for this) and I know that the hardware/bios will not change.

So I too would like to know if there is a way monitoring the raid and spitting out an email of things are on their way out?

Will mdadm --monitor be able to monitor this, or is there some other programme out there?

Cheers, everyone.

Sven

----------

## Ast0r

Some cards (like the 3ware 9xxx series) have a utility that you can download which allows you to check the status of the driver, arrays, logical disks, etc. I know that the 9550SX that I use in one of my production servers is compatible with such a program. It's very easy to set up a cron job which runs a script that invokes this program (with the right options) and then greps the output for certain bits of text which reveal that something isn't working. Then an e-mail can be sent if a failure condition arises. I figured out how to use the program and wrote a script to do exactly what you are talking about (without the e-mail facility yet though) in about an hour.

Really cheap cards won't have such programs available, though.

----------

## sven_sol

This board is the VIA VT8237 SATA controller

Any ideas with this?

----------

## sven_sol

sorry - its the VT6420 controller...

----------

## troymc

Try:

# dmraid -r

or

# dmraid -s

You are going to be limited because it's dmraid, and that one solution is trying to handle all the proprietary hybrid RAID interfaces.

 *pent0z wrote:*   

> 
> 
> or is better to use the md driver for a mirroring raid solution? 
> 
> 

 

Yes! Yes! Yes!    :Very Happy: 

I cannot stress that enough. There are NO benefits to using hybrid RAID on linux (If anyone wants to claim some, I'm willing to listen).  Their sole market is for people who cannot afford true hardware RAID and are not using an OS capable of software RAID.

troymc

----------

## sven_sol

I've created the raid set with this:

```
echo "0 156301488 mirror core 2 32 nosync 2 /dev/sda 0 /dev/sdb 0" | dmsetup create raidset1
```

and when I try dmraid I get this:

```
livecd ~ # ./dmraid -ay /dev/mapper/raidset1

No Software RAID disks

livecd ~ # ./dmraid -r /dev/mapper/raidset1

No Software RAID disks

livecd ~ # ./dmraid -s /dev/mapper/raidset1

No Software RAID disks

```

if I try: 

```
livecd ~ # dmsetup status raidset1

0 156301488 mirror 2 8:0 8:16 4884423/4884422
```

I was wondering if this would return an error code if there was a problem with a disk?  And is it possible to set a disk to Failed/Errors so do testing?

Cheers!!

Sven

----------

## troymc

 *sven_sol wrote:*   

> 
> 
> I was wondering if this would return an error code if there was a problem with a disk?  And is it possible to set a disk to Failed/Errors so do testing?
> 
> 

 

You could always try pulling the power on one of the drives.

Not to beat a dead horse, but is this one more thing that kernel RAID can do that dmraid cannot? Fault testing.    :Cool: 

troymc

----------

## sven_sol

Ok... I've resigned myself to the fact that mdadm is the way to go.

How can I create an array so that the drive do not sync? dmsetup was fine, there was a nosync option, but I can't seem to see one for this.

Thanks everyone!

Sven.

----------

## troymc

 *sven_sol wrote:*   

> Ok... I've resigned myself to the fact that mdadm is the way to go.
> 
> How can I create an array so that the drive do not sync? dmsetup was fine, there was a nosync option, but I can't seem to see one for this.
> 
> Thanks everyone!
> ...

 

Hmm... define what you mean by sync.

troymc

----------

## sven_sol

well when I create a mirror is syncs the data between the drives.

I don't really want to do that as the drives are new and empty.   I read that it might have to sync the data even if it is empty, but I can't see a reason for it.  

That make sense?

----------

## troymc

I don't recall that happening when I've created mirrors.

I'd make sure the drives/partitions are wiped first, so that it doesn't see an old filesystem on the first device & try to mirror it to the other.

Then once you create the new filesystem on it, the only thing to mirror would be the filesystem data structures. And that should only take a couple of minutes at the most.

troymc

----------

## sven_sol

I know that this has gone way off topic, but at least I've found a solution!   :Smile: 

It has been resyncing each time I've been creating a mirror array.  To stop it from doing it I've been trying the --assume-clean command in mdadm, but it has never worked on the Live CD.  I statically compiled a new version and sent that to our test server (running the Live CD) (in to the /root folder).  Seems the assume-clean option was only for the --build option on the older version 

Interesting link on this is here

This is what I have so far, a little script that trashes the drives and creates an array, without  syncing.  Using the old verion of mdadm it will sync!

Note to Admins, can we have this version or a newer one on the 2006.1 if/when it comes out?  Thanks!!    :Very Happy: 

```
#!/bin/bash

# MAKE SURE THAT THE MDADM VERISION IS NEW!!!

# i.e. >=  v2.4.1    4 April 2006

LEVEL=1

#LEVEL=0

cd /root/

./mdadm --manage --stop /dev/md0

./mdadm --manage --remove /dev/md0

./mdadm --zero-superblock /dev/sda1

./mdadm --zero-superblock /dev/sdb1

# First drive partition, trash and set to Raid Auto detection

sfdisk /dev/sda <<EOF

0,,fd

,,

EOF

#Second drive partition, trash and set to Raid Auto detection

sfdisk /dev/sdb <<EOF

0,,fd

,,

EOF

# Create array

./mdadm --create --verbose --assume-clean /dev/md0 --level=${LEVEL} --raid-devices=2 /dev/sda1 /dev/sdb1

mkfs.xfs /dev/md0 -f
```

----------

## Dabbes0815

I have just one little Question, I want to know what programs I have to emerge to use the dmraid to map my Raid system, I found a lot of descriptions on the Internet, in one description they wrote that I have to :"emerge device-mapper", but this doesn't work, I'm not able to emerge it, because it wount be found, can anybody tell me the new name for this system and the exact emerge task.

----------

