Learn how to mount ISO disk image in Linux. ISO image file mounts using loop device and iso9660 filesystem type enabling user to access data within as a normal mount point.
Many software distributions comes on Compact Disc CD media. Since physical CD is difficult to maintain over course of years, many people prefer to have ISO image of discs. Also, its feasible to use such ISO file quicker on server where native disc drive is absent. Its quick to copy ISO file on server and mount it rather than searching for a USB disk drive, connecting, identifying it on server and then using disc in it.
In this post we will be seeing how to mount ISO file in Linux to access data in it. Its a very short procedure of couple of commands and ISO file’s data will be available to you like any other data mount point.
First we need to create mount point directory on which ISO will be mounted. Preferable it should be under /mnt structure.
# mkdir /mnt/iso
Now, copy ISO to server using FTP or SCP. Lets say we have copied test.iso in /tmp directory.
Mount ISO file on /mnt/iso mount point using mount command using loop device. Loop device is a pseudo device which access file as a block device. Since mount command deals with block devices and not files, we are using loop option here.
# mount -o loop /tmp/test.iso /mnt/iso
mount: you must specify the filesystem type
Here you can see error that we havnt specified file system to mount. Proceed with specifying iso9660 file system. iso9660 file system uses for CD/DVD ROM file sturctures.
# mount -o loop -t iso9660 /tmp/test.iso /mnt/iso
Using 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
-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 un mount it, ISO file will be in use by this mount and throws warnings if you try to work with it.
# unmount /mnt/iso