ISO image files provide a convenient way to distribute installers, live systems, and archives without relying on physical media like CDs or DVDs. Access to the contents of an .iso file permits browsing documentation, extracting individual packages, or verifying checksums before reuse.

On Linux, ISO images normally contain an ISO 9660 filesystem and are attached through the mount command. When bound to a directory as a loopback device, the image behaves like a read-only optical drive, and its directories and files appear under the chosen mountpoint.

Mounting an ISO image is a privileged operation and typically requires sudo access because it alters the system's view of attached filesystems. Mounting to a dedicated temporary directory and unmounting cleanly after use prevents stale mounts, avoids accidental writes in the wrong location, and keeps filesystem navigation predictable.

Steps to mount an ISO image file in Linux:

  1. Open a terminal in a working directory where the mountpoint directory will be created.
    $ pwd
    /home/user
  2. Create a temporary directory to use as the mountpoint for the ISO file.
    $ mkdir temp
  3. Switch the current directory to the location that contains the .iso image file.
    $ cd ~/Downloads
  4. Check if the .iso file is recognized as a valid image by the system.
    $ file ubuntu-19.10-live-server-amd64.iso
    ubuntu-19.10-live-server-amd64.iso: DOS/MBR boot sector; partition 2 : ID=0xef, start-CHS (0x3ff,254,63), end-CHS (0x3ff,254,63), startsector 1391610, 7936 sectors

    The file command inspects the image header and reports the detected partitioning and filesystem format.

  5. Mount the .iso image file on the temporary directory using the loopback device and the iso9660 filesystem type.
    $ sudo mount -t iso9660 -o loop ubuntu-19.10-live-server-amd64.iso /home/user/temp
    [sudo] password for user:
    mount: /home/user/temp: WARNING: device write-protected, mounted read-only.

    The mounted filesystem is read-only; files can be viewed or copied but not modified in place.

  6. List the top-level contents of the mounted .iso to confirm that the filesystem attached correctly.
    $ ls -l /home/user/temp
    total 76
    dr-xr-xr-x 1 root root  2048 Oct 17 13:33 boot
    dr-xr-xr-x 1 root root  2048 Oct 17 13:34 casper
    dr-xr-xr-x 1 root root  2048 Oct 17 13:33 dists
    dr-xr-xr-x 1 root root  2048 Oct 17 13:33 EFI
    dr-xr-xr-x 1 root root  2048 Oct 17 13:33 install
    dr-xr-xr-x 1 root root 34816 Oct 17 13:33 isolinux
    -r--r--r-- 1 root root 25363 Oct 17 13:34 md5sum.txt
    dr-xr-xr-x 1 root root  2048 Oct 17 13:33 pics
    dr-xr-xr-x 1 root root  2048 Oct 17 13:33 pool
    dr-xr-xr-x 1 root root  2048 Oct 17 13:33 preseed
    -r--r--r-- 1 root root   232 Oct 17 13:33 README.diskdefines
    lr-xr-xr-x 1 root root     1 Oct 17 13:33 ubuntu -> .
  7. View or copy specific files from the mounted image to another directory as needed.
    $ head /home/user/temp/dists/stable/Release
    Origin: Ubuntu
    Label: Ubuntu
    Suite: eoan
    Version: 19.10
    Codename: eoan
    Date: Thu, 17 Oct 2019 12:37:49 UTC
    Architectures: amd64 i386
    Components: main restricted
    Description: Ubuntu Eoan 19.10
    Acquire-By-Hash: yes

    Files read from the mountpoint behave like regular files; use standard tools such as cp, less, or tar to inspect or extract content.

  8. Change back to the home directory or another safe location so the mountpoint directory is not the current working directory.
    $ cd

    Unmounting a filesystem that is in active use can fail with a target is busy error.

  9. Unmount the .iso image from the temporary directory once access is no longer required.
    $ sudo umount /home/user/temp
  10. Remove the now-unused temporary mountpoint directory to keep the home directory tidy.
    $ rmdir /home/user/temp
Discuss the article:

Comment anonymously. Login not required.