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.
Comments on this entry are closed.
Thanks for the post. It looks good.
For windows, MagicISO is a tool to extract, edit, search a file in iso etc.,
Hi, last box shouldn’t be $ cp some-file-inside-iso /tmp/mnt ?
Is it there a way to know the command line used to create the ISO, so to recreate it as similar as possible to the original? (point 4)
How to mount one single partition in an image, e.g. if you have made a “dd-image” of a whole disk?
If the disk has only one single partition it is easy:
as already shown.
Let us assume the image file has the name sda.img. Do now fdisk:
Now let us mount sda.img8. The fdisk command has said:
Units = sectors of 1 * 512 = 512 bytes
Now look into the “start” column and multiply it with 512 bytes:
33929343 * 512 = 17371823616
This is the offset number in bytes you have to know:
If something went wrong, then propably the offset is wrong.
Now you can work with it like with a normal disk.
And the end of your work:
Just use fuseiso to mount it, no need for mc…
Another way to view and extract content from an iso file using p7zip (http://p7zip.sourceforge.net/)
Thanks for the information about MagicISO, which looks like a commercial product. Does that work on Linux (or) Is it only for Windows? I couldn’t tell from their website.
Thanks for pointing out the mistake. I’ve corrected it.
To create ISO image, use dd command. i.e Something like the following:
Thanks for the awesome explanation with examples on how to mount a single partition from a image file that contains multiple partition. I sincerely appreciate your contribution.
Thanks for bringing fuseiso to our attention.
For those who are new to fuseiso, this article explains about fuseiso in detail.
P7ZIP looks good. Thanks for the information.
For those who are new to p7zip, it is a port of 7za.exe for POSIX Unix systems and MacOS X.
My question was about point 4, suppose I have an ISO file, created with mkisofs that has hundred options.
If I extract to a folder and customize my ISO, I want to repack the folder using the same options as the original image, it isn’t funny starting from a stock bootable ISO and obtain a customized non bootable one…
Is it there a way to know the options used to create the original ISO?
mc saved my day!
for mc work you must have installed genisoimage.
i want to see the tree structure of ISO file during mounting, for example i see the content of file.tar.gz using “tar -tvzf file.tar.gz”
is it possible to list the contents of iso file?
after making modification to any file of a iso (after extracting iso.).. i can use mkisofs command to recreate a new iso..but do i need to recreate any descriptor for the folder in which i made changes to files ?