Mounting ISO images

Last revision: Thu Mar 23 13:48:05 2023
Valid HTML 4.01!

This Web site documents procedures for using ISO images on common desktop platforms. ISO images contain filesystems in a common format defined by an international standard, ISO 9660, originally meant for optical media, such as CD-ROMs and DVDs, but now widely used for cross-platform software and data distribution, and usually just transferred via networks between computers as binary data files that are rarely recorded on removable optical media.

Modern operating systems, except Microsoft Windows before version 10, can mount ISO image files, but the procedures for doing so vary, and are annoyingly complicated on some systems.

On UNIX family systems, mounting a file system image means attaching it to an existing directory such that the original contents, if any, are no longer visible. Many such systems have an top-level directory, /mnt, that is already present for such purposes, but otherwise, just create an empty directory with something like mkdir /tmp/foo, and use that in place of /mnt in the following examples.

In a desktop environment, there is usually a file manager tool that may be able to open (i.e., mount and view) an ISO image file simply by selecting it with mouse clicks. If that works for you (as it does on Apple macOS and Microsoft Windows 10), do it. Otherwise, look at one of the following sections to find instructions for other platforms.

The name of an ISO image file often ends in .iso, but that extension mostly does not matter. Apple macOS systems have another O/S-specific format that ends in .dmg that can be handled the same way, but may not be viewable on other operating systems.

In the following, we use the name texcol2023.iso, for the TeX Live 2021 ISO image, but the instructions are generic and can be applied to any ISO file just by a simple name change. You can also prefix the filename with a directory path, such as $HOME/Downloads/, but that is optional if you have already changed your working directory to that location.

On most systems, you must have administrator (UNIXese: root) privileges to mount a filesystem. We assume below that you have already issued a suitable su or sudo command to temporarily obtain the needed access. If you are on a shared computer, without such privileges, you may need to request an adminstrator to do the mount for you, and then later, do an unmount when your work is done.

Before you unmount the ISO image, ensure that you are no longer using it, either via open files in document viewers, text editors, or Web browsers, or your having issued a shell command to change to a directory under the mount point. Otherwise, the unmount is likely to fail with a device busy error.

Apple macOS

Administrator privileges are not normally required on macOS to mount an ISO image.

Use this procedure if you are connecting to a macOS system over a network from another system:

    % hdiutil attach texcol2023.iso -readonly
    /dev/disk11   /Volumes/TEXCOL2021

    … work with the ISO image …

    % hdiutil detach /dev/disk11
    "disk11" unmounted.
    "disk11" ejected.

The first hdiutil command returns a device name (here, /dev/disk11) and a dynamically chosen mount point (here, /Volumes/TEXCOL2021) that must be used in the second hdiutil command. On that final command, you can use either the device path, or the mount point.

You can also choose a particular mount point, like this:

    % hdiutil attach texcol2023.iso -readonly -mountpoint /tmp/tl2021
    /dev/disk12   /private/tmp/tl2021

The returned mount point contains the prefix /private, but both paths to the mounted image are usable.

If the mount point directory does not already exist, it is silently created for you, then deleted when the ISO image is unmounted.

DragonFlyBSD

In the mount command, the filesystem type, cd9660, corresponds to the ISO 9660 standard:

    # vnconfig vnd0 texcol2023.iso
    # mount -t cd9660 /dev/vnd0a /mnt

    … work with the ISO image …

    # umount /mnt
    # vnconfig -u vnd0

For more details, visit this link.

FreeBSD family

This family includes also ArisBlu, ClonOS, DesktopBSD, FreeNAS, FuryBSD, GhostBSD, HardenedBSD, helloSystem, Junos OS, MidnightBSD, NomadBSD, OPNsense, PacBSD, PC-BSD, pfSense, StarBSD, Trident, TrueOS, XigmaNAS, and others.

    # mdconfig -a -t vnode -f texcol2023.iso
    md0
    # mount -t cd9660 /dev/md0 /mnt

    … work with the ISO image …

    # umount /dev/md0
    # mdconfig -d -u 0

The mdconfig command returns a device name (here, md) and number (here, 0) that must be used in the following commands.

GNU Hurd

ISO mounting follows the GNU/Linux procedures:

    # mount -o ro texcol2023.iso /mnt

    … work with the ISO image …

    # umount /mnt

GNU/Linux family

The Linux kernel and GNU utilities are supplied in more than a thousand distributions that differ primarily in desktop appearance, package tools, and systems management tools, but otherwise, for the user, behave similarly. Common distributions include Alpine, AltLinux, Antix, ArchLinux, Arco, Bodhi, Budgie, CentOS, ClearLinux, Debian, Deepin, Devuan, ElementaryOS, Fedora, Garuda, GUIX, Hyperbola, Kali, Knoppix, LXLE, Mageia, Makulu, Manjaro, Mint, MXLinux, openSUSE, Oracle, PCLinuxOS, Parabola, Parrot, PopOS!, Puppy, PureOS, RedHat, Salix, Slackware, Solus, Trident, Trisquel, Ubuntu, Void, ZorinOS, and many more.

    # mount -o ro texcol2023.iso /mnt

    … work with the ISO image …

    # umount /mnt

You can omit the -o ro (option: read-only), but you will then get a warning.

Microsoft Windows 10

In a PowerShell window (perhaps created by using ssh to connect over the network to a command window, then running the command powershell), run commands like this:

    PS C:\> Mount-DiskImage -ImagePath C:\Users\jones\Downloads\texcol2023.iso
    … long output …
    PS C:\> Get-DiskImage -DevicePath \\.\CDROM1 | Get-Volume
    F
    PS C:\> dir f:

    … work with the ISO image …

    PS C:\> Dismount-DiskImage C:\Users\jones\Downloads\texcol2023.iso

The first command mounts the ISO file, but does not tell the mount location; the second command returns that location as a drive letter that is used in the dir command to list the contents.

A full pathname must be provided on the Mount-DiskImage and Dismount-DiskImage commands, even if the ISO file is in the current directory.

For more details, visit this link.

NetBSD family

This family also include OS108.

    # vnconfig /dev/vn0 /var/tmp/texcol2023.iso
    # mount -t cd9660 /dev/vn0 /mnt

    … work with the ISO image …

    # umount /mnt
    # vnconfig -u /dev/vn0

For more details, visit this link.

OpenBSD family

This family includes Bitrig and LibertyBSD, but both are no longer supported.

The mounting procedure is the same as on DragonFlyBSD:

    # vnconfig vnd0 texcol2023.iso
    # mount -t cd9660 /dev/vnd0a /mnt

    … work with the ISO image …

    # umount /mnt
    # vnconfig -u vnd0

For more details, visit this link.

Solaris family

This family includes also DilOS, Dyson, Hipster, Illumos, NexenStor, OmniOS, OmniTribblix, OpenIndiana, SmartOS, Tribblix, Unleashed, XStreamOS, v9os, and others.

    # lofiadm -a texcol2023.iso
    /dev/lofi/1
    # mount -F hsfs /dev/lofi/1 /mnt

    … work with the ISO image …

    # umount /mnt
    # lofiadm -d /dev/lofi/1

The lofiadm command returns a device pathname (here, /dev/lofi/1) that must be used in subsequent commands.

For more details, visit this link.