ISO stands for International Organization for Standardization, which has defined the format for a disk image. In simple terms iso file is a disk image.
ISO files are typically used to distribute the operating system. Most of the linux operating system that you download will be on ISO format.
If you have downloaded an Linux ISO file you typically burn it onto a CD or DVD as ISO image. Once you’ve burned the ISO image in a CD or DVD, you can boot the system to install the Linux OS.
But sometimes, you may just want to mount the ISO file and view the content without burning it to CD or DVD. In this article let us review how to Mount & View iso file as root and regular user in Linux Operating system.
1. How to mount iso files without writing it to CD/DVD ?
If you have downloaded a *.iso file from a website (for example, any Linux OS distribution), you can view the content of the iso file without writing as an iso to a CD or DVD as explained below using mount -o loop.. Please note that a loop device is a pseudo-device which will make an iso file accessible to the user a block device.
Syntax: # mount ISOFILE MOUNT-POINT -o loop
$ su - # mkdir /tmp/mnt # mount -o loop /downloads/ubuntu-9.04-desktop-i386.iso /tmp/mnt # cd /tmp/mnt # ls -l
For mounting you need to be logged in as root or you should have sudo permission. Read below to find out how to mount iso file as regular non-root user.
2. How to mount or view an iso file as a non root user ?
A non root user can also mount a file, even without sudo permission. Using midnight commander you can mount the iso file. Actually, it is really not mounting the file. But you can view the iso file content just like viewing some other files. Refer to our previous article that explains about Linux mc – midnight commander.
Steps to view iso file in midnight commander:
- Open midnight command (mc).
- Navigate to the path where ISO file exist.
- Click on the iso file, it will enter in to the iso file as like a normal directory and now you will be seeing the content of the file.
- To view the normal file or the file of the iso, Press <F3> when your cursor is on the file.
3. How to solve the issue “iso is not a block device error” ?
While mounting an iso file you may get the following error:
mount: file.iso is not a block device (maybe try `-o loop'?)
# mount /downloads/Fedora-11-i386-DVD.iso /tmp/mnt mount: /downloads/Fedora-11-i386-DVD.iso is not a block device (maybe try `-o loop'?)
Solution: As it is suggested by the mount command, use the -o loop as the option.
# mount /downloads/Fedora-11-i386-DVD.iso /tmp/mnt -o loop
4. How to update the content of an iso file ?
ISO file content cannot be updated once the ISO file is created. Only way to do as of now is,
Steps to update the iso file.
- Extract all the files from the iso.
- Update the content. i.e Add or remove any individual files inside the iso file.
- Create another iso with the updated files.
5. Extracting files from the iso file as root user ?
Mount the iso file as root user, and navigate to the directory to copy the required files from iso.
Steps to mount and extract the iso file as root user.
- Mount the iso file as root user.
# mount /downloads/debian-501-i386-DVD-1.iso /tmp/mnt -o loop
- Navigate to the mounted directory.
# cd /tmp/mnt
- Copy the required files.
# cp some-file-inside-iso /home/test
6. Extracting files from the iso file as normal user ?
View the content of the file as non root user in midnight commander, and then copy it using midnight commander commands or using shell commands.
Steps to extract the content from iso file as non root user.
- open mc.
- Navigate to the directory where the iso file is located.
- Select the iso file and press enter to view the content of the iso file.
- When you are inside the iso file, you will be able to view the contents of it. To copy a particular file from the iso file you can use the shell commands in shell prompt as.
$ cp some-file-inside-iso /tmp/mnt
- You can also do this copy using the mc commands.
Get the Linux Sysadmin Course Now!