mdadm trouble & resetting a partition as ext3 instead of raid
Linux - SoftwareThis 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
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 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
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.
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!
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:
Upgrade Jaunty to Karmic manually.
Back up everything from sda2 (Ubuntu /) and sda6 (Ubuntu /home) on a third disk (my external TB).
Wipe both disks that I will use for RAID1 (which will then be sda and sdb).
Install Ubuntu Karmic from scratch and set up RAID1 from the installer.
Boot to live CD and copy back the / and /home data to both MD disks from my external.
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!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.