Mounting IMG and ISO images in FreeBSD

Discussion in 'Linux, BSD and Other OS's' started by RHochstenbach, Dec 16, 2010.

  1. RHochstenbach

    RHochstenbach Administrator

    Likes Received:
    26
    Trophy Points:
    48
    How to mount an IMG image in FreeBSD

    1. Determine the file system by using the file-utility.
    Code:
    file image.img
    Its output should give a clue about the file system. It can be ext2, ext3, ufs, reiserfs etc. Write that one down.

    2. Use the mdconfig-utility to link the IMG image to a virtual device.
    Code:
    mdconfig -a -t vnode -f /path/to/image.img -u 0
    The image will now be connected to the virtual device /dev/md0

    3. Now mount the virtual device. In this example I use an image with the ext2 file system, so I enter the following command:

    Code:
    mount -t ext2fs /dev/md0 /mnt
    You can now see the contents of the image in /mnt.

    To unmount the image, enter these two commands:

    Code:
    umount /mnt
    mdconfig -d -u 0
    
    You can also mount ISO images using this way, using the file system cd9660 or UDF and mounting it in /cdrom instead of /mnt.
     

Share This Page