LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 07-20-2008, 11:00 PM   #1
ewolf
LQ Newbie
 
Registered: Dec 2007
Location: Chicago, USA
Distribution: Debian, NetBSD
Posts: 25

Rep: Reputation: 15
Question RAID1 rebuilt after failure, won't boot OS


Hello,

I recently had a small typo in my 'dd' command's of= parameter, which destroyed the first few kibibytes of data on my software RAID1's first disk, /dev/sda (I'm using mdadm).

/dev/sdb, the RAID1's second disk, was unaffected.

I figured that I could just manually 'fail' sda to take it out of the array. I would then copy the partition table of sdb to sda, re-add sda to the array, then let sda sync up to sdb. I did this, but after synchronization completed, I tried rebooting from sda (what my system had previously been booting from), but this time the console displayed "Operating System not Installed" or some similar message.

I then tried booting from sdb, but that would just hang, with nothing on the console. I had never tried booting from sdb before, so I think it was ver likely that way before my mishap with dd, since I didn't make changes to sdb.

Anyways, as far as my logic dictates, this should have worked, with sda booting up flawlessly and everything being back to normal. However, this is obviously not the case. Can anyone think of a step I may have missed? Do I need to reinstall grub on sda? What else could it be?

Thanks,
Elijah

Last edited by ewolf; 07-20-2008 at 11:02 PM. Reason: grammar
 
Old 07-21-2008, 07:40 AM   #2
archtoad6
Senior Member
 
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
Blog Entries: 15

Rep: Reputation: 234Reputation: 234Reputation: 234
1st, have you verified that the synchronization worked, that the RAID is re-built & readable? Can you access your data from a live CD?

If so, then I think you are right -- you need to re-install GRUB. This time put it in the MBR of both drives.

BTW, what command did you use to "copy the partition table of sdb to sda"? Was it something like:
Code:
dd if=/dev/sdb of=/dev/sda size=512 count=1
That would have copied the boot loader code as well as the partition table. Better to have used:
Code:
dd if=/dev/sdb of=/dev/sda skip=446 seek=446 size=64 count=1
See:
http://en.wikipedia.org/wiki/Master_boot_record
 
Old 07-21-2008, 09:10 AM   #3
ewolf
LQ Newbie
 
Registered: Dec 2007
Location: Chicago, USA
Distribution: Debian, NetBSD
Posts: 25

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by archtoad6 View Post
1st, have you verified that the synchronization worked, that the RAID is re-built & readable? Can you access your data from a live CD?
checking the status with
Code:
cat /proc/mdstat
showed that the sync had completed, with a 'UU' for all RAID partitions. I did boot up with a live cd, and gparted showed that my partitions were all there on both disks. Would I be able to mount RAID partitions as ext3 without messing up the RAID array?

Quote:
BTW, what command did you use to "copy the partition table of sdb to sda"? Was it something like:
Code:
dd if=/dev/sdb of=/dev/sda size=512 count=1
That would have copied the boot loader code as well as the partition table. Better to have used:
Code:
dd if=/dev/sdb of=/dev/sda skip=446 seek=446 size=64 count=1
I know what you mean, I've definitely made that mistake in the past, but wasn't sure how to how to use dd for just the partition table or just the mbr. :-)
For the partition table, I used
Code:
sfdisk –d /dev/sdb | sfdisk /dev/sda
I will try reinstalling grub on both disks tonight when I get home. Although, I have never reinstalled or switched bootloaders before, I have only done new installations. Are there any pitfalls to reinstalling the bootloader I need to be aware of? Will a simple
Code:
grub-install /dev/sdX
do the trick?

Thank you very much.

Last edited by ewolf; 07-21-2008 at 09:24 AM. Reason: had some more questions
 
Old 07-21-2008, 04:04 PM   #4
archtoad6
Senior Member
 
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
Blog Entries: 15

Rep: Reputation: 234Reputation: 234Reputation: 234
1) Checking w/ a live CD:

I would think that mounting either disk r/o as ext2/3 couldn't hurt & might give you the verification you need.

I was in fact wondering if you could mount & use the array w/ a live CD.


2) Bootloader reinstallation pitfalls:

I can't be much help here -- I use the MEPIS System Wizard to re-install GRUB. But if the command you propose would work in a non-RAID environment, it should work here.

If you want to dig deeper, post (in a "Code:" block, please) the output of:
Code:
fdisk -l
& explain, at least briefly, the use of each partition.


3) Good use of sfisk -d.
 
Old 07-21-2008, 11:05 PM   #5
ewolf
LQ Newbie
 
Registered: Dec 2007
Location: Chicago, USA
Distribution: Debian, NetBSD
Posts: 25

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by archtoad6 View Post
I was in fact wondering if you could mount &
use the array w/ a live CD.
1) I was able to successfully mount my ext3 RAID partitions in read-only
mode using an ubuntu livecd.

2)
Code:
ubuntu@ubuntu:/mnt3$ sudo fdisk -l /dev/sda

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

  Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          30      240943+  fd  Linux raid autodetect
/dev/sda2              31         358     2634660   fd  Linux raid autodetect
/dev/sda3             359       60801   485508397+  fd  Linux raid
autodetect
fdisk -l /dev/sdb looked exactly the same. sda1 is the /boot
partition, sda2 is a swap partition, and sda3 is the root filesystem.

I installed grub onto both drives, and am now typing from my RAIDed Debian installation. I tested booting from both drives, and all is well.
Thank you very much for your help.
 
  


Reply

Tags
boot, dd, grub, mdadm, partitiontable, raid, raid1, softraid



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
PCLinuxOS 2007: will not boot, says the superblock needs rebuilt. brjoon1021 Linux - Software 2 10-12-2007 05:12 AM
LVM, raid1 and scsi failure Ezplan Linux - Server 1 05-18-2007 01:59 AM
RAID1 LVM disk failure - can't restore ngibsonn Linux - Software 2 03-13-2007 07:49 PM
Kernel Panic when simulating drive failure on software RAID1 DukeLeto Linux - Software 2 02-07-2006 07:35 AM
RAID1 failure - Need advice on ow to recover Ezplan Linux - Hardware 3 01-24-2006 09:10 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 05:08 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration