How to mount / umount ISO image on CentOS 8 / Rhel 8 Linux - LinuxConfig.org

Details Lubos Rendek Redhat / CentOS 19 September 2019
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

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. SUBSCRIBE TO NEWSLETTERSubscribe to Linux Career NEWSLETTER and receive latest Linux news, jobs, career advice and tutorials.
  4. 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
    
  5. 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.
  6. 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.
    
  7. 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:

    WARNINGThe following command may damage your system or may have undesired consequences. Use only as a last resort !!!

    # fuser -mk /media/iso
    

This is a companion discussion topic for the original entry at https://linuxconfig.org/how-to-mount-umount-iso-image-on-centos-8-rhel-8-linux