mounting a .iso image? ... missing man page

cary cary at sdf.org
Thu Oct 10 05:10:48 UTC 2013


Gary Aitken wrote:
> On 10/09/13 21:25, Polytropon wrote:
>> On Wed, 09 Oct 2013 21:14:22 -0600, Gary Aitken wrote:
>>> Seems like it must be possible to mount a cd9660 image somehow without
>>> burning an actual disc?
>>
>> Of course. :-)
> 
> I guess knowing it's possible is a start;
> couldn't figure out where to look to get the magic combination.
> 
>> It is possible by using a virtual node "connected" to the
>> ISO file. Without having tested, according to your example:
>>
>> 	# mdconfig -u 0 -t vnode -f /hd1/Downloads/FreeBSD/9_1/FreeBSD-9.1-RELEASE-amd64-disc1.iso
> 
> for the record, that's:
>           mdconfig -a -t vnode -u 0 -f <file>
> 
>> 	# mount -o ro -t cd9660 /dev/md0 /mnt/tmp
>> 		... do stuff ...
>> 	# umount /mnt/tmp
>> 	# mdconfig -u 0 -d
> 
> and that one is
>           mdconfig -d -u 0
> 
> order appears to be important
> 
> Thanks again,
> 
> Gary
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"
> 
> 


To avoid having to recall the arguments for mdconfig(8):


#/bin/sh
#start_isofs
#two commands to attach and mount or umount file.iso
#
isofs_stop() {
        (umount -f /mnt &&
        mdconfig -d -u $NUM)
}
NUM=3

DEV="/dev/md${NUM}"
IMGFS=$1
case $2 in
"start")
        # first check whether target mount point is in use
        if mount | grep -q "/mnt"; then
                printf "Exiting: mount point '/mnt' currently unavailable.\n"
                exit 1
        fi
        (mdconfig -a -t vnode -f "$IMGFS" -u $NUM &&
        mount -o ro -t cd9660 $DEV /mnt) ;;
"stop")
        isofs_stop ;;
*)
        if [ "$IMGFS" = "stop" ]; then
                isofs_stop
        else
                your_script="$(basename $0)"
                printf "Usage: %s [isofile] start|stop\n" $your_script
	fi
        ;;
esac
exit


-- 
cary at sdf.org
SDF Public Access UNIX System - http://sdf.org


------------------------------


More information about the freebsd-questions mailing list