Compressed Files and Image MountingBurn any Bootable CD from a file and you may come across something called an ISO it can also be known by other format types such as one or more of the following, this by know means is a definitive list.
* BWT, BWI, BWS, BWA
* CIF from Adaptec Easy CD Creator
* CSO (.cso)
* DAA (.daa)
* LCD from CDSpace
* MDF/MDS (.mdf)
* NRG (.nrg) (Nero Disk Image)
* DMG (Apple disk image) (.dmg)
* UIF (Universal Image Format) (.uif)
* IMA (.ima)
* IMG (.img)
* .dk (.dk)
* .isc (.ISC) MF Digital's Image Script virtual image file format
* WIM (.wim)
All of the above are possible CD image types that can store a compressed image for burning to a CD or DVD for that matter, from a single file. However by far the ISO we would hazard to guess is most widely recognised by most as a file format in common use for burning CD's and DVD's. Understanding the composition of an ISO can be defined as a series of files compressed into a single file name. This is not a lot different to using tar, gzip, zip, and so on to compress files into an archive.
If you wanted to examine the contents of a compressed file such as an ISO or sqfs (Squash File System) you have perhaps two options, reading the file in it's compressed format or expanding the single file to reveal the many files contained within.
Let's look at how we might access a compressed file image we will look first at ISO as this is something most people are familiar with. First we need to create a mount point on our Linux system, this so that when the filename.iso which can be thought of as a device is mounted to this directory so we can access it's files. Open a terminal and enter the following command.
Next we run a command to mount the iso file to a directory, the directory can exist anywhere but for the sake of consistency we recommend you install in directory named in "/media". This directory already contains mounts for CDROM's and perhaps USB's so this seems a logical place to add your iso file.* sudo - assume root user
* -o loop (this portion is important as it allows us to look at the contents of the ISO rather than the CD or DVD)
* -t iso9660 (an instruction to mount command to use 9660 type (-t) file system)
* /media/mount_point the destination file system is to be mounted to.
As you can see it only takes two commands to mount a compressed file this way which can be useful to access files without installing first.
Squashfs Compressed Files
Before we outline how to unmount these compressed files we first talk about mounting a compressed file such as squashfs from an already compressed file. Follow this scenario you have a Livecd of a Linux operating system and have mounted the filename.iso as previously mentioned above. On it is a file structure with some directories and a new filename with a file type not previously recognised. This file could be named livecd.sqfs and like most filenames has the potential to be called anything, however the .sqfs denotes that this is a squashed file system (sqfs). As before we need a directory on which to mount the file system.
Next we mount the squashed file system to the directory we have just created.* sudo - assume root user
* -o loop (this portion is important as it allows us to look at the contents of the Squashfs rather than the CD or DVD)
* -t squashfs (an instruction to mount command to use squashfs type (-t) file system)
* /media/new_mount_point the destination file system is to be mounted to.
Why would we want to mount file systems this way is there a practical use well the answer is yes there is a practical use. Using this method we are able to access files which can be used to transfer files to, for example a Usb pendrive to make a bootable alternative to the CDRom.
Like most Linux file systems if they are already mounted and if there contents are displayed elsewhere on the system, the mounted directory can not be unmounted until the open mount is closed. One of the mistakes made by many experts included is to leave the file system open and close it's terminal on the assumption this will close an open file system, it may not. To remove this as a possibility before closing an open terminal or file manager revert the directory to something safe that is always mounted such as your Desktop, then close any open terminals not used, then finally unmount the directory previously mounted.
First unmount the squashfs
Generally if the directory was mounted with sudo you will need to umount with sudo.
Next unmount the iso if you encounter difficulties it may be because you are trying to umount without using sudo or that you have tried unmount the iso file system before you have unmounted the squashfs.