# Problems installing RAID1

## b00zy

I've been trying to move everything from my current drive to a RAID1 setup. I have a RAID1 setup between my two 80G SATA drives, /dev/sda and /dev/sdb:

   - /dev/md0    /boot

   - /dev/md1    /swap

   - /dev/md2    /

   - /dev/md3    contains 4 LVM parititions for /tmp, /var, /usr, /home, /opt

These partitions have been mounted in the current environment and everything has been copied using `cp -a' to the md partitions.

My kernel is compiled with dm-mod and dm-mirror built-in, as well as sata-nv (for my nvidia RAID controller) and RAID1 built-in. sys-fs/lvm2 (static) is installed from portage.

When I boot from the current drive with the exact same kernel that was copied to /dev/md0 (2.6.11-gentoo-r7), the drives are viewed fine. I can mount them and read/write to them no problems. but when I try to boot from /dev/md0 (/dev/md0 is /boot and I pass root=/dev/md2 in grub) I get the error "Kernel panic - not syncing. no init found. try passing init= to the kernel." Both kernels go through the md init, but the RAID1 setup fails at the end ofthis:

```

md: raid1 personality registered as nr 3

md: md driver 0.90.1 MAX_MD_DEVS=256, MD_SB_DISKS=27

device-mapper: 4.4.0-ioctl (2005-01-12) initialised: dm-devel@redhat.com

oprofile: using NMI interrupt.

NET: Registered protocol family 2

IP: routing cache hash table of 4096 buckets, 64Kbytes

TCP established hash table entries: 262144 (order: 10, 4194304 bytes)

TCP bind hash table entries: 65536 (order: 8, 1048576 bytes)

TCP: Hash tables configured (established 262144 bind 65536)

NET: Registered protocol family 1

NET: Registered protocol family 10

IPv6 over IPv4 tunneling driver

NET: Registered protocol family 17

ACPI wakeup devices: 

HUB0 HUB1 USB0 USB1 USB2 F139 MMAC MMCI UAR1 

ACPI: (supports S0 S1 S4 S5)

md: Autodetecting RAID arrays.

md: autorun ...

md: considering sdb4 ...

md:  adding sdb4 ...

md: sdb3 has different UUID to sdb4

md: sdb2 has different UUID to sdb4

md: sdb1 has different UUID to sdb4

md:  adding sda4 ...

md: sda3 has different UUID to sdb4

md: sda2 has different UUID to sdb4

md: sda1 has different UUID to sdb4

md: created md3

md: bind<sda4>

md: bind<sdb4>

md: running: <sdb4><sda4>

raid1: raid set md3 active with 2 out of 2 mirrors

md: considering sdb3 ...

md:  adding sdb3 ...

md: sdb2 has different UUID to sdb3

md: sdb1 has different UUID to sdb3

md:  adding sda3 ...

md: sda2 has different UUID to sdb3

md: sda1 has different UUID to sdb3

md: created md2

md: bind<sda3>

md: bind<sdb3>

md: running: <sdb3><sda3>

raid1: raid set md2 active with 2 out of 2 mirrors

md: considering sdb2 ...

md:  adding sdb2 ...

md: sdb1 has different UUID to sdb2

md:  adding sda2 ...

md: sda1 has different UUID to sdb2

md: created md1

md: bind<sda2>

md: bind<sdb2>

md: running: <sdb2><sda2>

raid1: raid set md1 active with 2 out of 2 mirrors

md: considering sdb1 ...

md:  adding sdb1 ...

md:  adding sda1 ...

md: created md0

md: bind<sda1>

md: bind<sdb1>

md: running: <sdb1><sda1>

raid1: raid set md0 active with 2 out of 2 mirrors

md: ... autorun DONE.

ReiserFS: hda5: found reiserfs format "3.6" with standard journal

ReiserFS: hda5: using ordered data mode

ReiserFS: hda5: journal params: device hda5, size 8192, journal first block 18, max trans len 1024, max batch 900, max commit age 30, max tra

