In this article, we are going to learn How to Mount an ISO Image in Linux. ISO Image file is like a Container which contains all required materials or in simple word its a Screw Driver box which contains all different shape of bit’s for different Screws, Like that ISO Image file is an archive of files and directories like tar in Linux, which may contain video/Audio files, Operating System Supporting files and directories, Maybe games and so on…ISO file can be identified by a file with the extension “.iso“.
As we can see in Example ubuntu-20.04-desktop-amd64.iso is an iso file with extension “.iso” which contains all required supported files and directories of the Ubuntu Operation System.
There are so many Third-party applications are available to create or extract .iso files, But Today in this topic we are going to discuss how to mount an iso file in Linux.
Follow the Steps to Mount ISO Image in Linux
To Mount iso image, first, we need a .iso file, I have one iso file as shown below.
# cd /app/ # ls Ubuntu-20.04-desktop-amd64.iso
Step: 1 Create a mount point
Create a directory in /mnt or anywhere else where you want to mount the .iso file, Now go to the path where you have your .iso file (For Example I have my .iso file under /app directory).
# mkdir /mnt/ubuntu # Create a Directory in /mnt # cd /app/ # Go to the Path of .iso file # ls Ubuntu-20.04-desktop-amd64.iso
Step: 2 Mount the .iso File
The command to mount the .iso file would look like this :
mount -t iso9660 -o loop <Path of the .iso file><Path of the Mount Point >
Follow the command below.
# Use the below command to mount the .iso file [root@localhost app]# mount -t iso9660 -o loop /app/Ubuntu-20.04-desktop-amd64.iso /mnt/ubuntu/
-t: Used to Indicate the File System Type.
iso9660: It is a Standard by International Organisation Standardization (ISO) for Medias (CD/DVD).
-o : Options are specified with a -o flag followed by a comma-separated string of options.
loop: It is a pseudo-device or a fake device that allows you to mount a file and makes a file accessible as a block device. Loop devices are often used for ISO images. We can check the mounted devices by the below command.
Step: 3 Check mounted .iso File
We can check the mounted device by df -h command as shown below.
[root@localhost ubuntu]# df -h # Check mounted Devices /app/Ubuntu-20.04-desktop-amd64.iso 1.5G 1.5G 0 100% /mnt/ubuntu
Now we can go to “/mnt/ubuntu” where we mounted the .iso file to check the content of the file.
[root@localhost ~]# cd /mnt/ubuntu/ [root@localhost ubuntu]# ls boot casper dists EFI install isolinux md5sum.txt pics pool preseed README.diskdefines ubuntu
So we are able to mount the .iso file successfully by following the above steps but this is Temporary Mounting means once we restart the system the mount point will gone and we have to remount it if we need that.
Step: 4 Permanently Mount the .iso File
But if you want to mount the .iso file permanently then we have to mount it on “/etc/fstab” file, So let’s have look on steps below.
The Pattern to enter the .iso permanent mount would look like this :
<Path of the .iso File> <Mount Point> <iso9660> <loop> 0 0
So As per our Secnario :
/app/Ubuntu-20.04-desktop-amd64.iso /mnt/ubuntu iso9660 loop 0 0
Then refresh the mount table by mount -a Command.
You can Unmount the ISO image by the below command.
[root@localhost ~]# umount /mnt/ubuntu
That’s all, In this article, we have explained How to Mount an ISO Image in Linux. I hope you enjoy this article. If you like this article, then just share it. If you have any questions about this article, please comment.