# /dev/mdctl & deleting md



## Anonymous (Dec 7, 2009)

I created a swap space using the following commands

```
# dd if=/dev/zero of=/swap0 bs=1024k count=256
# chown root:wheel /swap0
# chmod 0600 /swap0
```
Then I added the following swapfile variable in the /etc/rc.conf file to enable swap file on boot time:
swapfile="/swap0"

```
# mdconfig -a -t vnode -f /swap0
# swapon /dev/md1
```
And then I rebooted, now I would like to remove the swap space using the command:

```
mdconfig -d -u 0
```
and I get the following message:

```
mdconfig: ioctl(/dev/mdctl): Device busy
```
I know that the swapspace is not being used so I was wondering first of all what the problem is and secondly I was curious about what the /dev/mdctl file is used for.


----------



## SirDice (Dec 7, 2009)

If you look at the output of swapinfo you will see it's in use. Use swapoff to remove the file from the swap. Then you can remove the md device.


----------



## Anonymous (Dec 7, 2009)

swapoff worked perfectly, thanks


----------

