# [Solved] Mounting /dev/md0 on /newroot failed

## a_smartboy8

HI All

Recently i upgraded my kernel from 2.6.7-r14 to 2.6.18-r2 and there started all the problems. starting from glib gcc etc. i was correcting those problems one by one and the worst thing happened. My computer is failing to mount the root partition.

this is the error which i am getting

```

mount:: Mounting /dev/md0 on /newroot failed: Input/Output error

!! Could not mount specified ROOT, try again

!! The root block revice is unspecified or not detected

```

I tried to do a cat /proc/mdstat and this is what i got

```

Cat /proc/mdstat

Personalities:

unused devices: <none>

```

My earlier fstab entries were the following

```

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

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

/dev/sda1      /boot      ext2      noauto,noatime      1 2

/dev/md0      /      ext3      noatime         0 1

/dev/sda2      none      swap      sw,pri=1      0 0

/dev/sdb2      none      swap      sw,pri=1      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

```

My Grub configuration is the following

```

# cat /boot/grub/grub.conf

default saved

timeout 10

fallback 1 2

#kernel which was compiled manually

title=Gentoo Linux 2.6.18-r2 SATA-RAID fbcon

root(hd0,0)

kernel (hd0,0)/kernel-2.6.18-gentoo-r2 root=/dev/md0 vga=0x31A video=vesafb:ywrap,mtrr

savedefault fallback

#Kernel compiled using genkernel

title=Gentoo Linux 2.6.18-r2 Genkernel Version

root(hd0,0)

kernel /boot/kernel-genkernel-x86_64-2.6.18-gentoo-r2 root=/dev/ram0 init=/linuxrc ramdisk=8192 real_root=/dev/md0 udev

initrd /boot/initramfs-genkernel-x86_64-2.6.18-gentoo-r2

savedefault fallback

#Old working kernel

title=Gentoo Linux 2.6.7-r14 SATA-RAID fbcon

root(hd0,0)

kernel (hd0,0)/kernel-2.6.7-gentoo-r14 root=/dev/md0 vga=0x31A video=vesafb:ywrap,mtrr

savedefault 

```

Can anyone guide me how to recover from this problem. I guess that my software RAID failed. Is there a way to recover from it without losing the data ??Last edited by a_smartboy8 on Mon Jan 15, 2007 2:40 pm; edited 1 time in total

----------

## NeddySeagoon

a_smartboy8,

It looks like you have left raid support out of your kernel.

Will your old kernel still boot ?

You should have seen  

```
Personalities : [raid0] [raid1] 
```

or whatever your personalities are in /proc/mdstat

Boot with your old kernel (or the liveCD) and fix your new kernel.

The liveCD will not auto assemble your raid and I don't think it makes the /dev entries when you modprobe the raid modules either.

Be careful to only assemble the raid set, not make a new one.

----------

## a_smartboy8

Thanks for your reply NeddySeagoon

 *NeddySeagoon wrote:*   

> a_smartboy8,
> 
> It looks like you have left raid support out of your kernel.
> 
> Will your old kernel still boot ?
> ...

 

No . As i updated my toolset when it tries to boot to old kernel it says that the kernel is too old so killing all processes. But my new kernel is having raid built into it as it was booting properly. All of a sudden it stopped working and i am left puzzled.

If i have to compile a new kernel using LiveCD can you advise me how to do it or point me to a website which explains so.  When i checked my livecd, inside the /usr/src there is  no linux distribution available and i don't know how to build without a linux distribution present in /usr/src/linux

----------

## a_smartboy8

lspci gives the following