ns age 30

ReiserFS: hda5: checking transaction log (hda5)

ReiserFS: hda5: Using r5 hash to sort names

VFS: Mounted root (reiserfs filesystem) readonly.

Freeing unused kernel memory: 256k freed

```

Why would i be getting this problem if dm-mod and dm-mirror are built-in to the kernel?

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

grub.conf

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

```

#

# Sample boot menu configuration file

#

# Boot automatically after 30 secs.

timeout 5

# By default, boot the first entry.

default 0

# Fallback to the second entry.

# fallback 1

# New drive

title  GNU/Linux (2.6.11-gentoo-r7) (NEW DRIVE)

root (hd1,0)

kernel /vmlinuz-2.6.11-gentoo-r7 root=/dev/md2 gentoo=nodevfs vga=792

# Old drive

title  GNU/Linux (2.6.11-gentoo-r7)

root (hd0,0)

kernel /vmlinuz-2.6.11-gentoo-r7 root=/dev/hda5 gentoo=nodevfs vga=792

# New drive

title  GNU/Linux (2.6.11-gentoo-r4) (NEW DRIVE)

root (hd1,0)

kernel /vmlinuz-2.6.11-gentoo-r4 root=/dev/md2 gentoo=nodevfs vga=792

# For booting GNU/Linux

title  GNU/Linux (2.6.11-gentoo-r4)

root (hd0,0)

kernel /vmlinuz-2.6.11-gentoo-r4 root=/dev/hda5 gentoo=nodevfs vga=792

# For booting GNU/Linux

title  GNU/Linux (2.6.11-gentoo)

root (hd0,0)

kernel /kernel-2.6.11-gentoo root=/dev/hda5 gentoo=nodevfs vga=792

# For booting GNU/Linux

title  GNU/Linux (2.6.11-b00z)

root (hd0,0)

kernel /kernel-2.6.11-b00z root=/dev/hda5 gentoo=nodevfs vga=792

# For booting GNU/Linux

title  GNU/Linux (2.6.7-r11)

root (hd0,0)

kernel /kernel-2.6.7-r11 root=/dev/hda5

# For booting Windows NT or Windows95

title Windows NT / Windows 95 boot menu

rootnoverify (hd0,3)

makeactive

chainloader  +1

# For loading DOS if Windows NT is installed

# chainload /bootsect.dos

# Change the colors.

title Change the colors

color light-green/brown blink-red/blue

```

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

/etc/fstab on /dev/md2

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

```

# /etc/fstab: static file system information.

# $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/fstab,v 1.14 2003/10/13 20:03:38 azarah Exp $

#

# noatime turns off atimes for increased performance (atimes normally aren't

# needed; notail increases performance of ReiserFS (at the expense of storage

# efficiency).  It's safe to drop the noatime options if you want and to 

# switch between notail and tail freely.

# <fs>             <mountpoint>    <type>     <opts>            <dump/pass>

# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.

/dev/md0      /boot      ext3      defaults      1 1

/dev/md1      none      swap      sw         0 0

/dev/md2      /         reiserfs   noatime,notail      0 0

/dev/vg/tmp      /tmp      reiserfs   noatime,notail      0 0

/dev/vg/var      /var      reiserfs   noatime,notail      0 0

/dev/vg/usr      /usr      reiserfs   noatime,notail      0 0

/dev/vg/home   /home      reiserfs   noatime,notail      0 0

/dev/vg/opt      /opt      reiserfs   noatime,notail      0 0

/dev/cdroms/cdrom0   /mnt/cdrom   iso9660      noauto,ro      0 0

#/dev/fd0      /mnt/floppy   auto      noauto         0 0

# NOTE: The next line is critical for boot!

none         /proc      proc      defaults      0 0

# glibc 2.2 and above expects tmpfs to be mounted at /dev/shm for

# POSIX shared memory (shm_open, shm_unlink). 

