LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-20-2009, 12:51 PM   #1
ternarybit
Member
 
Registered: Jun 2009
Distribution: Debian, Arch, Mint
Posts: 51

Rep: Reputation: 15
mdadm Setup & Booting degraded RAID1


I am trying to get a RAID 1 mirror running on my system hard disk. It is partitioned like this:

sda1 - ntfs (Windows & boot)*
sda2 - ext3 (Ubuntu / partition)
sda5 - swap
sda6 - ext3 (Ubuntu /home partition)

I found this article that describes what I want to do. In my ignorance, I assumed that using clonezilla to image my existing disk to the new disk would make things easier, but it didn't.

I booted into Ubuntu and tried to run the 'mdadm --create' command, only to find my sdb2 partition was busy and unusable, so I decided to load my Ubuntu live disc and install mdadm. Another mistake. I created /dev/md0 and /dev/md1 from sda2/sdb2 and sda6/sdb6, which succeeded. However, since mdadm was installed on the live OS, it wouldn't boot to /dev/md0 when I rebooted to the hard disk OS.

I thought I would be "smart" and take a clonezilla image of my entire drive before doing all this, so I would have a "reset button" in case of a problem like this. Well, for reasons I don't understand, restoring the pre-mdadm image does NOT bring me back to a bootable ext3 system partition. Ubuntu still recognizes /dev/sda2 as raid and won't boot it because it can't find the right UUID. I find this annoying and strange, since a clone should restore all that to how it was before, right?

My questions are:

1. how can I reset my sda2 and sda6 to ext3 so I can boot like normal and try again?
2. can someone please explain in fairly n00bish terms how to migrate to raid1 while using existing partitions?**



*I understand that mdadm will NOT mirror ntfs partitions. I don't care, I just want my linux partitions mirrored.
**This question is not nearly as important as question 1. I am confident that with enough keyboard mashing I can figure it out, but if anyone would be so kind, I would greatly appreciate it!

Last edited by ternarybit; 10-29-2009 at 10:31 AM. Reason: Clarify title
 
Old 10-22-2009, 02:29 PM   #2
mostlyharmless
Senior Member
 
Registered: Jan 2008
Distribution: Arch/Manjaro, might try Slackware again
Posts: 1,851
Blog Entries: 14

Rep: Reputation: 284Reputation: 284Reputation: 284
1. As root, fire up fdisk to reset your partition types. It's probably better to use your live CD to do this. Remember that ext3 is the filesystem, not the partition type. ext3 can exist in a RAID partition, and apparently does in your system. Open a terminal first, as I'm assuming you're using a distro with a GUI. It's a very straight forward command line utility. While using fdisk, if I recall correctly, 83 is the Linux partition type (NOT ext3) and fd is the RAID partition type. Clones don't necessarily save everything; really that's a more complicated question at this point that we don't need go into (I hope). You might want to post the output of sudo fdisk -l if you're not sure before doing anything else.

2. You might want to do 1. first. Then I'd recommend creating the RAID (partitioning, making the raid with mdadm, making the filesystem) on your non-booting disk first but make it RAID 1 in degenerate mode, with one disk "missing", then copy everything over everything with rsync from your root partition, then verify you can boot off your new raid by changing grub, then finally add your former boot disk to the existing raid 1 array. More details as needed when you get that far Just like the article you linked to said, sort of.
 
Old 10-23-2009, 11:04 AM   #3
ternarybit
Member
 
Registered: Jun 2009
Distribution: Debian, Arch, Mint
Posts: 51

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by mostlyharmless View Post
1. As root, fire up fdisk to reset your partition types. It's probably better to use your live CD to do this. Remember that ext3 is the filesystem, not the partition type. ext3 can exist in a RAID partition, and apparently does in your system. Open a terminal first, as I'm assuming you're using a distro with a GUI. It's a very straight forward command line utility. While using fdisk, if I recall correctly, 83 is the Linux partition type (NOT ext3) and fd is the RAID partition type. Clones don't necessarily save everything; really that's a more complicated question at this point that we don't need go into (I hope). You might want to post the output of sudo fdisk -l if you're not sure before doing anything else.

