Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I previously had a working RAID 1 array. I think as a result of running grub-install /dev/sdb and grub-install /dev/sdc I somehow wiped my computer of md0 and md1.

I need to set them up again. When I try to create the md0 array, I am getting the following error.

/dev# mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sda1 missing -f
mdadm: device /dev/sda1 not suitable for any style of array

It seems like Debian thinks the drive is already in an array but it's not.

# fdisk -l

Disk /dev/sda: 250.0 GB, 250000000000 bytes
255 heads, 63 sectors/track, 30394 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000080

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1       30064   241489048+  fd  Linux raid autodetect
/dev/sda2           30065       30394     2650725    5  Extended
/dev/sda5           30065       30394     2650693+  fd  Linux raid autodetect

# cat /proc/mdstat 
Personalities : [raid1] 
unused devices: <none>

# mount
/dev/md0 on / type ext3 (rw,errors=remount-ro)
tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
udev on /dev type tmpfs (rw,mode=0755)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=620)
share|improve this question
    
Is there any data on /dev/sda? –  ALex_hha Jul 24 '13 at 5:22
    
@ALex_hha Yes, all the data on my system is on /dev/sda –  jp24 Jul 24 '13 at 5:25
    
Did both /dev/md0 or /dev/md1 contain actual file systems, or was either used as backing store for LVM volume storage? –  MadHatter Jul 24 '13 at 5:42
    
Could you show output of the "cat /proc/mdstat" ? –  ALex_hha Jul 24 '13 at 5:47
    
@ALex_hha See the bottom of the post. It is not even acknowledging md0 and md1 as it used to. –  jp24 Jul 24 '13 at 6:11

2 Answers 2

Given that /dev/md0 is mounted on /, I'd say it's quite alive and well. If no such device file exists, take a look at dmesg to determine why. Perhaps look at your udev configuration as well.

It isn't immediately clear what you are trying to accomplish by directing mdadm to instantiate a RAID1 array with only one device when that array is already created and mounted (likely it was created by the kernel's RAID autodetect). It is no surprise at all that it won't allow you to do this.

If /dev/md1 doesn't exist, you could probably create that using mdadm (assumedly out of /dev/sda5 and something else).

You should avoid manipulating the root partition with mdadm at runtime. If it isn't kernel autodetection that is creating it, it should be an initrd, and that is where mdadm should be doing its thing if required.

share|improve this answer
    
If md0 is alive, why doesn't it show up in /proc/mdstat? My system refused to boot earlier because it couldn't find the root device in the usual md0, didn't exist or something. (so then I set GRUB to boot from sda1.) I am just trying to get my RAID 1 set up back to the way it was. It was: md1 : active raid1 sda5[0] sdb5[1]; md0 : active raid1 sda1[0] sdb1[1]. (sdb is unplugged for now). Can you give me some advice on how to do this? Is it possible for me to plug in sdb and add it to md0? I really appreciate your help. –  jp24 Jul 24 '13 at 6:56
    
When I execute mdadm --create /dev/md1 --level=1 --raid-devices=2 /dev/sda5 missing I get mdadm: /dev/sda5 appears to be part of a raid array: level=raid1 devices=3 ctime=Wed Jun 16 00:01:41 2010. This means md1 is out there as well, I just don't understand why it is not showing up in my /proc/mdstat. –  jp24 Jul 24 '13 at 7:05

Once things get this upset, I personally would mount each of the raw partitions as a read-only file system (eg, mount -r /dev/sda1 /mnt), dump the contents to tape / external drive / wherever you have space, recreate the arrays from scratch, and restore the data.

share|improve this answer
    
Would you say it is sufficient to simply rsync everything in /? (Sorry I'm new to this.) –  jp24 Jul 24 '13 at 6:20
    
rsync everything in / to where? –  MadHatter Jul 24 '13 at 6:21
    
Also would "zeroing the superblock" be something of use? I feel like that because the System is listed as Linux raid autodetect I cannot readd them to the array. Also how do you propose I recreate the array from scratch such that sda isn't rejected? –  jp24 Jul 24 '13 at 6:22
    
rsync everything in / to a backup drive. I'm just wondering if that will "keep everything" so that I can simply restore it. –  jp24 Jul 24 '13 at 6:22
1  
Don't zero the superblock unless you intend to wipe the drive. –  Falcon Momot Jul 24 '13 at 6:40

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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