mdadm: device is too small: 0K

mdadm: /dev/sda3 is too small: 0K
mdadm: create aborted

Check that the /dev/sda3 special file is actually correct. If you inadvertantly screw up your mdadm command (eg giving /dev/sda3 as the first non-option argument), then mdadm will quite happily replace your /dev/sda3 special with an md special:

# ls -ld /dev/sda*
brw-rw---- 1 root disk 8, 0 2009-05-05 18:20 /dev/sda
brw-rw---- 1 root disk 8, 1 2009-05-05 19:14 /dev/sda1
brw-rw---- 1 root disk 8, 2 2009-05-05 19:19 /dev/sda2
brw-r--r-- 1 root root 9, 0 2009-05-05 20:06 /dev/sda3

To fix (obviously replacing "sda3" with whatever device you are actually having problems with):

# rm /dev/sda3
# mknod /dev/sda3 b 8 3

Migrating an existing partition to raid1

You can create a raid1 that is initially degraded; once all the data is on it and you are running from that, then you can add more devices to the raid1 and it will "rebuild" it in the background.


# mdadm --create /dev/md0 --raid-devices=2 --level=raid1 /dev/sdb1 missing

  size=296696452K  mtime=Tue May  5 19:29:00 2009
  mdadm: array /dev/md0 started.
# ( /dev/md0)
# (mount and cp stuff from sda1 to /dev/md0)
# ... (once sda1 is no longer in use, and the same size)
# mdadm --add /dev/md0 /dev/sda1