🌐 🇵🇱 Polski · 🇬🇧 EN
Sometimes, in an administrator's tasks, it becomes necessary to access files contained within an ISO archive (an optical disc image). The name ISO comes from the ISO 9660 data storage standard designed for CD media. A drawback of this solution is the limitation related to the size of a single file, which is 2GB. This problem was solved in a variant of this standard called UDF. Encyclopedic information regarding the ISO format can be found on Wikipedia pages. Additional information related to the ISO topic can be obtained from the International Organization for Standardization. Just like other archives, an ISO image contains all the data that was on the CD, along with file system metadata, boot code, and attributes. Thanks to the reliability of this format and the ease of data reproduction, it has become one of the most popular formats used for distributing software over the internet. Many Linux distributions are distributed in this very format. The advantage of this solution is undoubtedly the ability to place the image in an emulated CD-ROM device without the need to burn the image onto an optical medium.
Mounting an ISO image in a directory
Step 1 - Create a directory where the ISO will be mounted
# mkdir /media/iso
Step 2 - Knowing the location of the ISO image, perform the mount
# mount -o loop /iso/obrazcd.iso /media/iso/
Step 3 - Verify the mount
# ll /media/iso
After executing the above command, you should see the contents of the ISO image.
Automatic mounting of the image at system startup
Step 1 - Modify entries in the /etc/fstab file
Add the following entry to the /etc/fstab file:
/iso/obraz.iso /media/iso iso9660 loop 0 0
Step 2 - Test for correctness
If you haven't unmounted the image yet, do it now
# umount /media/iso
Step 3 - Mount devices from fstab
# mount -a
Step 4 - Verify that everything has been mounted
# mount
/dev/mapper/VolGroup-lv_root on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")
/dev/sda1 on /boot type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
/dev/loop0 on /media/iso type iso9660 (rw)
The last line shows that the iso image has been mounted correctly.
Add the following entry to the /etc/fstab file:
/iso/obraz.iso /media/iso iso9660 loop 0 0
Step 2 - Test for correctness
If you haven't unmounted the image yet, do it now
# umount /media/iso
Step 3 - Mount devices from fstab
# mount -a
Step 4 - Verify that everything has been mounted
# mount
/dev/mapper/VolGroup-lv_root on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")
/dev/sda1 on /boot type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
/dev/loop0 on /media/iso type iso9660 (rw)
The last line shows that the iso image has been mounted correctly.
Mounting can be useful, for example, to provide a yum repository from an installation disc image.

Comments