Translation(s): none

Mounting an ISO and extracting files from it. Command line techniques with a Debian ISO remaster example.

Copy an optical disk to a file

Copy a CD to a .iso file:

dd if=/dev/cdrom of=image.iso

Mount an ISO file

Mount the contents of a .iso file to a directory:

mount -o loop -t iso9660 image.iso /the/directory

Convert any disk image to ISO format

The iat package can be used to convert many disk image formats (BIN, MDF, PDI, CDI, NRG, and B5I) to ISO9660.

Loopmount an ISO Without Administrative Privileges

Users seeking to view the contents of an ISO file or copy a file from it are frequently advised to mount the ISO with

mount -o loop example.iso /mnt

There are two aspects of this advice to consider:

The following programs allow loopmounting without administrative privileges.


Install udisks2:

apt install udisks2

If a desktop environment has been installed from the installer or after the installation, udisks2 will already be on the system.

The package contains the udisksctl program. The command

udisksctl loop-setup -r -f example.iso

attaches the ISO to a loop device in /dev. Logging out and back in again might be necessary to have success with this command as a user.


ls -l /dev/loop*

might show

brw-rw---- 1 root disk   7,   0 Nov 16 15:14 /dev/loop0
brw-rw---- 1 root disk 259,   2 Nov 16 15:14 /dev/loop0p1
brw-rw---- 1 root disk 259,   3 Nov 16 15:14 /dev/loop0p2
brw-rw---- 1 root disk   7,   1 Nov 16 15:19 /dev/loop1
brw-rw---- 1 root disk   7,   2 Nov 16 15:14 /dev/loop2
brw-rw---- 1 root disk   7,   3 Nov 16 15:14 /dev/loop3
brw-rw---- 1 root disk   7,   4 Nov 16 15:14 /dev/loop4
brw-rw---- 1 root disk   7,   5 Nov 16 15:14 /dev/loop5
brw-rw---- 1 root disk   7,   6 Nov 16 15:14 /dev/loop6
brw-rw---- 1 root disk   7,   7 Nov 16 15:14 /dev/loop7
crw-rw---- 1 root disk  10, 237 Nov 16 15:14 /dev/loop-control

The ISO's main partition can be mounted and unmounted with the commands

udisksctl mount -b /dev/loop0p1

udisksctl unmount -b /dev/loop0p1

The mount point is at /media/$USER.

Unmounting still leaves example.iso associated with /dev/loop0. To unattach the device do

udisksctl loop-delete -b /dev/loop0

udisks2 appeared in Debian 8 (jessie).


Intended as a udisks2 replacement but udevil can co-exist with it and will work to mount an ISO with or without its recommended packages.

udevil mount example.iso


udevil unmount example.iso

work out of the box. The mount point is in /media.

udevil appeared in Debian 8 (jessie) but has been backported to Debian 7 (wheezy).


Mounting an ISO with pmount requires (at present) the experimental version. Alter the loop_allow directive in /etc/pmount.conf to yes and uncomment loop_devices before mounting the ISO in /media with

pmount example.iso

Unmount with

pumount example.iso


archivemount is a FUSE based file system which supports reading from (but not writing to) ISO 9660 images. Create the directory isomount in $HOME and mount with

archivemount example.iso isomount/

Unmount with

fusermount -u isomount/


fuseiso9660 is a module for the FUSE kernel service.

Create the directory isomount in the home directory ($HOME) and mount the iso with

fuseiso9660 example.iso isomount/

Unmount with

fusermount -u isomount/

fuseiso9660 deals only with the basic ISO9660 format (see the manual) so filenames are limited to uppercase and 11 characters in an 8.3 format.

Viewing the Contents of an ISO

Mounting the ISO and following up with

ls -l <mount_point>

is one method of seeing what the structure of the ISO is and what it contains. However, there are a number of programs which will allow examination of the contents of an ISO archive without having to mount it and without administration rights.

A Debian 9 (stretch) netinst ISO will be used as an example image in what follows.


bsdtar is a tar implementation which can view the contents of various archive files, including ISO 9660 images. It can also extract files from the image. For a basic view of the contents of an ISO image do

bsdtar -tf debian-9.3.0-i386-netinst.iso

A detailed view would be obtained with

bsdtar -tvf debian-9.3.0-i386-netinst.iso

To look at a particular directory in the archive there is

bsdtar -tf debian-9.3.0-i386-netinst.iso pool/main/a


xorriso is a versatile program which manipulates ISO 9660 filesystem images. It can also extract files from the image.

Commands which correspond to the ones for bsdtar are

xorriso -indev debian-9.3.0-i386-netinst.iso -ls

xorriso -indev debian-9.3.0-i386-netinst.iso -lsl

xorriso -indev debian-9.3.0-i386-netinst.iso -ls pool/main/b


isoinfo is included in the genisoimage package and is able to list and extract files in an ISO 9660 image. The listing is of all files in the image.

For basic listing:

isoinfo -J -l -i debian-9.3.0-i386-netinst.iso

For long listing:

