How to Mount and Unmount an ISO Image in Linux

  • Last updated: Oct 12, 2024
  • Views: 7
  • Author: Admin
How to Mount and Unmount an ISO Image in Linux

Hello colleagues.

In today's article, we will talk about how you can mount and unmount ISO images in the Linux operating system.

ISO images are archives containing a complete copy of data from a CD or DVD. In Linux, mounting ISO images allows you to view and use the contents of the image, while unmounting allows you to close access to data and free up occupied resources. In this article, we will explain how to perform these operations on various Linux distributions.

Mounting and unmounting ISO images in Linux is an easy and convenient way to access data on virtual disks. Note that mounting and unmounting images requires superuser (root) privileges, so use the sudo command to complete everything. Also pay attention to the correct file paths and mount points.

 

Before mounting the image, create a directory that you will use as the mount point. For example, let's create a directory named "iso" in the user's home directory. To create a directory, use the command:

$. mkdir ~/iso

To mount an ISO image, use the mount command. For example, your ISO image is called "centos8.iso" and is located in the current directory. To mount, use the command:

$. sudo mount -o loop centos8.iso ~/iso

In this example, we used the -o loop option, which tells the Linux kernel to use a "loopback" device, which allows files to be mounted as block device devices. Change the image path "centos8.iso" to the actual path to your image, and "~/iso" to the path to the mount point you created earlier.

Now the contents of the ISO image will be available in the "iso" directory and you will be able to view its contents as if it were a normal directory.


 

Once the ISO image is finished, it must be unmounted to free up resources.

Before unmounting an image, make sure it is actually mounted. Run the mount command with no arguments to see a list of all currently mounted devices and their mount points:

$. mount

If there is an ISO image in the list, unmount it with the command:

$. sudo umount ~/iso

In the example, "~/iso" is the path to the mount point you used to mount the image. After executing this command, the contents of the image will become inaccessible and you can safely remove the "iso" directory.


 

Thank you all, I hope my article was of some help to you.

 

SIMILAR ARTICLES