Disk is apparently in use by the system

I've just fitted two disks to my home server. I'm trying to format and then raid them but I'm getting a problem that hours of Googling hasn't resolved this.

The error that I'm getting is:

# mkfs.ext3 /dev/sdb1
  mke2fs 1.39 (29-May-2006)
  /dev/sdb1 is apparently in use by the system; will not make a filesystem here!

# df -h
  Filesystem            Size  Used Avail Use% Mounted on
  /dev/sda1             4.0G  1.9G  2.0G  49% /
  none                  380M     0  380M   0% /dev/shm
  /opt/xensource/packages/iso/XenCenter.iso
                        51M   51M     0 100% /var/xen/xc-install

# mount -t ext3 /dev/sdb1 /mnt/b
  mount: /dev/sdb1 already mounted or /mnt/b busy

I'm new to this and it's got me beat. I wouldn't ask if I hadn't done my research first. Thanks.

# mount
  /dev/sda1 on / type ext3 (rw)
  none on /proc type proc (rw)
  none on /sys type sysfs (rw)
  none on /dev/pts type devpts (rw)
  none on /dev/shm type tmpfs (rw)
  /opt/xensource/packages/iso/XenCenter.iso on /var/xen/xc-install type iso9660 (ro,loop=/dev/loop0)
  none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
  sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)

# mdadm --create --verbose /dev/md0 --level=0 --raid-devices=2 /dev/sdb1 /dev/sdc1
  mdadm: chunk size defaults to 64K
  mdadm: Cannot open /dev/sdb1: Device or resource busy
  mdadm: /dev/sdc1 appears to contain an ext2fs file system
    size=976760000K  mtime=Tue Jul 10 21:52:00 2012
  mdadm: create aborted

# cat /proc/swaps
  Filename              Type        Size    Used    Priority
  /var/swap/swap.001                      file      524280  0   -1

Solution 1:

I've run

# dmsetup remove /dev/mapper/[device]

and that has let me run

# mdadm --create --verbose /dev/md0 --level=1 --raid-devices=2 /dev/sdb /dev/sdcmdadm: size set to 976762496K
  mdadm: array /dev/md0 started.

Then I've run

# mkfs.ext3 /dev/md0

Which again has worked as expected.

Solution 2:

What type of RAID are you using (LVM, md, Hardware...)? Typically you need to build the RAID prior to actually formatting.

Additionally as @tom-oconnor and @alex mentioned output would be appreciated