Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED]Kernel fails to mount RAID1 root dir at boot
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
fearofcarpet
Tux's lil' helper
Tux's lil' helper


Joined: 02 Apr 2005
Posts: 89
Location: Cambridge, MA

PostPosted: Wed Sep 06, 2006 10:30 am    Post subject: [SOLVED]Kernel fails to mount RAID1 root dir at boot Reply with quote

I am re-installing Gentoo after a major hardware upgrade and I decided to do the whole RAID thing this time around... I followed this guide: http://www.gentoo.org/doc/en/gentoo-x86+raid+lvm2-quickinstall.xml exactly, except I used the Jackass 2006.1 tarball and ck-sources (2.6.17) instead of the Gentoo stage 3 tarball and gentoo-sources. It is an x86 (32bit) build on an Athlon FX-55 on an nForce4 board with the onboard Nvidia RAID disabled.

Everything works just great with the following drive layout on 2 SATA drives, /dev/sda and /dev/sdb (I set "Linux RAID autodetect" in fdisk too):

/dev/md1 -> /boot (RAID1)
/dev/md2 -> / (RAID1)
/dev/md3 -> /dev/vg (RAID0 with /usr /home /var /opt as LVMs)
/dev/sda5 and /dev/sdb5 as swap

All partitions are ext except /home which is reiser and everything works flawlessly in chroot from the liveCD. When I try to boot it directly however, the kernel tells me a few things (which I have to catch a glimpse of as they fly by before the kernel panics) when it loads 'md'.

First, that the UUIDs differ between /dev/sda1 and sdb1 and /dev/sda2 and sdb2, then a message that /dev/md2 has already been initialized and thus can't be initialized by 'md' (I don't have the exact message because it is only on-screen for about 3 seconds). It then attempts to mount /dev/md2 as reiserfs (it is ext3) which of course fails and the kernel panics because it can't load the root partition. If I recompile the kernel with reiser as a module the kernel says it failed to mount /dev/md2 after trying ext3 ext2 and vfat (which are the filesystems that are compiled in) and then panics.

After all the garbage about /dev/md2 it says "adding /dev/sda1 and /dev/sdb1 to /dev/md1" (or whatever the exact message is) and tells me it had no problem constructing the RAID1 array between /dev/sda1 and /dev/sdb1 at /dev/md1 which, other than being smaller, is identical to /dev/md2 (both ext filesystems in RAID1, both created the same way). There is no mention of /dev/md3 at all, however.

Anyway, I've been trying to get this thing working for 2 days and am about ready to just give up and mount /dev/sda2 as /, but I'm not sure about a couple of things... First, why can't the kernel load /dev/md2 which mounts fine from the liveCD? Why on Earth does it think that it is a reiser partition when the LiveCD has no problem detecting and mounting it as ext?

Second, and perhaps more importantly at this point, how to I remove the two partitions from the RAID array? As it stands if I just reformat the individual partitions and point the kernel at /dev/sda2 with GRUB (instead of /dev/md2) it refuses to mount because 'md' still thinks /dev/sda2 and /dev/sdb2 need to be in a RAID1 array (and you can't mount individual partitions after they've been stuck to /dev/md*).

Third, and least importantly, does anyone know what the error about /dev/md2 already having been created is all about? And is this related to the inability of the kernel to mount it correctly? And why doesn't the kernel say boo about /dev/md3?

I would appreciate any advice... This is my first attempt at software RAID in Linux and I'm really impressed with the performance while installing/compiling under chroot so I'd very much like to get the stupid thing working. I'm pretty sure I'm not a complete idiot and I run Gentoo on two other desktops (one even uses hardware RAID0) and my work laptop, but clearly I'm missing something really obivous and silly.


Last edited by fearofcarpet on Mon Oct 02, 2006 12:15 pm; edited 1 time in total
Back to top
View user's profile Send private message
R!tman
Veteran
Veteran


Joined: 18 Dec 2003
Posts: 1303
Location: Zurich, Switzerland

