LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 08-04-2005, 04:31 PM   #1
johnwyles
LQ Newbie
 
Registered: May 2005
Location: Austin, TX
Distribution: Gentoo
Posts: 7

Rep: Reputation: 0
Software RAID 1 from Existing Boot Drive


My problem is that I am getting an incorrect superblock when booting a RAID1 mirror. I have tried many things and so I will outline my procedure to see if there is something I missed and to see if there is something I did wrong. I do not have raidtools so 90% of the documentation out there cannot be applied to me. togami.com/~warren/guides/remoteraidcrazies/ <--- This page was as close as any document has come to helping me with this process.

This whole procedure was performed after booting a Live CD with none of the SATA drives mounted.

My setup plan:
/dev/sda is the pre-existing master and the drive I am wanting to mirror from. So data in the synch should flow sda -> sdb.

Code:
/dev/sda1 -> /dev/md0 (ext3) - to be "/boot"
/dev/sdb1 -> /dev/md0 (ext3) - to be "/boot"

/dev/sda2 -> /dev/md1 (swap)
/dev/sdb2 -> /dev/md1 (swap)

/dev/sda3 -> /dev/md2 (ext3) - to be "/"
/dev/sdb3 -> /dev/md2 (ext3) - to be "/"
Procedure:
To create the array:

I fdisked the /dev/sdb drive and made sure it was exactly like /dev/sda. I then ran mkfs.ext3 for /dev/sdb1 and /dev/sdb3, and ran mkswap for /dev/sdb2. Now that the drives were identical in their partition scehem I changed the filesystem type to "fd" for both /dev/sda and /dev/sdb. Next I created the array:

Code:
mdadm --create /dev/md0 --level=1 --raid-disks=2 /dev/sda1 /dev/sdb1
mdadm --create /dev/md1 --level=1 --raid-disks=2 /dev/sda2 /dev/sdb2
mdadm --create /dev/md2 --level=1 --raid-disks=2 /dev/sda3 /dev/sdb3
After issuing cat /proc/mdstat I saw that all drives were sync'ed properly (they all had [UU]). With the drives now sync'ed I moved on to mounting what is to be the root and boot partitions:

Code:
mount /dev/md2 /mnt/sysimage
Code:
mount /dev/md0 /mnt/sysimage/boot
I then chroot'ed to the environment and changed the /etc/fstab file and the /boot/grub/grub.conf file.

Code:
chroot /mnt/sysimage
Code:
vi /etc/fstab
Here I removed LABEL=/ and LABEL=/boot for / and /boot mountpoints respectively. I replaced these lines with the following:
Code:
/dev/md2      /            ext3    defaults    1 1
/dev/md0      /boot     ext3    defaults    1 2
Since these drives were apparently labeled I de-labeled them:
Code:
e2label /dev/sda1 ""
e2label /dev/sda3 ""
e2label /dev/sdb1 ""
e2label /dev/sdb3 ""
Code:
vi /etc/fstab
Here I added a kernel and initrd that reflected my system:
Code:
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
title Fedora Core 4 RAID1 (2.6.12-1.1398_FCsmp)
        root (hd0,0)
        kernel /kernel-2.6.12-1.1398_FCsmp ro root=/dev/md0
        initrd /initrd-2.6.12-1.1398_FCsmp-RAID1.img
title Fedora Core 4 (2.6.12-1.1398_FCsmp)
        root (hd0,0)
        kernel /kernel-2.6.12-1.1398_FCsmp ro root=/dev/sda1
        initrd /initrd-2.6.12-1.1398_FCsmp.img
Since I wanted to be sure I had RAID1 loading on boot I built the ramdisk mentioned in the
Code:
/boot/grub/grub.conf
above:
Code:
mkinitrd --preload raid1 --with=raid1 /initrd-2.6.12-1.1398_FCsmp-RAID1.img 2.6.12-1.1398_FCsmp
Everything was ready, as far as I could tell, so I rebooted and got the message that the superblock did not match and a prompt for an emergency shell was give as an option. This also made the array out-of-sync and so I rebooted to the Live CD, sync'ed the drives with the procedure described above, and ran an e2fsck on them.
Code:
e2fsck /dev/sda1
e2fsck /dev/sdb3
e2fsck /dev/sdb1
e2fsck /dev/sdb3
None of this worked and I still get the message. Can anyone help? I do not have a backup drive to store all of the data or I would simply re-install Linux with the RAID1 already in place. Any ideas? THANKS!
 
Old 08-05-2005, 11:42 AM   #2
johnwyles
LQ Newbie
 
Registered: May 2005
Location: Austin, TX
Distribution: Gentoo
Posts: 7

Original Poster
Rep: Reputation: 0
FIXED!

I resolved this issue by running the following commands from the Live CD:

Code:
e2fsck -cc /dev/md2
Answered "Yes" to nearly everything and erased any files that contained bad blocks (only one in my case). This took over 10 hours to complete!!!
Code:
e2fsck -cc /dev/md0
This was to correct sizing issues that apparently also appeared with my /boot partition.

Code:
resize2fs /dev/md2
resize2fs /dev/md0
This did not take long at all and properly resized the partitions and resolved my issues.

If anyone would like to do this then the procedure I have outlined should work and has now been verified by me! GOOD LUCK (You will need it)!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I add a spare to existing software RAID 5 ? philforrest Linux - Software 1 12-28-2003 09:33 PM
New Software Raid - Want to use as existing /home/ ... Migration??? How??? trekk Linux - Software 5 11-03-2003 10:32 AM
add software raid-1 to existing system hoover93 Linux - Hardware 1 10-07-2003 10:52 AM
Adding ide drive to existing raid 5 help koj333 Linux - Hardware 3 09-28-2003 12:28 PM
Software RAID 1 setup w/ existing ext2fs partition system Linux - General 3 01-26-2002 11:07 PM


All times are GMT -5. The time now is 08:01 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration