tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

mount_vnd ? patch included




Hi,

At ${DAYJOB} we commonly use raw disk images in order to speed up accesses on
NFS large volumes. Under linux, this is achieved by mounting the image as a
loopback device and can be done directly at boot time using the fstab(5):

10.1.2.3:/foo/bar.img /data auto _netdev,noatime,async,loop 0 0

Under NetBSD, we can mount such images using vnconfig(8) and mount(8) but it
can't be done directly from the fstab, or at least I haven't found how. This
small script does the job as long as it is called `mount_vnd' and is placed in
`/sbin' or `/usr/sbin' as shown in `src/sbin/mount/mount.c':

$ cat /sbin/mount_vnd #!/bin/sh

while [ $# -gt 0 ]; do
        case ${1} in
        -o)
                [ "${2}" = "noauto" ] && exit 0
                [ "${2}" = "ro" ] && vnopt="-r"
                shift
                ;;
        /dev/vnd*)
                dev=${1}
                ;;
        *)
                img=${1}
                ;;
        esac
        shift
done

vnconfig ${vnopt} ${dev} ${img}

# end of script

Associated fstab(5) would be:

/foo/bar.img /dev/vnd0d vnd rw 0 0
/dev/vnd0d /data ffs rw,noatime,log 0 0

Could such a script, or probably a more complete one I'd be happy to write, make
its way to /sbin?

FWIW, OpenBSD has mount_vnd, in plain C, that also could be done if preferable.

Thanks,

----------------------------------------------------------------
Emile `iMil' Heitor * <imil@{home.imil.net,NetBSD.org,gcu.info}>
                                                              _
            | http://imil.net        | ASCII ribbon campaign ( )
            | http://www.NetBSD.org  |  - against HTML email  X
            | http://gcu.info        |              & vCards / \



Home | Main Index | Thread Index | Old Index