How to Mount an ISO Image File via the Command Line in Linux

Working with disk images is a standard requirement for system administrators and power users. While desktop environments provide graphical tools to extract or mount ISO files, graphical interfaces are entirely unavailable on headless Linux servers. In these environments, you must mount the ISO image directly through the command line.

This guide explains how to safely mount an ISO file using the standard Linux mount command so you can read its contents, and how to unmount it when you are finished.

Step 1: Create a Mount Point

In Linux, you cannot simply “open” a storage device or image file. You must attach it to an existing empty directory in your file system. This directory is called a mount point.

It is standard practice to use the /mnt or /media directories for this purpose. Let’s create a temporary directory specifically for our ISO.

sudo mkdir /mnt/iso

Step 2: Mount the ISO File

To mount the file, we use the mount command. Because an ISO file is not a physical block device (like a hard drive), we must mount it using a loop device. A loop device acts as a virtual block device, allowing the operating system to read the file as if it were a physical CD/DVD.

Execute the following command, replacing filename.iso with the actual path to your ISO file:

sudo mount -o loop /path/to/filename.iso /mnt/iso

Understanding the flags:

  • -o loop: Instructs the mount command to use a loop device. On modern Linux kernels, this is often handled automatically, but explicitly defining it ensures maximum compatibility.

Note: ISO files use the ISO 9660 file system, which is strictly read-only by design. When you mount the ISO, the Linux kernel will likely output a warning stating mount: /mnt/iso: WARNING: device write-protected, mounted read-only. This is expected behaviour and not an error.

Step 3: Access the Files

The ISO image is now attached to your file system. You can navigate into the mount point and read the files just like any normal directory.

cd /mnt/iso
ls -la

You can copy files out of the directory using the cp or rsync commands. However, because the file system is read-only, you cannot create, modify, or delete any files inside /mnt/iso.

Step 4: Unmount the ISO File

When you have finished extracting the necessary files, you should detach the ISO from the file system. Never delete the original ISO file while it is still mounted.

First, ensure you are not currently inside the mount directory, as the system will refuse to unmount a directory that is in use.

cd ~

Then, use the umount command (note the spelling: umount, not unmount):

sudo umount /mnt/iso

You can now safely delete the empty /mnt/iso directory if you no longer need it.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.