Problem
How to mount a CD image to a directory in Linux.
tl;dr
mount -t iso9660 -o loop,ro /root/isos/example.iso /mnt
Solution
To open an ISO on Windows, you typically need a 3rd-party tool, such as Daemon Tools (which allows you to mount it to a virtual drive), or something like WinRAR or MagicISO that allows you to extract it to a folder.
However, on Linux, the software is already built-in via the mount -t command.
Run this command to mount to the /mnt directory:
mount -t iso9660 -o loop,ro /root/isos/example.iso /mntUnmount the ISO
If you need to unmount the CD image (such as, if you want to mount another ISO to the same directory), use the umount command from anywhere outside the mount directory.
umount /mntMount point error
If you receive this error:
mount: mount point /mnt does not exist
It means you need to create your mount directory first:
mkdir /mnt
If you want to mount it to a subdirectory, but haven't created the parent folder yet, such as you want it in /mnt/software/example, add the -p argument to the mkdir command:
mkdir -p /mnt/software/example
Mount arguments
mount -t type dev dir is the ordinary mount command.
type - filesystem type. iso9660 is the CD/DVD filesystem. Other ones are ext3, ext4, fat32, UDF etc.
Note: if you cannot see the contents of your ISO, most likely it's using the UDF filesystem. Unmount it and remount it with udf instead of iso9660.
dev - device, in this case an ISO file, which is read as a CD. Can be a physical device, such as /dev/usb01 for a USB keychain
directory - mount directory (i.e. where you want the files to be accessible).
- Updated