```

0000:00:00.0 Host bridge: VIA Technologies, Inc. VT8385 [K8T800 AGP] Host Bridge (rev 01)

0000:00:01.0 PCI bridge: VIA Technologies, Inc. VT8237 PCI bridge [K8T800/K8T890 South]

0000:00:0b.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5705 Gigabit Ethernet (rev 03)

0000:00:0f.0 RAID bus controller: VIA Technologies, Inc. VIA VT6420 SATA RAID Controller (rev 80)

0000:00:0f.1 IDE interface: VIA Technologies, Inc. VT82C586A/B/VT82C686/A/B/VT823x/A/C PIPC Bus Master IDE (rev 06)

0000:00:10.0 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 81)

0000:00:10.1 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 81)

0000:00:10.2 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 81)

0000:00:10.4 USB Controller: VIA Technologies, Inc. USB 2.0 (rev 86)

0000:00:11.0 ISA bridge: VIA Technologies, Inc. VT8237 ISA bridge [KT600/K8T800/K8T890 South]

0000:00:11.5 Multimedia audio controller: VIA Technologies, Inc. VT8233/A/8235/8237 AC97 Audio Controller (rev 60)

0000:00:18.0 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] HyperTransport Technology Configuration

0000:00:18.1 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Address Map

0000:00:18.2 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] DRAM Controller

0000:00:18.3 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Miscellaneous Control

0000:00:19.0 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] HyperTransport Technology Configuration

0000:00:19.1 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Address Map

0000:00:19.2 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] DRAM Controller

0000:00:19.3 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Miscellaneous Control

0000:01:00.0 VGA compatible controller: nVidia Corporation NV11 [GeForce2 MX/MX 400] (rev b2)

```

----------

## NeddySeagoon

a_smartboy8,

You don't say if your HDDs are attached to your IDE or SATA controllers, nor if you are using raid0 or raid1 on your root.

Provided you are using raid1, its safe to mount one of the underlying partitions read only too look around.

You don't want to get the parts of the raid out of sync.

Heres an outline of the theory ...

boot the liveCD

modprobe the raid modules you need

mknod the raid /dev entries 

```
$ ls /dev/md/* -l

brw-rw---- 1 root disk 9, 0 Dec 30 19:38 /dev/md/0

brw-rw---- 1 root disk 9, 1 Dec 30 19:38 /dev/md/1

brw-rw---- 1 root disk 9, 2 Dec 30 19:38 /dev/md/2

brw-rw---- 1 root disk 9, 3 Dec 30 19:38 /dev/md/3

brw-rw---- 1 root disk 9, 4 Dec 30 19:38 /dev/md/4

brw-rw---- 1 root disk 9, 5 Dec 30 19:38 /dev/md/5

brw-rw---- 1 root disk 9, 6 Dec 30 19:38 /dev/md/6

```

as required

start you raid set, with mdadm do *not* make a new raid set - that will destroy your data.

mount your raid

```
mknod -m /dev/md0 660 b 9 0 /dev/md0
```

check and fix the ownership and group.

I'm a raid tools user, so I can't help with getting the raid started.

At boot, what do you get between the lines ... 

```
[   38.866970] md: autorun ...

[   39.431786] md: ... autorun DONE.
```

if the answer is nothing, the kernel is not autodetecting your raid.

There are three reasons for this

[list=]the partition type is not fd

the raid personality is a module

the raid personality is missing from the kernel altogether[/list]

You need to get your root fs up to be able to build a kernel since you need the sources and the tools there.

I suppose it could be more fundamental ... the disk driver is missing from the kernel altogether.

Did the message include 

```
unknown-block (x,y) 
```

if so what are x and y ?

----------

## a_smartboy8

OOps sorry. I forgot to mention that i use SATA disk controllers and raid 0 on it. My old kernel is mounting the RAID but it is stopping giving the error "kernel is too old". So i guess that there is some problem with my RAID detection in the new kernel ( surprisingly it was working well before).

root was mounted on sda3 | sdb3 using the Raid and i can't read sda3 as it is showing file system corruption. I am left a bit confused as one of my kernel detects the raid and closes down while other one is not detecting the raid at all.

Thanks for your support.  I will try all the steps mentioned in your reply and will get back to you with the results.

Regards,

smarty

----------

## NeddySeagoon

a_smartboy8,

