Current-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
"loopback mount" via vnd feature request
Hi,
NetBSD can do mount regular files just like L*, however,
the way to practice it is awkward. I include my own
(incomplete) shell scripts to ease the daily ISO image
(re-)mounting burden at the bottom.
The issue here is that our vnconfig (vnode-config) is
unable to show off which file is bound with vnd device alive.
The addition of -l option is not optimal since showing inode
number is no better than debug'ng feature. It'd nice to
provide a straight-and-easy-to-use way for loopback mounting.
Possible implementations would vary, I suppose.
/// mount-iso ///
#!/bin/ksh
any="vnd0 vnd1 vnd2 vnd3"
mnt=${2-/removal}
if [ ! -f $1 ]
then
echo 2>&1 "Usage: mount-iso <iso_image> [<mntdir>]"
exit 1
fi
if /sbin/mount | egrep "vnd[0-9]a on $mnt type"
then
echo 2>&1 "$mnt is in use"
exit 1
fi
for i in $any
do
/usr/sbin/vnconfig -c $i $1 2>/dev/null
[ $? -ne 0 ] && continue
/sbin/mount_cd9660 -o ro /dev/${i}a $mnt
/sbin/mount | egrep "$mnt type"
exit $?
done
echo 2>&1 "All of $any in use"
exit 1
/// umount-iso ///
#!/bin/ksh
mnt=${1-/removal}
/sbin/mount | egrep "vnd[0-9]a on $mnt type"
if [ $? -ne 0 ]
then
echo 2>&1 "$mnt is not in use"
exit 1
fi
dev=$(/sbin/mount | awk '$3 == "'$mnt'" { print $1 }')
dev=${dev##/dev/}
dev=${dev%a}
/sbin/umount $mnt && /usr/sbin/vnconfig -u $dev
---
Toru Nishimura / ALKYL Technology
Home |
Main Index |
Thread Index |
Old Index