I accidentally opened my 1 disk raid1 as raid0 with mdadm --create, and this looks like it overwrote the default raid meta info, and makes my device detected as raid0 with mdadm --assemble --scan. For obvious reasons I can't see my partition currently, so I'm sure I didn't write anything to the partition.

Is there a safe way to get that 1 disk raid1 back without losing data on my disk?

Many thanks, Clooney


Thanks for the quick replies. I may have not been specific enough, let me fix that.

Scenario: - I have a raid1 where sda1 and sdb1 are in /dev/md0, operating fine. - My sdb starts failing, so I remove sdb and take it back to get my warranty in place. - I boot from my rescure CD which confuses my drives order: I have 2 sata ports on my mb and 4 other sata ports on a Sil SATA card, i.e. the difference when loaded as a kernel module vs compiled into the kernel can cause such things - so after all i make the mistake to say mdadm --create /dev/md1 --level=0 --raid-devices=1 /dev/sda1 -f and have my md1 created I figure the mixup.

I did not wipe the partition containing my raid1 data. I did not create a new filesystem (as I realized hopefully on time).

However I noticed that mdadm metadata may have been changed to v1.2 - which I believe means nothing else but it's kept elsewhere - making me also think that the previous raid meta info should be still available.

So the real questions behind this are: What does mdadm --create do exactly? Would mdadm --create /dev/md0 --level=0 on the same partition solve this or would it result in an even bigger trouble? Can I, and if so how, find the previous meta data (which I didn't see any indication of getting deleted/wiped/etc) and use it to reconstruct my faulty /dev/md0?


First of all, I recommend that you create another copy of your HD drives. This is necessary to avoid data loss in case you made a mistake while trying to fix your raid.

You can use the following command to create the raid1 array:

$ sudo mdadm --create /dev/md1 --level=1 --raid-devices=2 /dev/sda1 /dev/sdb1

Of course, you can customize the above command according to your needs.

You can check the raid status using: cat /proc/mdstat.

You can also check the man mdadm for more help.


I'm guessing you have a method of backing up the system if you plan to use RAID1, to I won't go into that.

You can't simply change from RAID0 to 1. You would have to create a new array, which would wipe out all data on the drives. You could make a backup, create a RAID1 array, then restore your backup onto the new array.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.