how are you supposed to nuke a mdadm array?

Rifter

Lifer
Oct 9, 1999
11,522
751
126
Hello all, I'll start by saying im a IDIOT. And i dont think the below method was the right way to do it.

Now that thats out of the way here is the issues.

So i have a server running ubuntu 10.04LTS 64bit. Had 3 x 1.5TB drives in RAID 5 using mdadm. Im adding 2 2TB drives and removing one of the 1.5TB drives so need to kill the array first as i will not be using raid any longer but full backups to external drives.

So i go to kill the array, thought it would be easy. So i try and use mdadm to stop the array and cant get it to do anything, wont let me stop it, wont let me zero the superblocks nothing. Ok so i figure it might be because the array is mounted but i unmount it and the same thing. Fail all the drives same thing, says cant open drive to write when i try and fill the superblocks. I was using the "sudo mdadm --zero-superblock /dev/sdx" command after the drives were unmounted and failed, where "x" was the drive in the raid array i was trying to kill, tried it on all 3 drives same thing.

So i boot to a live cd, try to zero the superblocks again after installing mdadm and it gives me a drive is not part of an array error. Whatever im getting pissed and im in nuke from orbit mode now so i use:

dd if=/dev/random of=/dev/sdb
dd if=/dev/random of=/dev/sdc
dd if=/dev/random of=/dev/sdd

To random zero/1 fill the three raid drives, or at least i thought thats what i was doing. So after 2 days of waiting for the damn drives to random fill apparently the live CD decided to name my drives different letters than my ubuntu install so i really random filled my main fileysytem drive and its backup drive and only one drive from the array :(

So now having nuked my whole server im pissed off, obviously i should have kept a backup image of the boot drive not attached to that system but ill never make that mistake again.

But then im like whatever i can start over, no way that raid array will be alive after nuking one drive and removing another leaving it with only one reaming in the system with any data at all on it. So i guess i succeded!

Yeah not so much, so i boot up a live CD after installing the 2 2TB drives and removing 1 1.5TB drive. Leaving the system with:

500GB Boot drive(nuked this drive)
500GB boot drive backup image(nuked this drive)
2TB(new)
2TB(new)
1.5TB(former raid 5, nuked this one)
1.5TB(former raid 5, not nuked, not touched)

When i try and format the former raid drive that i didnt touch i get a error, both in gparted and from the command line. Just wont let me format it and still thinks its a god damn raid array! So i had to wait 8+ hours for it to zero/1 fill as well. Finally after all that i was able to format it! and am now re installing ubuntu.

So just out of curiosity how the hell are supposed to get the --zero-superblock command to work so i know for next time and dont need to nuke my whole system, as much fun as that was. Obviously stopping and failing the drives in the array and then running sudo mdadm --zero-superblock /dev/sdx is not the correct way to do it even though all the help pages i tried said it was.
 

joetekubi

Member
Nov 6, 2009
176
0
71
Dude, don't blow a gasket. There are little creatures inside our computers that love to mess with our heads sometimes.
First, try "mdadm --stop" to disable the array. Then you should be able to do anything you want to the individual disks. (Like fdisk /dev/sda , and blow away the partition - the partition type is marked somewhere in the master partition table, so zeroing the superblock doesn't touch it) One problem you may be having that's not obvious, is that raid functionality is added to "initramfs" automatically, and you may need to blow that away. (Little involved, sorry no link at this time).
If you still have problems, post here, and we'll try to help....
 

Rifter

Lifer
Oct 9, 1999
11,522
751
126
Its to late, its all setup again now. I just cant believe how hard it is to actually kill a linux raid array.
 

joetekubi

Member
Nov 6, 2009
176
0
71
if you have a hard time reading and understanding "man" pages, google is your friend.
 

Rifter

Lifer
Oct 9, 1999
11,522
751
126
I think most people would consider that a good thing =)

well thats true, except when you are trying to kill it. I was literally pulling my hair out, it was stopped, drives failed, and still wouldnt let me zero the superblock, kept saying couldnt open drive to write :(

On the bright side i had all the config files on a USB thumb drive so setting up everything again was not so hard and it gave me the advantage of upgrading to ubuntu 10.04 from 8.04.