isoinfo -J -f -i debian-9.3.0-i386-netinst.iso


The 7z utility comes in the p7zip-full package. It packs and unpacks 7z archives and has ISO 9660 as a supported format for unpacking.

7z l debian-9.3.0-i386-netinst.iso

gives a file listing of the archive.

Extraction of Files from an ISO

If debian-9.3.0-i386-netinst.iso has been mounted and it is desired to have all the deb and udeb files copied to other media it should be sufficient to do

cp -a /media/<mount_point>/pool/main DESTINATION

Without explicit mounting, all the programs mentioned above are capable of extracting the same files. The relevant commands are:

bsdtar -C DESTINATION -xf debian-9.3.0-i386-netinst.iso pool/main

xorriso -osirrox on -indev debian-9.3.0-i386-netinst.iso -extract pool/main DESTINATION

isoinfo -J -x /pool/main/a/adduser/adduser_3.113+nmu3_all.deb -i debian-9.3.0-i386-netinst.iso > DESTINATION/adduser_3.113+nmu3_all.deb

7z x -oDESTINATION -i\!pool/main debian-9.3.0-i386-netinst.iso

  • isoinfo only extracts single files and will display a file on stdout (possibly the screen) if it is not redirected somewhere.
  • 7z doesn't like spaces between an option and its argument. Also, the bash shell sees ! as having a special meaning to it. This meaning can be removed by preceding ! with a backslash.

Remaster an Installation Image

Netinst and DVD-1 images are popular choices when it comes to installing Debian. Much of the time it is sufficient simply to boot the image to have everything installed to a user's satisfaction. However, it is also possible to pass boot parameters to the installer to achieve a particular end, either during the installation or on the installed system. Objectives could be to produce a fully automatic installation or to configure part of the system using preseeding.

Appending parameters to the kernel command line to setup, for example, a network connection, can be done relatively easily, but is a repetitive task when installing frequently. On the other hand, the installation image can be altered to contain the needed parameters before burning to CD or DVD or writing to a USB stick.

Manipulating an ISO image in this way is known as remastering. The basic idea will be illustrated using a Debian 9.3.0 i386 netinst image which is planned to be booted from the non-graphical install option with a preseed configuration file, preseed.cfg.

Extracting All Files from an ISO

First make a place to put the extracted files:

mktemp -d

The name of the directory is displayed. Something like this should be seen:


Extract all files from the ISO with (for example)

cat firmware-9.3.0-i386-netinst.iso | bsdtar -C "/tmp/tmp.8t03ifDFAx" -xf -


xorriso -osirrox on -indev firmware-9.3.0-i386-netinst.iso -extract / /tmp/tmp.8t03ifDFAx

and make the files in /tmp/tmp.8t03ifDFAx writable:

chmod -R +w /tmp/tmp.8t03ifDFAx

A preseed configuration file can now be put in /tmp/tmp.8t03ifDFAx:

cp preseed.cfg /tmp/tmp.8t03ifDFAx

Appending Boot Parameters to the ISO

Edit /tmp/tmp.8t03ifDFAx/isolinux/txt.cfg to add the required parameters to the end of the append line. What follows is a personal choice but

priority=high locale=en_GB.UTF-8 keymap=gb file=/cdrom/preseed.cfg

shows the intent. The language and keymap questions will not be asked and the rest of the installation will proceed under the guidance of preseed.cfg. preseed.cfg is found by the installer because the image is mounted on /cdrom.

Putting the ISO Back Together

For instructions how to re-use the full boot equipment of installation ISOs for "i386", "amd64", "arm64", and other architectures, see RepackBootableISO. The instructions in the following text suffice for "i386" and "amd64" in legacy BIOS mode.

Install genisoimage and do

genisoimage -r -J -b isolinux/isolinux.bin -c isolinux/ \                                                    
            -no-emul-boot -boot-load-size 4 -boot-info-table \                                                           
            -o preseed-firmware-9.3.0-i386-netinst.iso /tmp/tmp.8t03ifDFAx

(Leave out \ when using the command. It is only here to indicate a line-break ).

The original ISO was capable of being put on a USB stick at /dev/sdX (X depends on what lsblk gives when the stick is plugged in) with

cat firmware-9.3.0-i386-netinst.iso > /dev/sdX

and would have been bootable. The ISO can be restored to a bootable state with

isohybrid preseed-firmware-9.3.0-i386-netinst.iso

isohybrid is found in the syslinux-utils package.

Alternatively, the genisoimage and isohybrid commands can be replaced by the single command:

xorriso -as mkisofs -o preseed-firmware-9.3.0-i386-netinst.iso \
        -isohybrid-mbr /usr/lib/ISOLINUX/isohdpfx.bin \
        -c isolinux/ -b isolinux/isolinux.bin -no-emul-boot \
        -boot-load-size 4 -boot-info-table /tmp/tmp.8t03ifDFAx/

after installing isolinux.

Finally, remove /tmp/tmp.8t03ifDFAx:

rm -r /tmp/tmp.8t03ifDFAx

CategoryFileFormat | CategorySoftware