Creating iso images in linux


*Nirbhau Nirvair*
Creating iso images in linux

In windows, you can use DVD/CD burning software such as Nero to make iso images, and software like alcohol 120% or daemon tools to mount the images.

In linux, you can use the command line to both make and mount iso images.

Firstly, the program ‘dd’ which comes standard on any linux distro can be used to make an iso image.

the program syntax is relatively simple, here is an example that would make an iso image of my cdrom0 drive and save it in my home folder as backup_image.iso:

dd if=/dev/cdrom0 of=~/backup.iso

now to explain the command,

the first bit “dd” is the program name (note: dd stands for dataset definition, not data dump as it is mistakenly known as).

the next part of the command “if=/dev/cdrom0? specifies the input for the program, in this case it is the device cdrom0 (my first CD/DVD drive)

the last bit of the command “of=~backup.iso” specifies the output path and name for the program, in this case the output is a file named backup.iso that is stored in my home directory. the tilde (~) specifies the home directory.

so there you go, a relatively simple method of creating an iso file in linux. You can even put this in a bash script and have the iso file tarballed and gziped and sent off to your file server for archiving, but thats for another article to cover.

the command dd has many more options than what I have shown such as the ability to select block size and write at a certian number of bytes at a time, all these options grant dd great flexibility. Infact, you could use dd to backup entire harddrives and make 1:1 copies of their filesystems. Even damaged drives can be recovered somewhat using dd as it is low-level and works with the raw data on the drive.

Now that you know how to make iso images using dd, you will want to know how to mount them. In linux this is easily achieved using the ‘mount’ command. The first thing you will want to do however, is to create a mount point for your iso image, so as root go ahead and create a directory named iso in /mnt. try using this command if your distro supports sudo -

sudo mkdir /mnt/iso

this creates a directory named iso in your /mnt directory , we will use this directory as a mount point for out iso image.

now mount the image -

sudo mount -o loop ~backup.iso /mnt/iso

this command mounts the backup.iso file found in your home directory to the mount point /mnt/iso the -o loop part of the command allows the iso file to be treated as a block device.

now that you have mounted the iso, go to your /mnt/iso directory and you should see that the iso contents are readable and usable. :D

to unmount the iso image, type in this command :

umount ~backup.iso
Last edited by a moderator: