# fsck.xfs /dev/md0 does not exist

## drdreff

First time I've been stumped an not found an answer in the archives... 

This just started happening after a long upgrade. My system fails to finish booting ofter fsck fails on my root partition (3 disk raid5). When I give the root password, the root is fully mounted and intact.

I have added TARBALL=yes to rc.conf and re-emerged a dozen packages. I can get up with a liveCD so I can pull logs, but I don't know where to start with this one. 

Thanks in advance for the help.

----------

## NeddySeagoon

drdreff,

Describe your raid5 setup. Drive and partition names that are donated to the raid.

Post 

```
mdadm /dev/<partition> -E
```

```
fdisk -l 
```

for one of the raid drives may be useful.

----------

## drdreff

Well now that is interesting...

```

livecd / # mdadm /dev/md0 -E

mdadm: No md superblock detected on /dev/md0.

livecd / # cat /proc/mdstat 

Personalities : [raid0] [raid1] [raid6] [raid5] [raid4] [raid10] 

md0 : active raid5 sda2[0] sdc2[2] sdb2[1]

      974566912 blocks level 5, 64k chunk, algorithm 2 [3/3] [UUU]

      

unused devices: <none>

livecd / # fdisk -l

Disk /dev/sda: 500.1 GB, 500107862016 bytes

255 heads, 63 sectors/track, 60801 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: 0x00000000

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *           1          13      104391   83  Linux

/dev/sda2              14       60677   487283580   fd  Linux raid autodetect

/dev/sda3           60678       60801      996030   82  Linux swap / Solaris

Disk /dev/sdc: 500.1 GB, 500107862016 bytes

255 heads, 63 sectors/track, 60801 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: 0x00000000

   Device Boot      Start         End      Blocks   Id  System

/dev/sdc1   *           1          13      104391   83  Linux

/dev/sdc2              14       60677   487283580   fd  Linux raid autodetect

/dev/sdc3           60678       60801      996030   82  Linux swap / Solaris

Disk /dev/sdb: 500.1 GB, 500107862016 bytes

255 heads, 63 sectors/track, 60801 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: 0x00000000

   Device Boot      Start         End      Blocks   Id  System

/dev/sdb1   *           1          13      104391   83  Linux

/dev/sdb2              14       60677   487283580   fd  Linux raid autodetect

/dev/sdb3           60678       60801      996030   82  Linux swap / Solaris

Disk /dev/md0: 998.0 GB, 997956517888 bytes

2 heads, 4 sectors/track, 243641728 cylinders

Units = cylinders of 8 * 512 = 4096 bytes

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

I/O size (minimum/optimal): 65536 bytes / 131072 bytes

Disk identifier: 0x00000000

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

livecd / # 

```

Thanks for taking a look...

----------

## NeddySeagoon

drdreff,

```
# mdadm /dev/md0 -E 
```

is not correct.  The raid superblock is on the underlying partition.

Try 

```
# mdadm /dev/sda2 -E 
```

for example.

```
   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *           1          13      104391   83  Linux

/dev/sda2              14       60677   487283580   fd  Linux raid autodetect

/dev/sda3           60678       60801      996030   82  Linux swap / Solaris 
```

is interesting

If /dev/sda1 or /dev/sda3 are part of raid sets, they will not be auto assembled by the kernel as the partition types are not fd.

Thats not wrong, it means you have to use mdadm in an initrd to assemble any raid set you want to use for root. 

When your system is running, what do you have in /proc/mdstat ?

----------

## drdreff

Here is a more correct mdadm -E

```

livecd / # mdadm /dev/sda2 -E

/dev/sda2:

          Magic : a92b4efc

        Version : 0.90.00

           UUID : 8c539f22:a2e6e70f:02bd0424:6f23f4a7

  Creation Time : Sat Nov 15 15:11:47 2008

     Raid Level : raid5

  Used Dev Size : 487283456 (464.71 GiB 498.98 GB)

     Array Size : 974566912 (929.42 GiB 997.96 GB)

   Raid Devices : 3

  Total Devices : 3

Preferred Minor : 0

    Update Time : Tue Feb  8 18:57:54 2011

          State : clean

 Active Devices : 3

Working Devices : 3

 Failed Devices : 0

  Spare Devices : 0

       Checksum : fe89b7ab - correct

         Events : 6461940

         Layout : left-symmetric

     Chunk Size : 64K

      Number   Major   Minor   RaidDevice State

this     0       8        2        0      active sync   /dev/sda2

   0     0       8        2        0      active sync   /dev/sda2

   1     1       8       18        1      active sync   /dev/sdb2

   2     2       8       34        2      active sync   /dev/sdc2

```

And /proc/mdstat which was above as well: 

```

livecd / # cat /proc/mdstat

Personalities : [raid0] [raid1] [raid6] [raid5] [raid4] [raid10] 

md0 : active raid5 sda2[0] sdc2[2] sdb2[1]

      974566912 blocks level 5, 64k chunk, algorithm 2 [3/3] [UUU]

      

unused devices: <none>

```

The bootable partitions are not part of the raid group. /dev/sda1 is my primary boot, which I periodically mirror to one of the other 3 drives.

----------

## NeddySeagoon

drdreff,

```
Version : 0.90.00 

...

Preferred Minor : 0 
```

shows that this raid set should get /dev/md0, and it supports auto assembly so everything is in order so far.

Try the following on your kernel 

```
$ grep AUTODE /usr/src/linux/.config

CONFIG_MD_AUTODETECT=y
```

Once upon a time, raid sets were always auto detected.  Now you need a kernel option.

Grub can load from a raid1 mirror set as long as its made with a version 0.9 superblock.

It does this by ignoring that its a mirror.

----------

## drdreff

My kernel already has that set. The RAID is getting reassembled, but fsck can't find the /dev/md0 device to scan. That is the odd part. When I drop to the root shell, the raid is fully assembled and everything is intact, mounted as /.

I thought it was udev, but adding 

```

rc-update add mdadm boot

```

did not help, as was proposed in another place.

----------

## NeddySeagoon

drdreff,

Adding mdadm to the boot runlevel can't help as md0 must be assembled before root can be mounted to read any init scripts.

emerge wgetpaste if you don't have it and put your kernel .config on a pastebin as it won't fit in a post.

Tell me the URL.

----------

## drdreff

 *NeddySeagoon wrote:*   

> 
> 
> Adding mdadm to the boot runlevel can't help as md0 must be assembled before root can be mounted to read any init scripts.
> 
> 

 

Right, The problem is that my system seems to be assembling the raid and executing init scripts before it fails.

 *NeddySeagoon wrote:*   

> 
> 
> emerge wgetpaste if you don't have it and put your kernel .config on a pastebin as it won't fit in a post.
> 
> Tell me the URL.

 

I will get that tonight.

----------