PostPosted: Thu Sep 07, 2006 8:45 pm    Post subject: Reply with quote

Please post 'cat /proc/mdstat' when you use the livecd(if you don't want to type it use ">" to save to a file on a disk, usb-stick, ...), the relevant part of your kernel config regarding raid stuff and file systems and your grub.conf file.

EDIT: ...and /etc/fstab
Back to top
View user's profile Send private message
fearofcarpet
Tux's lil' helper
Tux's lil' helper


Joined: 02 Apr 2005
Posts: 89
Location: Cambridge, MA

PostPosted: Thu Sep 07, 2006 9:18 pm    Post subject: Reply with quote

Code:
jackass_livecd / # cat /proc/mdstat
Personalities : [raid0] [raid1]
md2 : active raid1 sdb2[1] sda2[0]
      19004895 blocks super non-persistent [2/2] [UU]

md3 : active raid0 sda3[0] sdb3[1]
      585938560 blocks 64k chunks

md1 : active raid1 sda1[0] sdb1[1]
      96256 blocks [2/2] [UU]

unused devices: <none>


Code:
# /etc/fstab: static file system information.
#
# 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 / tail freely.
#
# The root filesystem should have a pass number of either 0 or 1.
# All other filesystems should have a pass number of 0 or greater than 1.
#
# See the manpage fstab(5) for more information.
#

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

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

# NOTE: The next line is critical for boot!
proc                    /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)
shm                     /dev/shm        tmpfs           nodev,nosuid,noexec     0 0

/dev/md1          /boot                   ext2  noauto,noatime  1 2
/dev/md2          /                       ext3  noatime         0 1
/dev/sda5         none                    swap  sw,pri=1        0 0
/dev/sdb5         none                    swap  sw,pri=1        0 0
/dev/vg/usr       /usr                    ext3  noatime         1 2
/dev/vg/portage   /usr/portage            ext2  noatime         1 2
/dev/vg/distfiles /usr/portage/distfiles  ext2  noatime         1 2
/dev/vg/home      /home                   reiserfs  noatime,notail         1 2
/dev/vg/opt       /opt                    ext3  noatime         1 2
/dev/vg/tmp       /tmp                    ext2  noatime         1 2
/dev/vg/var       /var                    ext3  noatime         1 2
/dev/vg/vartmp    /var/tmp                ext2  noatime         1 2


Code:
jackass_livecd grub # cat grub.conf
default 0
timeout 10

title=Gentoo
root (hd0,0)
kernel /boot/vmlinuz root=/dev/md2


Code:
jackass_livecd linux #grep "RAID" /boot/config
# CONFIG_RAID_ATTRS is not set
# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
# CONFIG_SCSI_AACRAID is not set
CONFIG_MEGARAID_NEWGEN=y
# CONFIG_MEGARAID_MM is not set
# CONFIG_MEGARAID_LEGACY is not set
# CONFIG_MEGARAID_SAS is not set
# Multi-device support (RAID and LVM)
CONFIG_MD_RAID0=y
CONFIG_MD_RAID1=y
# CONFIG_MD_RAID10 is not set
# CONFIG_MD_RAID5 is not set
# CONFIG_MD_RAID6 is not set
...
#
# File systems
#
CONFIG_EXT2_FS=y
CONFIG_EXT2_FS_XATTR=y
CONFIG_EXT2_FS_POSIX_ACL=y
CONFIG_EXT2_FS_SECURITY=y
# CONFIG_EXT2_FS_XIP is not set
CONFIG_EXT3_FS=y
CONFIG_EXT3_FS_XATTR=y
CONFIG_EXT3_FS_POSIX_ACL=y
CONFIG_EXT3_FS_SECURITY=y
CONFIG_JBD=y
# CONFIG_JBD_DEBUG is not set
CONFIG_FS_MBCACHE=y
CONFIG_REISERFS_FS=y
# CONFIG_REISERFS_CHECK is not set
# CONFIG_REISERFS_PROC_INFO is not set
CONFIG_REISERFS_FS_XATTR=y
CONFIG_REISERFS_FS_POSIX_ACL=y
CONFIG_REISERFS_FS_SECURITY=y
CONFIG_JFS_FS=m
CONFIG_JFS_POSIX_ACL=y
# CONFIG_JFS_SECURITY is not set
# CONFIG_JFS_DEBUG is not set
# CONFIG_JFS_STATISTICS is not set
CONFIG_FS_POSIX_ACL=y
CONFIG_XFS_FS=y
CONFIG_XFS_EXPORT=y
CONFIG_XFS_QUOTA=y
CONFIG_XFS_SECURITY=y
CONFIG_XFS_POSIX_ACL=y
CONFIG_XFS_RT=y
# CONFIG_OCFS2_FS is not set
CONFIG_MINIX_FS=m
CONFIG_ROMFS_FS=m
CONFIG_INOTIFY=y
CONFIG_QUOTA=y
CONFIG_QFMT_V1=m
CONFIG_QFMT_V2=m
CONFIG_QUOTACTL=y
CONFIG_DNOTIFY=y
CONFIG_AUTOFS_FS=m
CONFIG_AUTOFS4_FS=m
# CONFIG_FUSE_FS is not set


This seems a bit odd; there is no UUID for /dev/md2...

Code:
jackass_livecd linux # mdadm --detail /dev/md1
/dev/md1:
        Version : 00.90.03
  Creation Time : Mon Sep  4 12:18:50 2006
     Raid Level : raid1
     Array Size : 96256 (94.02 MiB 98.57 MB)
    Device Size : 96256 (94.02 MiB 98.57 MB)
   Raid Devices : 2
  Total Devices : 2
Preferred Minor : 1
    Persistence : Superblock is persistent

    Update Time : Thu Sep  7 13:03:53 2006
          State : clean
 Active Devices : 2
Working Devices : 2
 Failed Devices : 0
  Spare Devices : 0

           UUID : cef75534:82895233:a08f5f97:79f027c7
         Events : 0.266

    Number   Major   Minor   RaidDevice State
       0       8        1        0      active sync   /dev/sda1
       1       8       17        1      active sync   /dev/sdb1
jackass_livecd linux # mdadm --detail /dev/md2
/dev/md2:
        Version : 00.90.03
  Creation Time : Thu Sep  7 12:34:40 2006
     Raid Level : raid1
     Array Size : 19004895 (18.12 GiB 19.46 GB)
    Device Size : 19004895 (18.12 GiB 19.46 GB)
   Raid Devices : 2
  Total Devices : 2
Preferred Minor : 2
    Persistence : Superblock is not persistent

    Update Time : Thu Sep  7 13:07:07 2006
          State : clean
 Active Devices : 2
Working Devices : 2
 Failed Devices : 0
  Spare Devices : 0

    Number   Major   Minor   RaidDevice State
       0       8        2        0      active sync   /dev/sda2
       1       8       18        1      active sync   /dev/sdb2
jackass_livecd linux # mdadm --detail /dev/md3
/dev/md3:
        Version : 00.90.03
  Creation Time : Mon Sep  4 12:21:04 2006
     Raid Level : raid0
     Array Size : 585938560 (558.79 GiB 600.00 GB)
   Raid Devices : 2
  Total Devices : 2
Preferred Minor : 3
    Persistence : Superblock is persistent

    Update Time : Mon Sep  4 12:21:04 2006
          State : clean
 Active Devices : 2
Working Devices : 2
 Failed Devices : 0
  Spare Devices : 0

     Chunk Size : 64K

           UUID : 14126ea6:db12b4c9:5d1a20c7:270d0875
         Events : 0.1

    Number   Major   Minor   RaidDevice State
       0       8        3        0      active sync   /dev/sda3
       1       8       19        1      active sync   /dev/sdb3


Code:
jackass_livecd linux # fdisk -l

Disk /dev/sda: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          12       96358+  fd  Linux raid autodetect
/dev/sda2   *          13        2378    19004895   fd  Linux raid autodetect
/dev/sda3            2379       38851   292969372+  fd  Linux raid autodetect
/dev/sda4           38852       38913      498015    5  Extended
/dev/sda5           38852       38913      497983+  82  Linux swap / Solaris