Raid0 writes the first block of data (the chunk size) to one disk and the next to the other disk, so data is interleaved between the two disks. You cannot mount any part of a raid0 set without the other parts. The part that seems ok has the filesystem superblock on it, so mount is happy. That the other part appears broken is quite correct.

Since your old kernel is forming the raid set, the raid set itself is ok.

This narrows it down to 5 things missing from the kernel :-

```
The SATA low level driver

The SCSI Disk Driver

The RAID0 personality

Support for your root filesystem type

Support for MS-DOS Partition tables
```

All need to be built into your kernel, modules cannot work

I notice now that in an earlier post, you mentioned /newroot.

That implies that you are using an initrd and possibly genkernel.

genkernel will not make you a suitable kernel left to its own devices, you need to run it with the -menuconfig option and select some things for yourself.

----------

## a_smartboy8

Thanks NeddySeagoon. your reply gives me some sense of relief; ie knowing that i may be able to retrieve my old data.

 *NeddySeagoon wrote:*   

> a_smartboy8,
> 
> I notice now that in an earlier post, you mentioned /newroot.
> 
> That implies that you are using an initrd and possibly genkernel.
> ...

 

Last time i compiled the kernel using genkernel --menuconfig option and it was supporting raid and all of sudden it stopped working.  I am able to mount the boot partition but since i am not able to mount my raid devices, how will i be able to compile the kernel . I believe that  if i can compile a kernel using some resources for eg Livecd then i will be able to copy that to /boot and hopefully the systems will work.

I am left with the following problems now. While using the livecd i couldn't find a /usr/src/linux where we normally compile the kernel and i don't know how to build a kernel without a linux distribution present in /usr/src/linux. Can you advise me how i will be able to overcome this situation.

I am sorry if some of my questions appear to be dumb. I am not an expert with gentoo.   Thanks once again for your help.

----------

## NeddySeagoon

a_smartboy8,

My earlier post gives broad guidance on how to get your raid started and mounted from the liveCD.

The liveCD provides mdadm rather than raidtools, so the exact command for starting your raid set will not be what I use as a raid tools user.

----------

## a_smartboy8

 *NeddySeagoon wrote:*   

> a_smartboy8,
> 
> My earlier post gives broad guidance on how to get your raid started and mounted from the liveCD.
> 
> The liveCD provides mdadm rather than raidtools, so the exact command for starting your raid set will not be what I use as a raid tools user.

 

Still i am not able to start the raid from livecd

when i try to mount the sda3  (root) it gives the following error

```

#mount /dev/sda3 /mnt/gentoo

EXT3-fs error (device sda3): ext3_check_descriptors: Block Bitmap for group 896 not in group ( block 0)!

EXT3-fs : group descriptors corrupted !

mount: wrong fs type, bad option, bad superblock on dev/sda3

```

When i  do a fdisk for /dev/sda i get the following

```

Disk /dev/sda: 80.0 GB  80026361856 bytes

255 heads, 63 sectors/track   , 9729 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot      Start    End        Blocks     Id    System

/dev/sda1         1       4         32098+   83    Linux

/dev/sda2         5      97        747022+   82    Linux

/dev/sda3        98      9729    77369040    fd     Linux raid autodetect

```

And it is the same for /dev/sdb

Is this error because of file system corruption or the system not able to mount raid.

I found out the the cause for all  these problems. One of my hard disks got disconnected and i booted my system without knowing that and then afterwards my raid array is not mounting

Can anyone guide me how to restart the raid & remount my raid arrayLast edited by a_smartboy8 on Mon Jan 08, 2007 10:55 pm; edited 1 time in total

----------

## NeddySeagoon

a_smartboy8,

You cannot mount the parts of a raid0 seperately.

Boot the liveCD then,

```
modprobe raid0

modprobe raid1

mknod -m 660 /dev/md0 b 9 0
```

That creates your raid special device file.

Check it has the correct owner, group and permissions.

