Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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
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:
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
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.