Creating and mounting ISO images in Linux terminal

There are thousand of applications outside for creating ISO images, and also a thousand for mounting and reading these virtual disks - but, have you ever thought that it's possible through the Linux terminal, by using 2 simple commands? You'll need 2 core applications: dd (DiskDump) and mount. These small applications are core components in every Linux distribution, so you don't need to install anything. So, how to create ISO image with them?
Insert a disk into your optical drive - of course it's also possible to create ISO image from an USB disk. Open the terminal window, and execute:
dd if=/dev/sr0 of=test.iso

where if points to your optical drive (input file), of is the patch, where the ISO image will be created (output file).
Now, our ISO image is done, lets go mount it! The first thing what we need is a mount point for our ISO image. Lets create one:
mkdir isoTmp

this will be the name of the directory where the ISO image will be mounted. Now mount the ISO with the command (only root can mount so you need superuser rights - and his password :)):
sudo mount -o loop test.iso isoTmp/

where the -o specifies that our device is a loop device, after that comes the patch for the .iso file, and finally the directory where we mount this ISO image. After executing this command the image will be mouted, and you can browse it on the local filesystem.
You can unmount it by executing:
sudo umount tmpMnt/
.

For more information about filesystems, and other specific options type:
man mount

in terminal.
Happy hacking! :)

0 comments: