Ubuntu – How to create an .img file from .iso on Ubuntu

disk-imageiso

I would like to create an .img file containing Ubuntu 13.10. I know how to get the .iso, but instructions for how to 'convert' it to .img I only found under Mac (see, for example, here) — however, I work on Ubuntu 13.10. Which are the steps necessary to create the .img file?

Background information: I would like to use the .img to run it with Complete Linux Installer on Android. Complete Linux Installer already offers .img files (see here), but they are too small. Ubuntu only "sees" the size of the .img file which is far too small to be productive — which is why I would like to create a larger .img file. Using resize2fs myImage.img 4G, I tried to make the image larger, but Ubuntu run from such an image still believes the .img is small, so my hope is that by creating a larger .img right away, Ubuntu "sees" the larger space. I know I'm on thin ice here…

Best Answer

I would take a stab in the dark, but you are trying to make an img file from an iso, right? If that's the case then there isn't any difference between iso's and img's apart the extension:

There is no difference in the structure of ISO and IMG formats if the IMG file is uncompressed. It is possible for an IMG format file to be renamed with the ISO file extension and then opened in software that only recognizes the ISO file format. This is an effective way of accessing disc information in programs that do not handle the IMG format.

(source)

Wikipedia also seems to agree:

ISO images are another type of optical disc image files, which commonly use the .iso file extension, but sometimes use the .img file extension as well. They are similar to the raw optical disc images, but contain only one track with computer data obtained from an optical disc. They can not contain multiple tracks, nor audio or video tracks. They also do not contain the control headers and error correction fields of CD-ROM or DVD sectors that raw disc images usually store. Their internal format follows the structure of an optical disc file system, commonly ISO 9660 (for CDs) or UDF (for DVDs). The CUE/BIN and CCD/IMG formats, which usually contain raw disc images, can also store ISO images instead.

So, how to convert an iso to img? Just change the extension:

rename 's/\.iso(?=[^.iso]*$)/.img/g' *

Now, to create an img, you should use dd and save it into a file called img.

Related Question