How to Mount an ISO Image via the Ubuntu Terminal

An ISO file is an exact sector-by-sector copy of an optical disc (like a CD or DVD). While desktop environments like GNOME allow you to mount an ISO image by simply double-clicking it, server administrators and power users often need to perform this task via the command line.

In this guide, we will walk through the exact terminal commands required to mount, explore, and safely unmount an ISO image in Ubuntu using the built-in loop device.

Why Mount an ISO Image via the Terminal?

Mounting an ISO via the terminal is essential when you are working on a headless Linux server (a server without a graphical user interface) or connecting remotely via SSH. It allows you to extract installation files, copy configuration scripts, or verify the contents of a downloaded operating system image without needing to burn it to a physical USB drive.

Step 1: Create a Mount Point Directory

In Linux, everything is treated as a file, and storage devices must be attached to an existing folder structure. This folder is called a “mount point.” Before you can mount the ISO, you need an empty directory to serve as this access point.

It is standard practice to create mount points in the /mnt or /media directories.

  1. Open your terminal.
  2. Run the following command to create a new directory called iso-image inside /mnt:
    sudo mkdir /mnt/iso-image
  3. You will be prompted for your administrator password because you are modifying a system directory.

Step 2: Mount the ISO Image Using the Loop Device

Because an ISO file is not a physical hardware device (like a hard drive or a USB stick), you must tell Linux to treat the file as if it were a physical block device. This is done using a “loop device” via the -o loop option.

  1. Navigate to the folder containing your ISO file. For example, if it is in your Downloads folder, run:
    cd ~/Downloads
  2. Use the mount command to attach the ISO to the directory you created in Step 1. Replace example.iso with the actual name of your file:
    sudo mount -o loop example.iso /mnt/iso-image

If the command is successful, Ubuntu will mount the image. You will likely see a warning message stating: “mount: /mnt/iso-image: WARNING: device write-protected, mounted read-only.” This is completely normal; ISO images are inherently read-only filesystems.

Step 3: Accessing and Extracting Files

Your ISO is now successfully mounted. You can explore its contents exactly as if you had inserted a DVD into a disc drive.

  1. To view the files inside the ISO, list the contents of your mount point:
    ls -la /mnt/iso-image
  2. If you need to extract files from the ISO, you can copy them to your home directory using the cp command. For example, to copy everything inside the ISO to a new folder on your desktop:
    cp -r /mnt/iso-image/* ~/Desktop/extracted-iso/

Step 4: How to Unmount the ISO Image Safely

Once you have finished copying files or exploring the ISO, you must unmount it to free up the loop device and ensure system stability. Do not simply delete the original ISO file while it is still mounted.

  1. First, ensure you are not currently inside the mount point directory in your terminal, or the system will say the drive is “busy.” Change back to your home directory:
    cd ~
  2. Use the umount (unmount) command followed by the mount point path:
    sudo umount /mnt/iso-image
  3. Finally, you can safely delete the empty mount point directory if you no longer need it:
    sudo rmdir /mnt/iso-image

By using the terminal to mount ISO files, you gain complete control over disk images directly from the command line, bypassing the need for third-party extraction software.

Leave a Reply

Your email address will not be published. Required fields are marked *

Get the best tech tips delivered straight to your inbox.

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

Receive our best articles and tips delivered straight to your inbox.