# moving from raidtools to mdadm woes

## wyrd

the other day i happily synced and then checked for updates to my gentoo file server

imagine my shock to discover that raidtools had been masked and that mdadm was the new kid on the block

so i duly emerged it and now my mirrored array won't automatically sort it's self out

please help, i've searched these forums over and over, with no joy

as far as i'm aware all the kernel modules i need are loaded

and if i try automatically loading it once i'm logged in, it's ok

cheers, alex

Useful Stuff:

# fdisk -l

```
Disk /dev/sda: 250.0 GB, 250059350016 bytes

255 heads, 63 sectors/track, 30401 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1               1       30401   244196001   fd  Linux raid autodetect

Disk /dev/sdb: 250.0 GB, 250059350016 bytes

255 heads, 63 sectors/track, 30401 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System

/dev/sdb1               1       30401   244196001   fd  Linux raid autodetect
```

# cat /etc/mdadm.conf

```
DEVICE /dev/sda1 /dev/sdb1

ARRAY /dev/md0 devices=/dev/sda1,/dev/sdb1
```

# cat /proc/mdstat

```
Personalities : [raid1]

unused devices: <none>
```

# dmesg | grep md

```
Kernel command line: root=/dev/ram0 init=/linuxrc ramdisk=8192 real_root=/dev/hdb3 vga=0x314 acpi=force

ata1: SATA max UDMA/133 cmd 0xD400 ctl 0xD002 bmdma 0xB000 irq 3

ata2: SATA max UDMA/133 cmd 0xB800 ctl 0xB402 bmdma 0xB008 irq 3

md: raid1 personality registered for level 1
```

# mdadm -Asayes

```
mdadm: /dev/md0 has been started with 2 drives.
```

# cat /proc/mdstat

```
Personalities : [raid1]

md0 : active raid1 sda1[0] sdb1[1]

      244195904 blocks [2/2] [UU]

unused devices: <none>
```

----------

## calinb

I had a similar problem until I did

```

mdadm --examine -scan /dev/sda1

```

which returned,

```

ARRAY /dev/md1 level=raid1 num-devices=2 UUID=93302b9b:704a0e41:a8973bc4:ea236439

```

and I put that in my mdadm.conf file.

Hope that helps.

----------

## wyrd

nope, no joy there

i think the problem is the it never even trys to search super blocks for raid information

----------

## srob99

Is it a freshly created array? 

Newer versions of mdadm default to version 1 superblock, which the linux kernel will not auto-start.  To get auto-starting raid arrays, create the array with mdadm -e 0.90  and make sure all the raid modules are compiled into your kernel.

Can someone please explain the advantages of using a version 1 superblock, and having to go the whole initrd route to get them running for root partitions?

----------

## wyrd

no

an older array, had it since september

it was created with raidtools and all worked fine until i unmerged them

how can i check the superblock type?

----------

## dev-urandom

 *wyrd wrote:*   

> how can i check the superblock type?

 

```
mdadm --detail --query /dev/md0
```

----------

## wyrd

hummm

it would seem my mdadm has an off beat sense of humor

```
# mdadm --detail --query /dev/md0

/dev/md0: 232.88GiB raid1 2 devices, 0 spares. Use mdadm --detail for more detail.
```

----------

## dev-urandom

 *wyrd wrote:*   

> hummm
> 
> it would seem my mdadm has an off beat sense of humor
> 
> ```
> ...

 

Sigh, thats what you get when i randomly blurt out commands on a windows box  :Smile: 

Please try 

```
mdadm --examine --detail /dev/md0
```

 I am hoping this is the one.  :Wink: 

----------

## wyrd

it didn't like that either

```
# mdadm --examine --detail /dev/md0

mdadm: --examine/-E cannot be given with -D
```

```
#  mdadm --detail /dev/md0

/dev/md0:

        Version : 00.90.03

  Creation Time : Wed Sep  6 22:45:13 2006

     Raid Level : raid1

     Array Size : 244195904 (232.88 GiB 250.06 GB)

    Device Size : 244195904 (232.88 GiB 250.06 GB)

   Raid Devices : 2

  Total Devices : 2

Preferred Minor : 0

    Persistence : Superblock is persistent

    Update Time : Sun Feb 25 23:16:49 2007

          State : clean

 Active Devices : 2

Working Devices : 2

 Failed Devices : 0

  Spare Devices : 0

           UUID : 4ba5ab59:5ee15a73:bd42b897:63e9a606

         Events : 0.321996

    Number   Major   Minor   RaidDevice State

       0       8        1        0      active sync   /dev/sda1

       1       8       17        1      active sync   /dev/sdb1

```

----------

## drescherjm

You array appears to be fine. I had setup a few arrays with raidtools years ago and have moved to mdadm (again years ago) as raidtools was not being developed and mdadm was.

Can you post the output of 

```
emerge --info
```

----------

## wyrd

here you go

```
# emerge --info

Portage 2.1.2-r9 (default-linux/x86/2006.0, gcc-3.4.6, glibc-2.4-r4, 2.6.19-gentoo-r5-cad i686)

