Tip, Mount ISO Image on Linux
- 16 de março de 2009
A very useful tip for anyone who wants to test an ISO image, but doesn’t want to burn the CD.
It’s quite practical for several reasons: doesn’t burn CDs unnecessarily, has instant access to content, doesn’t waste physical media, and is more ecological.
You can use this to test Linux distributions before installing, verify content of downloaded ISOs, extract specific files from the image, or install software directly from the ISO.
- Creating a directory for the content
mkdir /media/virtual_driver
This directory will serve as a mount point for the ISO image.
- Mounting the image
mount -o loop YOUR_IMAGE.iso /media/virtual_driver
Done! Your image has been mounted in the specified directory.
The loop device is a pseudo-device that allows treating a file as if it were a block device. Basically, the ISO becomes a “virtual disk”, you access it normally through the file browser, by default it’s read-only, and the Linux kernel already has native support.
The -o loop option specifies mount options, loop uses loop device automatically, ro is read-only (implicit for ISOs), and you can use noexec to disable execution if you want.
To mount an Ubuntu ISO:
mkdir /media/ubuntu
mount -o loop ubuntu-20.04.3-desktop-amd64.iso /media/ubuntu
With specific options:
mount -o loop,ro,noexec fedora.iso /media/fedora
For temporary use:
sudo mkdir -p /tmp/iso
sudo mount -o loop file.iso /tmp/iso
# Use the content
sudo umount /tmp/iso
Through terminal:
ls /media/virtual_driver/
cd /media/virtual_driver/
Through file manager, just open Nautilus (Ubuntu), navigate to /media/virtual_driver/, and explore normally like any folder.
To copy files:
cp /media/virtual_driver/file.txt ~/Desktop/
cp -r /media/virtual_driver/folder/ ~/Documents/
umount /media/virtual_driver
To check active mounts:
mount | grep loop
df -h | grep loop
If you need to force:
umount -f /media/virtual_driver # Force unmount
umount -l /media/virtual_driver # Lazy unmount
Error “mount: wrong fs type”: Corrupted ISO or invalid format. Use file file.iso to check type and md5sum file.iso to verify integrity.
Error “Device is busy”: Files in use at mount point. Use lsof /media/virtual_driver to see processes using, cd / to exit directory, and umount /media/virtual_driver.
Error “Permission denied”: Lack of privileges. Use sudo or configure fstab.
On Ubuntu/GNOME, you can use Nautilus with double-click on ISO, or Disk Image Mounter which is an integrated tool.
On KDE, Dolphin has native ISO support, and K3b serves to burn and mount.
Via command line, you can use fuseiso:
sudo apt-get install fuseiso
fuseiso file.iso /media/mount_point
Advantages: immediate access, doesn’t waste CDs, allows multiple mounts, and is sustainable.
Limitations: read-only (doesn’t modify original ISO), loop devices consume resources, needs root to mount, and unmounts on reboot.
Mounting ISO images directly on Linux is a very useful skill. This simple technique saves time, resources and offers flexibility in handling disk images.
The essential commands are:
# Mount
mkdir /media/point
mount -o loop file.iso /media/point
# Use
ls /media/point
# Unmount
umount /media/point
Use this for testing distributions before installation, verifying ISO downloads, extracting specific files, and development with system images.
This simple tip can save a lot of time and resources in your daily Linux work!