ISO in Linux

How to mount ISO file in Linux?

Learn how to mount ISO disk image in Linux. ISO image file mounts using a loop device and iso9660 filesystem type enabling users to access data within as a normal mount point. 

Many software distributions come on Compact Disc CD media. Since physical CD is difficult to maintain over the course of years, many people prefer to have an ISO image of discs. Also, it’s feasible to use such ISO file quicker on the server where native disc drive is absent. It’s quick to copy ISO file on the server and mount it rather than searching for a USB disk drive, connecting, identifying it on the server, and then using the disc in it.

In this post, we will be seeing how to mount ISO file in Linux to access data in it. It’s a very short procedure of a couple of commands and ISO file’s data will be available to you like any other data mount point.

Step 1.

First, we need to create a mount point directory on which ISO will be mounted. Preferable it should be under /mnt structure.

# mkdir /mnt/iso

Now, copy ISO to the server using FTP or SCP. Let’s say we have copied test.iso in /tmp directory.

Step 2.

Mount ISO file on /mnt/iso mount point using mount command using the loop device. The loop device is a pseudo-device that accesses the file as a block device. Since mount command deals with block devices and not files, we are using a loop option here.

# mount -o loop /tmp/test.iso /mnt/iso
mount: you must specify the filesystem type

Here you can see an error that we haven’t specified file system to mount. Proceed with specifying the iso9660 file system. iso9660 file system uses for CD/DVD ROM file structures.

#  mount -o loop -t iso9660  /tmp/test.iso /mnt/iso

Using the above command with filesystem iso9660 and loop device we successfully mounted ISO file. You can verify it with df command and viewing content of ISO file.

# df -h
Filesystem            Size  Used Avail Use% Mounted on
/tmp/test.iso          82K   82K     0 100% /mnt/iso

# cd /mnt/iso
# ll
total 22
-r-xr-xr-x. 1 root root 12246 Dec 19 13:50 CPU_iowait.xlsx
-r-xr-xr-x. 1 root root  9357 Dec 19 13:53 RAM.xlsx

You can un-mount this ISO with simple unmount command. Unless you unmount it, ISO file will be in use by this mount and throws warnings if you try to work with it.

# unmount /mnt/iso

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.