Need some help with mdadm RAID 1

Questions about applications and software
Forum rules
Before you post please read how to get help
Post Reply
anarchitektur
Level 1
Level 1
Posts: 15
Joined: Tue Mar 10, 2009 11:09 am

Need some help with mdadm RAID 1

Post by anarchitektur »

My computer was running 32 bit Mint 7, and I had used mdadm to set up a RAID 1 array. The OS was installed on a third disk that wasn't part of the RAID. Anyway, I added some additional RAM, bringing the total to 8 GB, and I wanted to be able to actually use all of that RAM, so I wiped the system disk to install Mint 8 x64.

I was lead to believe that the system would auto-detect that these two disks are a mdadm-configured RAID and would be able to mount them, but unfortunately that doesn't seem to be the case. Since I'm a bit of a newbie, I was hoping one of you fine gentlemen (or even a lady, I'm not picky) could help me understand what steps I need to take to get this RAID 1 usable again without wiping the disks and starting over... there's approximately 600GB of data that I'd really rather not lose.

User avatar
RedWagon
Level 5
Level 5
Posts: 632
Joined: Tue May 26, 2009 6:41 pm

Re: Need some help with mdadm RAID 1

Post by RedWagon »

Whenever you create a raid array in mdadm it builds everything without destroying any data. You can delete and recreate the array (through mdadm) as many times as you want and as long as you don't format the drives you shouldn't loose anything.
Once I accidentally messed up the creation of a 500GB RAID 5 array; I only built it with two disks. After an hour of moving my data around the resulting array was only 250GB and I couldn't access any of my data. I deleted the array and recreated it with all three disks and after two of the most nerve wracking hours of my life I had all my data back. So basically mdadm is pretty robust, I would just follow the same steps you did when you created the array in the first place (except for partitioning and formatting your drives.) If you want, paste them here and I can tell you which ones you need to run.

anarchitektur
Level 1
Level 1
Posts: 15
Joined: Tue Mar 10, 2009 11:09 am

Re: Need some help with mdadm RAID 1

Post by anarchitektur »

Thanks for that info. I tried to rebuild, but here's what happened:

I said sudo mdadm --create /dev/md0 --level=mirror --raid-devices=2 /dev/sdb /dev/sdc

In return, I got:

mdadm: Cannot open /dev/sdb: Device or resource busy
mdadm: Cannot open /dev/sdc: Device or resource busy
mdadm: create aborted

When I look in the "Disk Manager" GUI utility in Administration, it detects the disks and even the fact that they are supposed to be in a RAID. Its "state" is given as "Not running, partially assembled"

User avatar
RedWagon
Level 5
Level 5
Posts: 632
Joined: Tue May 26, 2009 6:41 pm

Re: Need some help with mdadm RAID 1

Post by RedWagon »

I've had that happen before; post the output from:

Code: Select all

cat /proc/mdstat

anarchitektur
Level 1
Level 1
Posts: 15
Joined: Tue Mar 10, 2009 11:09 am

Re: Need some help with mdadm RAID 1

Post by anarchitektur »

Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]
md0 : inactive dm-0[1](S)
625131776 blocks

unused devices: <none>

User avatar
RedWagon
Level 5
Level 5
Posts: 632
Joined: Tue May 26, 2009 6:41 pm

Re: Need some help with mdadm RAID 1

Post by RedWagon »

Run

Code: Select all

sudo mdadm --stop /dev/md0
and then try your create command.

anarchitektur
Level 1
Level 1
Posts: 15
Joined: Tue Mar 10, 2009 11:09 am

Re: Need some help with mdadm RAID 1

Post by anarchitektur »

It says it was stopped successfully, but when I try the create command, I get the same response:


mdadm: Cannot open /dev/sdb: Device or resource busy
mdadm: Cannot open /dev/sdc: Device or resource busy
mdadm: create aborted


I tried fiddling with the "assemble" option instead of create, but I didn't have any luck with that either.

anarchitektur
Level 1
Level 1
Posts: 15
Joined: Tue Mar 10, 2009 11:09 am

Re: Need some help with mdadm RAID 1

Post by anarchitektur »

Well, I've made some progress at least. I got the RAID to start and mount, so the files are accessable... but only one of the drives is active. It claims that there is no superblock information on /dev/sdb. I'm not sure how that could happen, or what I should do to get the mirror disk online.

User avatar
RedWagon
Level 5
Level 5
Posts: 632
Joined: Tue May 26, 2009 6:41 pm

Re: Need some help with mdadm RAID 1

Post by RedWagon »

Unfortunately I'm not that knowledgeable about mdadm, I just know how to use it with a working array. I had a similar problem with a Raid 5 array that I never figured out, I finally gave up and just patched the problem with a startup script and called it close enough.
The only other thing I know to try is

Code: Select all

cat /proc/mdstat
to see what arrays you have created then run

Code: Select all

sudo mdadm --stop /dev/mdX
sudo mdadm --remove /dev/mdX
for every array then just recreate them with a mdadm --create command. After that, Google. :?

anarchitektur
Level 1
Level 1
Posts: 15
Joined: Tue Mar 10, 2009 11:09 am

Re: Need some help with mdadm RAID 1

Post by anarchitektur »

I figured out why I kept getting the "Device or resource busy" message... it was because dmraid was taking control of the disks to create a RAID. I didn't even know dmraid was installed, but sure enough, after I removed it, everything else has been smooth sailing.

So, my advice to anyone who might happen to read this in the future: if you are having some inexplicable problems restoring your RAID, make sure dmraid isn't hijacking your disks. I just flat out uninstalled it.

Post Reply

Return to “Software & Applications”