Disk /dev/sdb: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1          12       96358+  fd  Linux raid autodetect
/dev/sdb2   *          13        2378    19004895   fd  Linux raid autodetect
/dev/sdb3            2379       38851   292969372+  fd  Linux raid autodetect
/dev/sdb4           38852       38913      498015    5  Extended
/dev/sdb5           38852       38913      497983+  82  Linux swap / Solaris

Disk /dev/sdc: 60.0 GB, 60011642880 bytes
255 heads, 63 sectors/track, 7296 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1        7296    58605088+  af  Unknown

Disk /dev/md1: 98 MB, 98566144 bytes
2 heads, 4 sectors/track, 24064 cylinders
Units = cylinders of 8 * 512 = 4096 bytes

Disk /dev/md1 doesn't contain a valid partition table

Disk /dev/md3: 600.0 GB, 600001085440 bytes
2 heads, 4 sectors/track, 146484640 cylinders
Units = cylinders of 8 * 512 = 4096 bytes

Disk /dev/md3 doesn't contain a valid partition table

Disk /dev/md2: 19.4 GB, 19461012480 bytes
2 heads, 4 sectors/track, 4751223 cylinders
Units = cylinders of 8 * 512 = 4096 bytes

Disk /dev/md2 doesn't contain a valid partition table



Please let me know if there is any other information I should include....

Thanks!
Back to top
View user's profile Send private message
R!tman
Veteran
Veteran


Joined: 18 Dec 2003
Posts: 1303
Location: Zurich, Switzerland

PostPosted: Thu Sep 07, 2006 9:43 pm    Post subject: Reply with quote

This looks mostly ok to me, except for the "superblock is not persistent" in your mdadm details for md2 (good thinking, forgot about that!).

Try to assemble md2 using the "--update" option which should update the superblock. I guess "--update=summaries" should do it. Check with "mdadm --detail /dev/md2" again. If this doesn't work you can also try "--update=resync". This can take longer as the raid may have to resync ;-), you can watch using
Code:
watch "cat /proc/mdstat"

I know I had such things too, but it's been a while for me, luckily ;-).
Back to top
View user's profile Send private message
fearofcarpet
Tux's lil' helper
Tux's lil' helper


Joined: 02 Apr 2005
Posts: 89
Location: Cambridge, MA

PostPosted: Fri Sep 08, 2006 1:02 am    Post subject: Reply with quote

R!tman wrote:
This looks mostly ok to me, except for the "superblock is not persistent" in your mdadm details for md2 (good thinking, forgot about that!).

Try to assemble md2 using the "--update" option which should update the superblock. I guess "--update=summaries" should do it. Check with "mdadm --detail /dev/md2" again. If this doesn't work you can also try "--update=resync". This can take longer as the raid may have to resync ;-), you can watch using
Code:
watch "cat /proc/mdstat"

I know I had such things too, but it's been a while for me, luckily ;-).



Ok, that fixed all the boot problems - all three RAID arrays are detected by md and md2 mounts as an ext3 filesystem - hooray! Turns out (I think) that I accidentally used "build" instead of "create" when I put together /dev/md2 :)

...Now I get "unable to open initial console" and a reboot. I even tried restoring the old install (which was working great when I backed it up) to the new drives and got the exact same error message... Any suggestions? :?
Back to top
View user's profile Send private message
R!tman
Veteran
Veteran


Joined: 18 Dec 2003
Posts: 1303
Location: Zurich, Switzerland

PostPosted: Fri Sep 08, 2006 5:58 am    Post subject: Reply with quote

fearofcarpet wrote:
...Now I get "unable to open initial console" and a reboot. I even tried restoring the old install (which was working great when I backed it up) to the new drives and got the exact same error message... Any suggestions? :?

