Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. 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>

EDIT: Please not the output of mount. It appears to show md0 is mounted in /, but why isn't it showing up in proc/mdstat?

/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)

cat /proc/mounts 
rootfs / rootfs rw 0 0
none /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0
none /proc proc rw,nosuid,nodev,noexec,relatime 0 0
none /dev devtmpfs rw,relatime,size=4143896k,nr_inodes=204530,mode=755 0 0
none /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0
/dev/sda1 / ext3 rw,relatime,errors=remount-ro,data=ordered 0 0
tmpfs /lib/init/rw tmpfs rw,nosuid,relatime,mode=755 0 0
tmpfs /dev/shm tmpfs rw,nosuid,nodev,relatime 0 0

file -s /dev/sda*
/dev/sda:  x86 boot sector; GRand Unified Bootloader, stage1 version 0x3, stage2 address 0x2000, stage2 segment 0x200; partition 1: ID=0xfd, active, starthead 1, startsector 63, 482978097 sectors; partition 2: ID=0x5, starthead 254, startsector 482978160, 5301450 sectors, code offset 0x48, OEM-ID "      м", Bytes/sector 190, sectors/cluster 124, reserved sectors 191, FATs 6, root entries 185, sectors 64514 (volumes <=32 MB) , Media descriptor 0xf3, sectors/FAT 20644, heads 6, hidden sectors 309755, sectors 2147991229 (volumes > 32 MB) , physical drive 0x7e, dos < 4.0 BootSector (0x0)
/dev/sda1: Linux rev 1.0 ext3 filesystem data, UUID=38daaa54-a108-4224-9104-016d5b4ee12c (needs journal recovery) (large files)
/dev/sda2: x86 boot sector; partition 1: ID=0xfd, starthead 254, startsector 63, 5301387 sectors, extended partition table (last)\011, code offset 0x0
/dev/sda5: Linux/i386 swap file (new style), version 1 (4K pages), size 662655 pages, no label, UUID=f635267e-37f8-43d0-ad01-d25969570a8f

MORE INFORMATION: My working RAID array had md0 and md1 with drives sdb and sdc. I ran those grub-install commands. A few days later, I tried to reboot it and I was getting the following error (which I think corresponds to md0)

Gave up waiting for boot device
ALERT /dev/disk/by-uuid/38[...] does not exist

so I unplugged my 2nd and 3rd HD and GRUB couldn't boot when set to md0 so I set it to dev/sda1 and that's the state my machine is currently in.

mdadm --assemble --scan -v -v
mdadm: looking for devices for /dev/md0
mdadm: /dev/sda5 has wrong uuid.
mdadm: no recogniseable superblock on /dev/sda2
mdadm: /dev/sda2 has wrong uuid.
mdadm: cannot open device /dev/sda1: Device or resource busy
mdadm: /dev/sda1 has wrong uuid.
mdadm: cannot open device /dev/sda: Device or resource busy
mdadm: /dev/sda has wrong uuid.
mdadm: looking for devices for /dev/md1
mdadm: /dev/sda5 requires wrong number of drives.
mdadm: no recogniseable superblock on /dev/sda2
mdadm: /dev/sda2 has wrong uuid.
mdadm: cannot open device /dev/sda1: Device or resource busy
mdadm: /dev/sda1 has wrong uuid.
mdadm: cannot open device /dev/sda: Device or resource busy
mdadm: /dev/sda has wrong uuid.

 sfdisk -d /dev/sda
# partition table of /dev/sda
unit: sectors

/dev/sda1 : start=       63, size=482978097, Id=fd, bootable
/dev/sda2 : start=482978160, size=  5301450, Id= 5
/dev/sda3 : start=        0, size=        0, Id= 0
/dev/sda4 : start=        0, size=        0, Id= 0
/dev/sda5 : start=482978223, size=  5301387, Id=fd
share|improve this question
Please clarify, do you have data on these arrays that you're trying to save? Or are you trying to wipe & start over? –  derobert Jul 24 '13 at 14:13
@derobert Yes there is data on sda. I am trying to be able to not wipe it. I just want to set up my arrays as they were before with md1 : active raid1 sda5[0] sdb5[1]; md0 : active raid1 sda1[0] sdb1[1]. (sdb is unplugged for now). –  jp24 Jul 24 '13 at 16:01
@derobert Please see the output of mount at the end of the question. It may provide some more insight. –  jp24 Jul 24 '13 at 16:03
What happens if you try mdadm --assemble --scan -v -v ? –  derobert Jul 24 '13 at 18:09
I think it is highly unlikely that grub-install /dev/sdb has broken your array. Also, check fdisk -u=sectors -l /dev/sda or sfdisk -d /dev/sda (that -d is important!), does it start at 63? Even if it broke sdb, sda should be fine. (Also: please stop playing with --create, that is a last resort! It is far too easy to lose your data with create, or at least make recovery much harder) –  derobert Jul 24 '13 at 18:16

2 Answers 2

up vote 1 down vote accepted

/dev/sda1 is mounted. You won't be able to do anything while it's mounted. Reboot to a live CD.

You can create a RAID1 volume from an existing filesystem without losing the data. It has to use the 0.9 or 1.0 superblock format, as the default 1.2 format needs to place the superblock near the beginning of the device, so the filesystem can't start at the same location. See How to set up disk mirroring (RAID-1) for a full walkthrough.

You'll need to ensure that there is enough room for the superblock at the end of the device. The superblock is in the last 64kB-aligned 64kB of the device, so depending on the device size it may be anywhere from 64kB to 128kB before the end of the device. Run tune2fs -l /dev/sda1 and multiply the “Block count” value by the “Block size” value to get the filesystem size in bytes. The size of the block device is 241489048½ kB, so you need to get the filesystem down to at most 241488960 kB. If it is larger than that, run resize2fs /dev/sda1 241488960K before you run mdadm --create.

One the filesystem is short enough, you can create the RAID1 device, with a suitable metadata format.

mdadm --create /dev/md0 --level=1 --raid-devices=2 --metadata=1.0 /dev/sda1 missing
share|improve this answer
So you think the mdadm: device /dev/sda1 not suitable for any style of array error is simply due to the drive being mounted, not some lingering weirdness in my previous RAID configuration? –  jp24 Jul 25 '13 at 2:22
When I run df -kh, I find /dev/md0 mounted on /. Do you think this is stale info as well? Do you have any insight into why md0 is hanging around but not visible in proc/mdstat? And by having stale info in fstab, that can persist after a reboot? Thank you. –  jp24 Jul 25 '13 at 2:24
When I ran the LiveCD, I could not resize the file system because /dev/sda was busy. However, I wonder since if I previously had RAID on this disk if there is existing room for the superblock at the front of the device. How can I check? –  jp24 Jul 27 '13 at 5:21
@user1850672 /dev/sda doesn't have a filesystem. /dev/sda1 does. Or did the live CD find a RAID volume on /dev/sda1? Or did it mount /dev/sda1? My answer already tells you how to see if there's room for the superblock. –  Gilles Jul 27 '13 at 9:33

You need to fail the device and remove it first before you can add it to another RAID.

$ mdadm /dev/md0 -f /dev/sda1
$ mdadm /dev/md0 -r /dev/sda1

You can also use this command to see the current RAID setup:

$ mdadm --detail /dev/md0
        Version : 0.90
  Creation Time : Wed Dec 16 22:55:51 2009
     Raid Level : raid1
     Array Size : 2930266432 (2794.52 GiB 3000.59 GB)
  Used Dev Size : -1
   Raid Devices : 2
  Total Devices : 2
Preferred Minor : 0
    Persistence : Superblock is persistent

    Update Time : Wed Jul 24 02:05:22 2013
          State : clean
 Active Devices : 2
Working Devices : 2
 Failed Devices : 0
  Spare Devices : 0

           UUID : 2d2c47de:dd4d678f:6a89fc71:2e8f3e64
         Events : 0.23916

    Number   Major   Minor   RaidDevice State
       0       8       33        0      active sync   /dev/sdc1
       1       8       17        1      active sync   /dev/sdb1
share|improve this answer
My RAID isn't even acknowledging md0 exists: # mdadm --detail /dev/md0 mdadm: cannot open /dev/md0: No such file or directory –  jp24 Jul 24 '13 at 6:10
Do you know if zero-ing my superblock is what I should be looking into so that I can add the drive to a RAID? Does the fact that it is listed as System:Linux raid autodetect mean anything? –  jp24 Jul 24 '13 at 6:14
@user1850672 - that just identifies the partition as being usable in a RAID. You can use fdisk to delete the partitions on that disk and then recreate them. –  slm Jul 24 '13 at 6:50

Your Answer


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.