2. You might want to do 1. first. Then I'd recommend creating the RAID (partitioning, making the raid with mdadm, making the filesystem) on your non-booting disk first but make it RAID 1 in degenerate mode, with one disk "missing", then copy everything over everything with rsync from your root partition, then verify you can boot off your new raid by changing grub, then finally add your former boot disk to the existing raid 1 array. More details as needed when you get that far Just like the article you linked to said, sort of.
Thank you so much for your response. I did actually find the solution to my non-booting issue. I ran "mdadm --zero-superblock /dev/sdb2" which reset from "mdraid" to "ext" and made it bootable.

I then did what you said. I used fdisk and parted to exactly copy the partition table of my existing drive to the new one. Then I used mdadm to create a degraded raid 1 on that drive. I copied all data to the new drive, but I got stuck when I changed grub. Ubuntu 9.04 uses UUIDs to boot, and even when I changed the booting UUID to /dev/md0 it said that /dev/md0 doesn't exist (even though when booting from my old HDD it does!)

I got stuck and gave up for the time being, but I have a feeling if I knew more about GRUB I could make it work. How can I change grub to boot to the new /dev/md0 degraded array on the new HDD? Do I have to use UUIDs? They are really hard to change from a cli!
 
Old 10-23-2009, 12:56 PM   #4
mostlyharmless
Senior Member
 
Registered: Jan 2008
Distribution: Arch/Manjaro, might try Slackware again
Posts: 1,851
Blog Entries: 14

Rep: Reputation: 284Reputation: 284Reputation: 284
Did you rerun mdadm to remake mdadm.conf? To boot RAID 1, I presume you followed the instructions here:
https://help.ubuntu.com/community/In...esearch=Titles
Unfortunately every distro is pretty different with regards to boot up and RAID. There's a separate link for Intrepid, which I guess has its own problems https://wiki.ubuntu.com/BootDegradedRaid

If that doesn't work, post back with what grub reports when it looks for bootable devices, and the results of fstab -l; the usual

Last edited by mostlyharmless; 10-23-2009 at 12:57 PM.
 
Old 10-29-2009, 10:30 AM   #5
ternarybit
Member
 
Registered: Jun 2009
Distribution: Debian, Arch, Mint
Posts: 51

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by mostlyharmless View Post
Did you rerun mdadm to remake mdadm.conf? To boot RAID 1, I presume you followed the instructions here:
https://help.ubuntu.com/community/In...esearch=Titles
Unfortunately every distro is pretty different with regards to boot up and RAID. There's a separate link for Intrepid, which I guess has its own problems https://wiki.ubuntu.com/BootDegradedRaid

If that doesn't work, post back with what grub reports when it looks for bootable devices, and the results of fstab -l; the usual
As I recall, I did not run mdadm to remake mdadm.conf. I also did not follow those instructions for installing GRUB. I erroneously assumed that changing the UUID of Ubuntu's boot drive from the original partition (sda2) to the RAID array (md0) would allow boot into the degraded array. Apparently it's not that straightforward.

For the moment I have reverted back to my single disk configuration, but I haven't given up. Those links are very helpful, so I may give mdadm another go here when I find a few hours of free time. I may approach this problem from another angle though:
  1. Upgrade Jaunty to Karmic manually.
  2. Back up everything from sda2 (Ubuntu /) and sda6 (Ubuntu /home) on a third disk (my external TB).
  3. Wipe both disks that I will use for RAID1 (which will then be sda and sdb).
  4. Install Ubuntu Karmic from scratch and set up RAID1 from the installer.
  5. Boot to live CD and copy back the / and /home data to both MD disks from my external.
  6. Hope for the best.

My hope is that the installer will autoconfig mdadm properly to boot md0 and (hopefully!) configure it to boot in degraded state. Even if all this doesn't happen automatically, I can go back and customize it myself to do this. I will update the thread with any progress, and thank you once again!
 
  


Reply



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
Software raid & mdadm Braveheart1980 Linux - Software 3 01-04-2009 10:58 AM
MDADM problem: partition lost because of mkfs.ext3 trivet.es Linux - Hardware 2 11-05-2008 07:51 AM
Raid 0 with mdadm,mounted on wrong partition pichici Linux - Newbie 1 11-10-2007 10:29 PM
Trouble writing to a second ext3 partition Tomermory Linux - Hardware 6 05-12-2007 04:22 AM
LVM EXT3 RAID Double Trouble tokehs Fedora 0 04-03-2005 11:37 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:02 AM.

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