ISO files are digital copies of optical discs like CDs, DVDs, or Blu-ray Discs. These files often have the .iso or .img extensions and follow the ISO 9660 filesystem format. In Linux, it's possible to open these files and view their contents without needing to burn them onto a physical disc.

Rather than using a disc, an ISO file can be mounted directly to a directory. This gives you access to the file's content as if it were a physical drive. The mounting process is straightforward and can be done using built-in Linux commands through the terminal. The mounted file is read-only, which ensures that the original data remains unaltered.

Mounting an ISO in Linux allows you to view, copy, or extract its contents. It also provides an efficient way to interact with the file without additional software. Below is a step-by-step guide to mounting an ISO image in a Linux environment.

Steps to mount an ISO image file in Linux:

  1. Create a temporary directory to mount the ISO file.
    $ mkdir temp
  2. Check if the ISO file is valid and recognized 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
  3. Mount the ISO image file to the temporary directory using the iso9660 filesystem type.
    $ sudo mount -t iso9660 ubuntu-19.10-live-server-amd64.iso temp/
    [sudo] password for user:
    mount: /home/user/temp: WARNING: device write-protected, mounted read-only.

    The ISO image is mounted as read-only. Files can be viewed or copied, but not modified.

  4. List and explore the contents of the mounted ISO file.
    $ ls -l 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 -> .
  5. Copy files from the mounted ISO to another location if needed.
    $ head 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
  6. Leave the mount directory.
    $ cd
  7. Unmount the ISO file from the directory when finished.
    $ sudo umount temp/
  8. Remove the temporary mount directory.
    $ rmdir temp/
Discuss the article:

Comment anonymously. Login not required.