How to mount / umount ISO image on CentOS 8 / Rhel 8 Linux

In this tutorial you will learn how to access and copy files from ISO image by mounting the ISO image directly on your CentOS 8 / RHEL 8 Linux system.

In this tutorial you will learn:

  • How to mount ISO image
  • How to unmount ISO image
  • How to check for mounted ISO image
  • How to access the content of the ISO image

Mount and Umount ISO image on RHEL 8 and CentOS 8

Mount and Umount ISO image on RHEL 8 and CentOS 8

Software Requirements and Conventions Used

Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Red Hat Enterprise Linux 8
Software N/A
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

How to mount / umount ISO image on CentOS 8 / Rhel 8 step by step instructions

  1. Obtain administrative privileges

    All of the below command will require administration privileges so change to root:

    $ su
    OR
    $ sudo -i
    

    Alternatively, prefix each below command with sudo to gain root privileges.

  2. Create mount point directory

    To mount an ISO image you will need mount point. This is a directory you will later use to access the content of your ISO image. This can be any arbitrary directory. The most obvious choice is:

    # mkdir /media/iso
    


  3. Mount ISO image

    At this point we are ready to mount the ISO image. Locate the ISO and take a note of the actual path to the file. In our example we will be mounting an ISO image rhel-8.0-x86_64-dvd.iso located within our current working directory:

    $ ls
    rhel-8.0-x86_64-dvd.iso
    

    Once ready mount the ISO image to the previously created mount point by using the mount command:

    # mount -t iso9660 -o loop rhel-8.0-x86_64-dvd.iso /media/iso
    

    All done. The ISO image is now mounted. You can check whether the ISO image is mounted by using the mount command:

    # mount | grep iso
    
  4. Access the content of the currently mounted ISO by navigating to your mount point /media/iso. At this stage you can access and copy any files from the ISO image.
  5. Unmount the ISO image

    To unmount the ISO image execute:

    # umount /media/iso
    

    In order to successfully unmount the ISO image you to need leave the /media/iso mount point directory otherwise any attempt to umount the ISO image will result in error message:

    umount: /media/iso: target is busy.
    


  6. Troubleshooting

    In case you cannot unmont the ISO and your are receiving the target is busy error you may use the fuser command to kill the process holding a lock on your mount point:

    WARNING
    The following command may damage your system or may have undesired consequences. Use only as a last resort !!!
    # fuser -mk /media/iso