Problems with software RAID1 setup

Asked by Jim Hutchinson

I need help solving a software RAID issue. I will try and explain. When I installed 7.10 (cleanly) I did so with the alternate CD and set up 2 identical drives to be a RAID 1 array. However, for whatever reason the first drive was not being mirrored. The second drive remained nearly empty. After a bit of research and outside help I managed to get the second drive to mirror and all seemed well. When I rebooted the computer, however, it failed to boot. It did load the kernel and began the boot sequence. In verbose mode I could see that the RAID drives were being stopped. Once they were stopped it would no longer boot. The computer hung for several minutes and then dumped into a busybox shell. Some of the errors refer to attempts to mount /root/dev, /root/sys, /root/proc and then "target filesystem doesn't have /sbin/init" before dumping to busybox and an (initramfs) prompt. I don't why it's stopping the drives but that is probably the cause of the problem.

I have a theory as to how I created the problem but it's only a guess. While trying to get the second drive to mirror, I ran the mdadm --add command like this.

sudo mdadm --add /dev/md1 /dev/sdb1

My system has two partitions (well 3 counting swap). md0 is where /home is mounted and md1 is /. These correspond to sda1 and sda2. These should mirror on sdb1 and sdb2. The above command was a mistake in that md1 (aka sda2) was mirrored to sdb1 - the wrong size partition (/ was being mirrored to where I wanted /home). I made a guess that I could undo this and fix it by using

sudo mdadm -- remove /dev/md1 /dev/sdb1

That seemed to work so I then did it the correct way. Output as follows. Notice the last line where it reports that mdadm: RE-ADDED /dev/sdb2

[~] sudo mdadm --add /dev/md0 /dev/sdb1
mdadm: added /dev/sdb1
[~] sudo mdadm --add /dev/md1 /dev/sdb2
mdadm: re-added /dev/sdb2

I suspect that the --remove option did more than I thought and I did not do enough to fix it. Like I said. This is just a guess.

I then proceeded to get the devices mirroring with

sudo mdadm /dev/md0 -G -n 2
sudo mdadm /dev/md1 -G -n 2

That resulted in mdstat output like this

md0 : active raid1 sdb1[2] sda1[0]
      291017344 blocks [2/1] [U_]
      [>....................] recovery = 0.2% (618560/291017344) finish=70.4min speed=68728K/sec

which I assumed meant everything was working fine. The process completed on both drive and when I rebooted it failed as described above.

I have another drive installed with Ubuntu so I am able to boot that install. I can mount the RAID drives and was able to see the status with /proc/mdstat. Here is the output.

Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
md1 : active raid1 sda2[0] sdb2[1]
      19534976 blocks [2/2] [UU]

md0 : active raid1 sda1[0] sdb1[1]
      291017344 blocks [2/2] [UU]

The data is intact. It just won't boot. Sorry for the long explanation but I wanted to be clear. I hope someone knows how to fix this. I'd like to be able to use my RAID setup without have to reinstall all over again. Next time I'm going hardware RAID.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Jim Hutchinson
Solved:
Last query:
Last reply:
Revision history for this message
Jim Hutchinson (jphutch) said :
#1

If it helps, here is my fstab

# /etc/fstab: static file system information.
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
# /dev/md1
UUID=86626e64-a777-42a4-b68c-e5f519c24997 / ext3 defaults,errors=remount-ro 0 1
# /dev/md0
UUID=3c275220-4faf-42be-9645-fbe5dc951fe3 /home ext3 defaults 0 2
# /dev/sda3
UUID=a340f453-2313-4aba-8520-26438823aad5 none swap sw 0 0
# /dev/sdb3
UUID=284ef771-c3b7-4a83-859a-23a4dde94daf none swap sw 0 0
/dev/hdb /media/cdrom0 udf,iso9660 user,noauto,exec 0 0
/dev/hda /media/cdrom1 udf,iso9660 user,noauto,exec 0 0

And partition table for sda

jim@gutsy:~$ sudo parted /dev/sda print

Disk /dev/sda: 320GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number Start End Size Type File system Flags
 1 32.3kB 298GB 298GB primary ext3 raid
 2 298GB 318GB 20.0GB primary ext3 boot, raid
 3 318GB 320GB 2065MB primary linux-swap

Information: Don't forget to update /etc/fstab, if necessary.

Revision history for this message
Jim Hutchinson (jphutch) said :
#2

Well, I solved this the old fashion way... I reinstalled.