# (tmpfs is a dynamically expandable/shrinkable ramdisk, and will

#  use almost no memory if not populated with files)

# Adding the following line to /etc/fstab should take care of this:

none         /dev/shm   tmpfs      defaults      0 0

rufus:/usr      /mnt/rufus/usr      nfs      nolock,intr,soft,rsize=8192,wsize=8192 0 0

rufus:/media   /mnt/rufus/media   nfs      nolock,intr,soft,rsize=8192,wsize=8192   0 0

#rufus:/home/cvsroot   /home/cvsroot   nfs      nolock,intr,hard,rsize=8192,wsize=8192   0 0

# WinXP

#/dev/hda4   /mnt/xp   ntfs   defaults   0   0

# Sandisk USB Drive

/dev/sda1   /mnt/sandisk   ext2      noauto         0 0

# NTFS

/dev/hda4   /mnt/xp         ntfs      noauto,umask=0022   0   0

```

----------

## nielchiano

 *b00zy wrote:*   

> but the RAID1 setup fails at the end ofthis:

 

the output shown is, I guess the output you get by booting with "root=/dev/hda5"?

Is it exactly the same as the output with "root=/dev/md0"? Mostly there is some error before the kernel pannic.

Try to startup the working setup and do an "lsmod" do you see any modules that look like raid or dm-related stuff?

The problem is that the kernel can't find the init program. probabley because he can't read the file-system.

You might try this: boot him from sda3. That disk should contain the exact same info than /dev/md0. Be carefull to mount it read-only, so you don't mess-up your raid-setup!

Just a debug hint: try specifying "init=/bin/bash". the kernel will skip all init-scripts and just give you a bash shell. That way you are sure nothing is done to the system without you knowing it.

But be carefull: NOTHING is done without you telling him! so it's up to you to unmount all drives, etc!

----------

## b00zy

 *nielchiano wrote:*   

>  *b00zy wrote:*   but the RAID1 setup fails at the end ofthis: 
> 
> the output shown is, I guess the output you get by booting with "root=/dev/hda5"?
> 
> Is it exactly the same as the output with "root=/dev/md0"? Mostly there is some error before the kernel pannic.
> ...

 

There doesn't appear to be any RAID-related modules being loaded:

```

Module                  Size  Used by

snd_pcm_oss            52320  0 

snd_mixer_oss          18304  1 snd_pcm_oss

parport                24832  0 

usb_storage            33728  0 

ehci_hcd               30280  0 

vfat                   12672  0 

msdos                   8704  0 

fat                    37040  2 vfat,msdos

nls_base                8640  2 vfat,fat

nvidia               4564860  12 

snd_intel8x0           25600  0 

snd_ac97_codec         80080  1 snd_intel8x0

snd_pcm                89864  3 snd_pcm_oss,snd_intel8x0,snd_ac97_codec

snd_timer              23304  1 snd_pcm

snd                    49448  6 snd_pcm_oss,snd_mixer_oss,snd_intel8x0,snd_ac97_codec,snd_pcm,snd_timer

snd_page_alloc          9800  2 snd_intel8x0,snd_pcm

forcedeth              16640  0 

r8169                  23180  0

```

I've tried booting with root=/dev/sda3 and init=/bin/bash to no avail.  :Sad:  When I specify root=/dev/sda3 it says invalid root device.

----------

## nielchiano

 *b00zy wrote:*   

> I've tried booting with root=/dev/sda3 and init=/bin/bash to no avail.  When I specify root=/dev/sda3 it says invalid root device.

 

Hmm, if he can't find /dev/sda3 it looks like he doesn't detect your hard drives well. Are you using udev? or devfs? and in what config? (mounted automaticaly at boot, ...?)

----------

## b00zy

Update:

I didn't solve this specific issue... but I did re-fdisk and re-lvm and all that stuff and finally got it working.

Trial & Error  :Rolling Eyes: 

----------