=================================================================

System uname: 2.6.19-gentoo-r5-cad i686 AMD Athlon(TM) XP 1700+

Gentoo Base System version 1.12.6

Timestamp of tree: Wed, 14 Feb 2007 12:59:01 +0000

dev-lang/python:     2.4.3-r4

dev-python/pycrypto: 2.0.1-r5

sys-apps/sandbox:    1.2.17

sys-devel/autoconf:  2.13, 2.61

sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10

sys-devel/binutils:  2.16.1-r3

sys-devel/gcc-config: 1.3.14

sys-devel/libtool:   1.5.22

virtual/os-headers:  2.6.17-r2

ACCEPT_KEYWORDS="x86"

AUTOCLEAN="yes"

CBUILD="i686-pc-linux-gnu"

CFLAGS="-march=athlon-xp -O3 -pipe"

CHOST="i686-pc-linux-gnu"

CONFIG_PROTECT="/etc /usr/share/X11/xkb"

CONFIG_PROTECT_MASK="/etc/env.d /etc/gconf /etc/revdep-rebuild /etc/terminfo /etc/texmf/web2c"

CXXFLAGS="-march=athlon-xp -O3 -pipe"

DISTDIR="/usr/portage/distfiles"

FEATURES="autoconfig distlocks metadata-transfer sandbox sfperms strict"

GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo"

LANG="en_GB"

MAKEOPTS=""

PKGDIR="/usr/portage/packages"

PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"

PORTAGE_TMPDIR="/var/tmp"

PORTDIR="/usr/portage"

SYNC="rsync://rsync.gentoo.org/gentoo-portage"

USE="X alsa apm arts audiofile avi berkdb bitmap-fonts bzip2 cdr cli cracklib crypt ctype cups dba dlloader dri eds emboss encode esd ethereal exif expat fam fastbuild foomaticdb force-cgi-redirect fortran ftp gd gdbm gif glut gmp gnome gpm gstreamer gtk gtk2 gtkhtml guile iconv idn imlib ipv6 isdnlog jpeg kde lcms libg++ libwww mad memlimit midi mikmod mng motif mozilla mp3 mpeg ncurses nls nptl nptlonly ogg opengl oss pam pcre pdflib perl png posix pppd python qt qt3 qt4 quicktime readline reflection samba sdl session simplexml slang soap sockets spell spl ssl tcltk tcpd tiff tokenizer truetype truetype-fonts type1-fonts udev vorbis x86 xml xml2 xorg xsl xv zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" USERLAND="GNU" VIDEO_CARDS="apm ark ati chips cirrus cyrix dummy fbdev glint i128 i740 i810 imstt mga neomagic nsc nv rendition s3 s3virge savage siliconmotion sis sisusb tdfx tga trident tseng v4l vesa vga via vmware voodoo"

Unset:  CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, LDFLAGS, LINGUAS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY
```

----------

## drescherjm

Your emerge --info was helpful as I did not have to ask you  like 8 questions...

On my local machine where I have 2 raid 1 arrays I have the only following in my mdadm.conf

DEVICE /dev/sd[ab]1

DEVICE /dev/sd[ab]3

ARRAY /dev/md0 UUID=402d317a:e2caa10f:19f8e977:627d6c4a

ARRAY /dev/md1 UUID=93fb32f7:cf373be1:f2e149ad:c2e115b9

I am using baselayout-1.12.9 where I see you are using 1.12.6 which I have had problems with in the past with a recent version of udev. BTW, what version of udev are you using? Have you ran dispatch-conf, etc-update or conf-update after you updated your system? Did you compile your kernel directly or did you use genkernel? 

I asked this last question because there is a chance that the sata driver is being loaded after the the raid array was trying to be started. I actually that problem a while back on a server at work and the solutions were to either compile the sata driver into the kernel (not as a module) or to modify the scripts that start the md array to do a udevstart before trying to find the devices. I did the script modification...

----------

## wyrd

i've been frantically trying to avoid writing / editing a startup script

i use genkernel, but compile all the modules i need straight in, the hardware on that machine will most likely never change

```
# udevinfo --version

udevinfo, version 103
```

i run etc-update after every emerge that doesn't say info dir is up to date

i've compiled in all of the lvm / raid modules i think are relevant but i'm not 100% sure

wanna see my /proc/config, although that's a huge file?

----------

## drescherjm

Your answers have ruled out just about every cause I can think of. I have a few more ideas that will require me to look at one of the servers that I built with raidtools but now use mdadm on so I will get back in a few hours as I am getting ready for work...

 *wyrd wrote:*   

> wanna see my /proc/config, although that's a huge file?

 

For now no. Are there any errors in your dmesg output?

----------

## wyrd

no errors that i can see

and the harddrives / sata stuff is started before raid / md is

----------

## wyrd

i upgraded mdadm again last night

and it all seems fixed now

i still don't get the auto detecting messages though, ah well

----------

## drescherjm

Glad to hear that. I could not think of anything else to try since everything checked out and you verified that your sata drivers were being loaded before your raid drivers.

----------