As your grub.conf looks fine to me, but nevertheless check again that the kernel parameter root=/dev/md2 really points to the root partition, I guess it might be a minor problem with udev. There have to be some devices even before /dev is mounted. This might help you, especially the part "known issues".

Keep me informed about your progress.
Back to top
View user's profile Send private message
fearofcarpet
Tux's lil' helper
Tux's lil' helper


Joined: 02 Apr 2005
Posts: 89
Location: Cambridge, MA

PostPosted: Fri Sep 08, 2006 10:28 am    Post subject: Reply with quote

The really confounding thing is that if I take sda2 and sdb2 out of the RAID1 array and just boot to /dev/sda2 I get the same error - even when using a backup of the perfectly functional install I had before I decided to monkey with it... I'm think it may be time to just start over from scratch, but if I take the time to rebuild a fresh installation and get the same error I may very well break down into tears.

I will re-check all the kernel parameters and re-emerge everything udev related when I get home... I'll be sure to post the results, hopefully from a happy Gentoo/RAID install :)
Back to top
View user's profile Send private message
R!tman
Veteran
Veteran


Joined: 18 Dec 2003
Posts: 1303
Location: Zurich, Switzerland

PostPosted: Fri Sep 08, 2006 11:01 am    Post subject: Reply with quote

fearofcarpet wrote:
The really confounding thing is that if I take sda2 and sdb2 out of the RAID1 array and just boot to /dev/sda2 I get the same error ...

That's why I think he raid is probably fine now, the problem is some kernel/udev thing. Please try the thing I mentioned earlier. If it still doesn't work maybe you're missing some options in your kernel.
fearofcarpet wrote:
I will re-check all the kernel parameters and re-emerge everything udev related when I get home... I'll be sure to post the results, hopefully from a happy Gentoo/RAID install :)

I'm not sure this is necessary and/or will help you, though it's very possible it will! Doesn't hurt, so why don't you try it. Nevertheless, keep the link I posted earlier in mind, mknod may do something good for you.

And btw, while chrooting with the livecd, don't forget to mount /proc and /dev!
Back to top
View user's profile Send private message
fearofcarpet
Tux's lil' helper
Tux's lil' helper


Joined: 02 Apr 2005
Posts: 89
Location: Cambridge, MA

PostPosted: Fri Sep 08, 2006 11:33 am    Post subject: Reply with quote

Yeah, I'm pretty sure my problem is covered in there because this installation was in fact installed from "old media". I bet I'm missing /dev/console and /dev/null... Though the solution is a bit cryptic (presumably the mount --bind / /test and mknod stuff has to be done from the livecd). At any rate I have to wait until after work to play with it (there is nothing more distracting than having to go to work with a sick computer at home!).

I always mount /proc and /dev before chrooting too :)
Back to top
View user's profile Send private message
R!tman
Veteran
Veteran


Joined: 18 Dec 2003
Posts: 1303
Location: Zurich, Switzerland

PostPosted: Fri Sep 08, 2006 5:41 pm    Post subject: Reply with quote

fearofcarpet wrote:
(there is nothing more distracting than having to go to work with a sick computer at home!)

I know exactly what you mean ;-)!
Back to top
View user's profile Send private message
fearofcarpet
Tux's lil' helper
Tux's lil' helper


Joined: 02 Apr 2005
Posts: 89
Location: Cambridge, MA

PostPosted: Fri Sep 08, 2006 11:30 pm    Post subject: Reply with quote

Yup, that was the problem... I needed to mknod /dev/null and /dev/console. So satisfying to see those init scripts fly by :)


Thanks for the help!
Back to top
View user's profile Send private message
R!tman
Veteran
Veteran


Joined: 18 Dec 2003
Posts: 1303
Location: Zurich, Switzerland

PostPosted: Sat Sep 09, 2006 5:36 am    Post subject: Reply with quote

fearofcarpet wrote:
Yup, that was the problem... I needed to mknod /dev/null and /dev/console. So satisfying to see those init scripts fly by :)


Thanks for the help!

You're welcome, glad I could help!

Maybe you could include a "[solved]" in the topic of your first post...
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum