Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
                        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
share|improve this question

migrated from Jul 11 '12 at 6:51

This question came from our site for system and network administrators.

Please add output of mount w/o parameters – Alex Jul 10 '12 at 21:27
Also add the output of lsof|grep "/mnt/b" – Tom O'Connor Jul 10 '12 at 21:29
Why are you trying to format, and then raid? Normally you setup the partition/raid/volume and then the filesystem. – Zoredache Jul 10 '12 at 21:39
@Alex I've added the mount w/o params. – Shaun Jul 10 '12 at 22:00
@Shaun Please also add output of cat /proc/swaps, I bet /dev/sdb1 is a swap partition. – Alex Jul 10 '12 at 22:06
up vote 8 down vote accepted

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.

Thank you sooo much everyone. I can go to work happy :-)

share|improve this answer

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

share|improve this answer
I've updated to show those outputs. I'm new to this and I'm trying to feel my way around. I've also added the output when I tried to create the raid. – Shaun Jul 10 '12 at 22:04
Ok, so you need to clear the partition from sdb and sdc using parted or fdisk. Once that is done you should be clear to build the RAID – iambryan Jul 10 '12 at 22:11
thanks. I've cleared the partitions but I still get this error: "mdadm --create --verbose /dev/md0 --level=0 --raid-devices=2 /dev/sdb /dev/sdc mdadm: chunk size defaults to 64K mdadm: Cannot open /dev/sdb: Device or resource busy mdadm: create aborted" – Shaun Jul 11 '12 at 6:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .