/etc/rc.d/mdconfig2

From: Vincent Blondel <vincent_at_xtra-net.org>
Date: Mon, 18 Dec 2006 21:11:06 +0100
Hello all,

I discovered yesterday the existence of /etc/rc.d/mdconfig2. I am trying
to use this script to automate the creation of a vnode disk at system
boot but I encounter some problems.

First of all I created a simple test vnode disk like this ...

dd if=/dev/zero of=/var/squid/cache0 bs=1k count=512k
mdconfig -a -t vnode -f /var/squid/cache0 -u 0
bsdlabel -w md0 auto
newfs md0c
mount /dev/md0c /mnt

This is working perfectly. I can attach/detach the memory disk,
mount/unmount this vnode device with no problem.

But when I try to automate this procedure, I get some problems. So I
first added these two lines in /etc/rc.conf.

mdconfig_md0="-t vnode -f /var/squid/cache0"
mdconfig_md0_cmd="mount \${_dev} /mnt"

First part happens correctly and I get my device mounted as /dev/md0 but
due the fact the device is labeled, I also get /dev/md0a and /dev/md0c
and this occurs a problem. When debugging the script you can see the
script is trying to make an fsck on /dev/md0 and not /dev/md0c.

+ mdconfig -l -u md0
+ echo Creating md0 device (vnode).
Creating md0 device (vnode).
+ mdconfig -a -t vnode -f /var/squid/cache0 -u md0
+ [ /var/squid/cache0 != /var/squid/cache0 ]
+ checkyesno background_fsck
+ eval _value=$background_fsck
+ _value=YES
+ debug checkyesno: background_fsck is set to YES.
+ return 0
+ _fsck_cmd=fsck -F
+ eval fsck -F -p /dev/md0
+ fsck -F -p /dev/md0
fsck: Could not determine filesystem type
+ echo Fsck failed on /dev/md0, not mounting the filesystem.
Fsck failed on /dev/md0, not mounting the filesystem.
+ continue
+ _return=0
+ [ 0 -ne 0 ]
+ [ -n  ]
+ return 0

So, is really mdconfig_mdX_cmd the right way to mount this vnode device
or is there another way to do it ?

Vincent.
Received on Mon Dec 18 2006 - 19:39:03 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:04 UTC