# [solved]LVM + RAID: Boot problems

## wellno1

Hi m8,

I'm new to Gentoo and I'm having some problem to mount some md devices at boot after re-compiling the kernel. I mean, I have a Genkernel-built kernel which works, but now I need to re-compile the kernel in order to activate some moduls.

As you know, Genkernel create a initramfs image which actually works with my configuration. I tried to compile the kernel again, both with genkernel and manually, and noway to make it run. Kernel panic when trying to mount root (md device) on /root. Well, here some details:

```
xiscosan ~ # uname -a

Linux xiscosan 2.6.31-gentoo-r6 #1 SMP Sat Mar 6 00:43:45 CET 2010 x86_64 AMD Phenom(tm) II X2 545 Processor AuthenticAMD GNU/Linux

```

```
xiscosan ~ # cat /etc/fstab

/dev/md1                /boot           ext4            noauto,noatime  1 2

/dev/md4                /               ext4            noatime         0 1

/dev/GENTOO/home        /home           xfs             noatime         1 2

/dev/GENTOO/usr         /usr            xfs             noatime         1 2

/dev/GENTOO/opt         /opt            xfs             noatime         1 2

/dev/GENTOO/var         /var            xfs             noatime         1 2

/dev/GENTOO/tmp         /tmp            xfs             noatime         1 2

/dev/md3                none            swap            sw              0 0

shm                     /dev/shm        tmpfs           nodev,nosuid,noexec     0 0

```

```
xiscosan ~ # cat /boot/grub/grub.conf

default 0

timeout 30

splashimage=(hd1,0)/boot/grub/splash.xpm.gz

title Gentoo Linux 2.6.31-r6 by xesco

root (hd1,0)

kernel /boot/kernel-xisco-x86_64-2.6.31-gentoo-r6 dmraid lvm vga=791 agp=try_unsupported root=/dev/ram0 real_root=/dev/md4

initrd /boot/initramfs-xisco-x86_64-2.6.31-gentoo-r6

title Gentoo Linux 2.6.31-r6 by xesco (rescue)

root (hd1,0)

kernel /boot/kernel-xisco-x86_64-2.6.31-gentoo-r6 root=/dev/ram0 init=/bin/bb

initrd /boot/initramfs-xisco-x86_64-2.6.31-gentoo-r6

```

```
xiscosan ~ # cat /proc/mdstat

Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [multipath] [faulty]

md3 : active raid1 sdd1[2] sdb1[0] sdc1[1] sde1[3]

      979840 blocks [4/4] [UUUU]

md2 : active raid5 sdd2[2] sdb2[0] sdc2[1] sde2[3]

      1435536000 blocks level 5, 64k chunk, algorithm 2 [4/4] [UUUU]

md1 : active raid0 sdd3[2] sdb3[0] sdc3[1] sde3[3]

      2345216 blocks 64k chunks

md4 : active raid5 sdd4[2] sdb4[0] sdc4[1] sde4[3]

      15759552 blocks level 5, 64k chunk, algorithm 2 [4/4] [UUUU]

unused devices: <none>

```

```
xiscosan ~ # lvscan

  ACTIVE            '/dev/GENTOO/home' [250.00 GiB] inherit

  ACTIVE            '/dev/GENTOO/usr' [50.00 GiB] inherit

  ACTIVE            '/dev/GENTOO/var' [50.00 GiB] inherit

  ACTIVE            '/dev/GENTOO/tmp' [50.00 GiB] inherit

  ACTIVE            '/dev/GENTOO/opt' [50.00 GiB] inherit

```

As you can see, root device is a RAID5 md device (/dev/md4).

My question is: do I need to create a initramfs image? If possible, I would prefer not to use it.

In the kernel I activated (built-in) support for RAID0,1,2 and 5 and LVM (plus generic AHCI support): must I activate some more moduls?

Regards,

xescoLast edited by wellno1 on Mon Mar 15, 2010 9:55 pm; edited 1 time in total

----------

## NeddySeagoon

anarxisco,

As your root filesystem is outside LVM, you do not need an initrd.

The partitions donated to the kernel raid set must be marked as type 0xfd and the kernel raid autoassemble option must be on.

You will no longer use mdadm to assemble your raid sets as you won't have an initrd to put it in.

Here is some of my setup - Partitions

```
$ sudo fdisk /dev/sda -l

Disk /dev/sda: 1000.2 GB, 1000204886016 bytes

255 heads, 63 sectors/track, 121601 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x0553caf4

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *           1           5       40131   fd  Linux raid autodetect

/dev/sda2               6          70      522112+  82  Linux swap / Solaris

/dev/sda4              71      121601   976197757+   5  Extended

/dev/sda5              71         724     5253223+  fd  Linux raid autodetect

/dev/sda6             725      121601   970944471   fd  Linux raid autodetect
```

four identical drives.

SCSI setup

```
  │ │    < > RAID Transport Class                                          │ │  

  │ │    -*- SCSI device support                                           │ │  

  │ │    < > SCSI target support                                           │ │  

  │ │    [*] legacy /proc/scsi/ support                                    │ │  

  │ │        *** SCSI support type (disk, tape, CD-ROM) ***                │ │  

  │ │    <*> SCSI disk support                                             │ │  

  │ │    < > SCSI tape support                                             │ │  

  │ │    < > SCSI OnStream SC-x0 tape support                              │ │  

  │ │    <*> SCSI CDROM support                                            │ │  

  │ │    [ ]   Enable vendor-specific extensions (for SCSI CDROM)          │ │  

  │ │    <*> SCSI generic support  
```

Kernel Raid options

```
  │ │    --- Multiple devices driver support (RAID and LVM)                │ │  

  │ │    <*>   RAID support                                                │ │  

  │ │    [*]     Autodetect RAID arrays during kernel boot                 │ │  

  │ │    < >     Linear (append) mode                                      │ │  

  │ │    < >     RAID-0 (striping) mode                                    │ │  

  │ │    <*>     RAID-1 (mirroring) mode                                   │ │  

  │ │    < >     RAID-10 (mirrored striping) mode (EXPERIMENTAL)           │ │  

  │ │    <*>     RAID-4/RAID-5/RAID-6 mode                                 │ │  

  │ │    [ ]       RAID-4/RAID-5/RAID-6 Multicore processing (EXPERIMENTAL)│ │  

  │ │    < >   Self test for hardware accelerated raid6 recovery           │ │  

  │ │    < >   Multipath I/O support                                       │ │  

  │ │    < >   Faulty test module for MD                                   │ │  

  │ │    <*>   Device mapper support 
```

Note that all the boot options are built in, not modules as modules cannot be loaded until root is mounted - they live in /lib/modules/`uname -r`/

An initrd is a fake root filesystem, so anything can be modules except the kernel code to read the initrd.

You will also need support for your disk controller hardware in 

```
<*> Serial ATA and Parallel ATA drivers  ---> 
```

again as built in, not modules

Grub setup partial

```
 #2.6.33-gentoo

title=Kernel 2.6.33-gentoo-r3 (hd0)

root (hd0,0)

kernel (hd0,0)/2.6.33-gentoo root=/dev/md5 vga=0x317 video=vesafb:mtrr:3,ywrap

title=Kernel 2.6.33-gentoo (hd1)

root (hd1,0)

kernel (hd1,0)/2.6.33-gentoo root=/dev/md5

```

----------

## wellno1

Solved, thanks. I forgot to activate SCSI support

----------

