The .ISO file format simply archives the contents of an optical media disc using the ISO 9660 file system. Typically it burns into CD/DVD, which serves as media to transfer the information.

Linux ISO

Under linux, actually there are a few things you can do to manipulate ISO file.

Create ISO file from CD/DVD

If you have a CD/DVD which has either files or media (audio/video), you can create a ISO file to archive the content, or share ISO file with your friends. Simply insert CD/DVD into CD/DVD drive, Linux typically will detect it as device “/dev/cdrom”, then you can do:

weng@weng-u1604:~$ sudo dd if=/dev/cdrom of=~/myDVD.iso bs=10M; sync

The above command will copy the entire CD/DVD into myDVD.iso file. “sync” command is used simply to make sure linux flush cache into myDVD.iso in disk.

View the content of ISO file

If you got a ISO file (e.g. downloaded an ubuntu distribution), you are curious to know what is inside.

The following commands show how to create a mount directory “/mnt/iso”, and use loop mount option “-o loop” to mount ISO file to mounted directory. Once it is mounted, you can get into mounted directory to see the files. Note that the mounted directory is read only.

weng@weng-u1604:/mnt/vb-win7-share$ sudo mkdir /mnt/iso
[sudo] password for weng: 
weng@weng-u1604:/mnt/vb-win7-share$ sudo mount -o loop ubuntu-14.04.3-desktop-amd64.iso /mnt/iso
mount: /dev/loop0 is write-protected, mounting read-only
weng@weng-u1604:/mnt/vb-win7-share$ losetup -a
/dev/loop0: []: (/mnt/vb-win7-share/ubuntu-14.04.3-desktop-amd64.iso)
weng@weng-u1604:/mnt/vb-win7-share$ ls /mnt/iso
autorun.inf  casper  EFI      isolinux    pics  preseed             ubuntu
boot         dists   install  md5sum.txt  pool  README.diskdefines  wubi.exe
weng@weng-u1604:/mnt/vb-win7-share$ cat /mnt/iso/md5sum.txt | grep wubi.exe
b31731ea6cdbebe1d02f8193db420886  ./wubi.exe
weng@weng-u1604:/mnt/vb-win7-share$ md5sum /mnt/iso/wubi.exe 
b31731ea6cdbebe1d02f8193db420886  /mnt/iso/wubi.exe
weng@weng-u1604:/mnt/vb-win7-share$ sudo umount /mnt/iso
weng@weng-u1604:/mnt/vb-win7-share$ 

Create ISO file

In the above example, If you need to modify some files inside ISO file, you need copy all files out from the mouted directoy to new folder, and modify as needed under new folder, and create a new ISO file using mkisofs.

weng@weng-u1604:/mnt/vb-win7-share$ sudo mount -o loop ubuntu-14.04.3-desktop-amd64.iso /mnt/iso
weng@weng-u1604:/mnt/vb-win7-share$ mkdir ~/new-iso
weng@weng-u1604:/mnt/vb-win7-share$ cp -rf /mnt/iso/* ~/new-iso/
weng@weng-u1604:/mnt/vb-win7-share$ #modify files as needed under ~/new-iso
weng@weng-u1604:/mnt/vb-win7-share$ sudo mkisofs -o ~/ubuntu-1404-rev1.iso ~/new-iso; sync
weng@weng-u1604:/mnt/vb-win7-share$ 

Create a bootable/installation USB stick from bootable ISO image

If you have a linux distribution in ISO format, and you don’t want to waste a DVD, you can simply write it into USB stick to make it as installation media. Insert USB memory stick into Linux, make sure it is detected properly by linux something like “/dev/sdb”, “/dev/sdc”. (check the output of dmesg at the end once you insert USB memory stick)

weng@weng-u1604:/mnt/vb-win7-share$ sudo dd if=ubuntu-14.04.3-desktop-amd64.iso of=/dev/sdb bs=10M; sync; sync
weng@weng-u1604:/mnt/vb-win7-share$ 

After the above command is completed, you can simply unplug, and good to go.

Linux is wonderful that you can do a lot interesting stuff!