Mounting vnode backed memory disks at startup

Hoping some people can shed some light on a little problem I have, I'm running 8.1-RELEASE.

I can make and mount vnode backed memory disks using a root shell ok, e.g....

Code:
mdconfig -a -t vnode -f filename -u 5000
disklabel -r -w md5000 auto
newfs md5000
mount /dev/md5000 /home/somedir

(the 5000 for the unit number is because I want the units to match the uid of my users :-)

However, I really want them remounted automatically in case of a reboot so I did the following...

added
Code:
mdconfig_md5000="-a -t vnode -f filename"
etc. lines to /etc/rc.conf
added
Code:
/dev/md5000  /home/somedir ufs rw 0 0
to /etc/fstab

and I reboot, end up in single user mode because FreeBSD barfs on /dev/md5000 and refuses to proceed. So I take out the line in fstab and reboot, all is well but no /dev/md5000 gets created and running /etc/rc.d/mdconfig start and /etc/rc.d/mdconfig2 start don't create them either.

What's the proper process for doing this? Or what have I done wrong or not done?

Obviously I've tried Googling this (for several hours actually) but I can't find anything that exactly answers what I'm trying to do.

Thanks in advance.
 
Probably the md device isn't created until well after everything in /etc/fstab is mounted in the startup; add the late option to the line in /etc/fstab. (Untested.)
 
More info...

Thanks for the response.

I tried late in the fstab but it still failed, just later on in the boot process :-)

Code:
/dev/md5000 /home/devltd.net ufs rw,late 0 0

I noticed I had my virtual disk files symlinked from / in rc.conf so I moved the paths to /usr to avoid any early read only restriction on the root partition during startup to no avail.

Code:
mdconfig_md5000="-a -t vnode -f /usr/local/data/vdisks/devltd.net"

I added ...

Code:
md_load="YES"

...to /boot/loader.conf to no avail.

I tried
Code:
mconfig2_md5000=
in rc.conf to try and force the later rc.d script to create the devices. That was a bit of a wild shot I think and made no difference.

So I changed to ..

Code:
mdconfig_md0="-a -t vnode -f /usr/local/data/vdisks/devltd.net"

..with no fstab entries for now and I can see something about md0 scroll by during boot but I can't capture it :-( I've now got the following in rc.conf

Code:
RC_DEBUG="YES"
RC_INFO="YES"

But it's not in dmesg or /var/log/messages. I'm wondering if the mdconfig scripts in rc.d need the numbering to start at 0 or something but I can't think why this would be necessary. Perhaps a bug?

(Sorry about not using the proper formatting in the original post!)
 
OK, got the output by manually running [CMD=]/etc/rc.d/mdconfig start[/CMD]


Code:
turing# /etc/rc.d/mdconfig start
/etc/rc.d/mdconfig: DEBUG: run_rc_command: start_precmd: [ -n "${_mdconfig_list}" ] 
/etc/rc.d/mdconfig: DEBUG: load_kld: geom_md kernel module already loaded.
/etc/rc.d/mdconfig: DEBUG: run_rc_command: doit: mdconfig_start 
/etc/rc.d/mdconfig: DEBUG: md0 config: -a -t vnode -f /usr/local/data/vdisks/devltd.net
/etc/rc.d/mdconfig: DEBUG: md0 type: vnode
/etc/rc.d/mdconfig: DEBUG: md0 dev: /dev/md0
/etc/rc.d/mdconfig: DEBUG: md0 file: /usr/local/data/vdisks/devltd.net
/etc/rc.d/mdconfig: DEBUG: md0 fs: /usr
/etc/rc.d/mdconfig: DEBUG: md0 newfs flags: 
turing# ls /dev/md0
ls: /dev/md0: No such file or directory
turing# ls /dev/md*
/dev/mdctl

Has anyone any ideas why the device doesn't get created? I'm totally lost now.
 
Solved...

OK, got it...

Don't put -a in the directives in rc.conf (because -a is supplied by default in /etc/rc.d/mdconfig2 and you'll end up passing -a -a to mdconfig) and start the unit numbers at 0.

Don't do this...

Code:
mdconfig_md[color="Red"][B]5000[/B][/color]="[color="red"][B]-a[/B][/color] -t vnode -f /usr/local/data/vdisks/devltd.net"

Do this instead...

Code:
mdconfig_md0="-t vnode -f /usr/local/data/vdisks/devltd.net"

I would probably consider not being able to use otherwise perfectly valid device names as a bug but there you go.
 
Back
Top