```
ls -l /dev/md/0 -l

brw-rw---- 1 root disk 9, 0 Jan  8 21:06 /dev/md0
```

fix as required.

That much I'm sure about. The next command is threory

```
mdadm --assemble /dev/md0 /dev/sda3 /dev/sdb3
```

That should assemble and start your raid.

```
mount -t <fstype> /dev/md0 /some/mountpoint 
```

should mount it.

----------

## a_smartboy8

Thanks NeddySeagoon . You are a star.  I managed to mount the raid successfully

But still the problem is not fully solved. I managed to compile a kernel (26.18-r3) and copied it to the /boot partition and updated the grub.conf. When i try to boot, this is the error which i am getting

```

md: autodetecting raid arrays 

md: autorun

md: ..autorun done

ReiserFS : md0: warning : sh-2006 : read_super_block : bread failed ( dev md0, block 2 size 4096)

ReiserFS : md0: warning : sh-2006 : read_super_block : bread failed ( dev md0, block 16 size 4096)

EXT3-fs: unable to read superblock

EXT2-fs: unable to read superblock

SQUASHFS error: sb_bread failed reading block 0x0

FAT: unable to read boot sector

VFS: cannot open root devbice "md0" or unknown-block (9,0)

Please append a correct "root=" boot option

Kernel Panic - not syncing : VFS: Unable to mount root fs on unknown block (9,0)

```

  :Crying or Very sad: 

----------

## NeddySeagoon

a_smartboy8,

```
md: autodetecting raid arrays

md: autorun

md: ..autorun done 
```

This tells that the kernel is not auto assembling your raid set.

There a a few things to check.

The partitions are of type 0xfd.

```
fdisk -l
```

will show that, and fdisk will let you fix it.

Your raid personalities are not built into the kernel (modules won't work)

The kernel is missing the high level SCSI driver (must be built in)

The kernel is missing the low level chip set driver for your SATA (must be built in)

Post your lspci output if you need some hints with the kernel

----------

## a_smartboy8

Thanks Neddyseagoon

My fdisk -l is given in the previous posts (Given above)

"lspci" when the system was working fine is given below

```

0000:00:00.0 Host bridge: VIA Technologies, Inc. VT8385 [K8T800 AGP] Host Bridge (rev 01)

0000:00:01.0 PCI bridge: VIA Technologies, Inc. VT8237 PCI bridge [K8T800/K8T890 South]

0000:00:0b.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5705 Gigabit Ethernet (rev 03)

0000:00:0f.0 RAID bus controller: VIA Technologies, Inc. VIA VT6420 SATA RAID Controller (rev 80)

0000:00:0f.1 IDE interface: VIA Technologies, Inc. VT82C586A/B/VT82C686/A/B/VT823x/A/C PIPC Bus Master IDE (rev 06)

0000:00:10.0 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 81)

0000:00:10.1 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 81)

0000:00:10.2 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 81)

0000:00:10.4 USB Controller: VIA Technologies, Inc. USB 2.0 (rev 86)

0000:00:11.0 ISA bridge: VIA Technologies, Inc. VT8237 ISA bridge [KT600/K8T800/K8T890 South]

0000:00:11.5 Multimedia audio controller: VIA Technologies, Inc. VT8233/A/8235/8237 AC97 Audio Controller (rev 60)

0000:00:18.0 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] HyperTransport Technology Configuration

0000:00:18.1 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Address Map

0000:00:18.2 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] DRAM Controller

0000:00:18.3 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Miscellaneous Control

0000:00:19.0 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] HyperTransport Technology Configuration

0000:00:19.1 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Address Map

0000:00:19.2 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] DRAM Controller

0000:00:19.3 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Miscellaneous Control

0000:01:00.0 VGA compatible controller: nVidia Corporation NV11 [GeForce2 MX/MX 400] (rev b2)

```

----------

## NeddySeagoon

a_smartboy8,

Your fdisk post shows the raid partition type as 0xfd so thats OK.

Your 2.6.18-gentoo-r2 kernel needs  Device Drivers  ---> SCSI device support  ---> 

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

  │ │<*> SCSI device support                                              │ │  

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

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

  │ │<*>   SCSI disk support 
```

then under  SCSI low-level drivers  ---> choose

```
 <*> VIA SATA support 
```

Thats for your hardware.

Then under

```
   │ │    SCSI device support  --->                                        │ │  

  │ │    Multi-device support (RAID and LVM)  --->  
```

you need 

```
  │ │[*] Multiple devices driver support (RAID and LVM)                   │ │  

  │ │<*>   RAID support                                                   │ │  

  │ │< >     Linear (append) mode                                         │ │  

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

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

Thats for your RAID support. As its all required for booting it must be built in.

Modules will not work.

----------

## a_smartboy8

Thanks NeddySeagoon. Sorry to bother you with so much queries. Your help is really appreciated.

I compiled the Kernel again (2.6.18-r3 and not the r2 version)and this time i made sure that the SATA device drivers & SCSI drivers were present

so Make command worked fine

But when i did make modules_install it gave the following error

```

rm : cannot remove '/lib/modules/26.18-gentoo-r3/kernel/arch' Function not implemented

rm : cannot remove '/lib/modules/26.18-gentoo-r3/kernel/crypto' Function not implemented

rm : cannot remove '/lib/modules/26.18-gentoo-r3/kernel/drivers' Function not implemented

rm : cannot remove '/lib/modules/26.18-gentoo-r3/kernel/fs' Function not implemented

rm : cannot remove '/lib/modules/26.18-gentoo-r3/kernel/lib' Function not implemented

rm : cannot remove '/lib/modules/26.18-gentoo-r3/kernel/net' Function not implemented

rm : cannot remove '/lib/modules/26.18-gentoo-r3/kernel/sound' Function not implemented

make: *** [_modinst_] Error 1

```

But even after that error i thought of giving it a try and copied the bzimage to boot and then rebooted the system

This time the Raid started without any problem and listed both the drives. But towards the end of booting up it showed the following error

```

* Checking all filesystems. .....

fsck.ext2: No such device or address while trying to open /dev/sda1

Possibly non existent swap device?

*Fsck could not correct all errors, Manual repair needed

Give root password for maintenance

(or Type Control-D to continue)

```

 /dev/sda1 was my boot partition

I entered the root password after that and did a fdisk -l

It gave me a surprise my sda & sdb revices were renamed to hde & hdg respectively

So i edited my fstab entry and changed the sda & sdb to hde & hdg and the system started. Do you know why the /dev/sda & /dev/sdb became hde & hdg.

----------

## jgrnght

I'm having a similar problem... and I think the solution is the same for me... for some reason it looks like its renaming my sdd (sata) to hde through possibly hdh??? I can't really tell because it scrolls by too fast... Does anyone know why this is happening?  I'm using 2.6.18... when i used genkernel and coldplugged everything this didn't happen...

----------

## NeddySeagoon

a_smartboy8,

You have choosen the old SATA drive under the IDE part of the kernel configuration, not the preferred (newer) ones unde SCSI.

The old driver makes your SATA drives appear as masters on the next free IDE devices.

```
  │ │                   <*> ATA/ATAPI/MFM/RLL support                                                            │ │  

  │ │                   (2)   Max IDE interfaces                                                                 │ │  

  │ │                   <*>   Enhanced IDE/MFM/RLL disk/cdrom/tape/floppy support                                │ │  

  │ │                   ---     Please see Documentation/ide.txt for help/info on IDE drives                     │ │  

  │ │                   [ ]     Support for SATA (deprecated; conflicts with libata SATA driver) <----- 
```

Do not use this SATA driver.

SATA is treated as SCSI, choose SCSI disk support and under SCSI Low Level Drivers, the SATA support for your SATA chip set.

NB. They are not all on the SATA submenu.

----------

