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...

  • askubuntu.com/questions/243628/cant-convert-iso-to-img-on-mac May help you? – user101351 Dec 8 '13 at 21:08
  • I don't think so. It is (again) either based on Mac OS X (with hdiutils) or simply suggest to rename the .iso to .img (which I doubt is the correct approach). – Marius Hofert Dec 8 '13 at 21:41
  • 1
    Question does not make sense. The image files you linked appear to be already installed systems ready to run. You don't use the iso image to install Ubuntu into one of them. – psusi Dec 9 '13 at 4:19
  • My goal is to exactly get such an .img, just 'larger'. I thought one starts with the .iso (?) – Marius Hofert Dec 9 '13 at 6:27

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.


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.

  • Thank you for helping, Braiam. If renaming is the solution, why does this not work for people on Mac OS X (who use hdiutils for this; see the link of UncleNerdicus)? Concerning your last line, can you post more details about this? – Marius Hofert Dec 9 '13 at 16:34
  • @MariusHofert he's doing it wrong. Umm.. the last line only renames files that contains .iso to .img. I need it to make that only match the last .iso. Update – Braiam Dec 9 '13 at 17:07
  • Okay, thanks. So I just rename the .iso to .img. How do you then create an .img of, say, 6GB? With resize2fs? Well, that might be a new question, but I hope you know the answer, too. – Marius Hofert Dec 9 '13 at 17:31
  • @MariusHofert you can "create" a img file with dd. img are just a exact copy of every block of a filesystem. – Braiam Dec 9 '13 at 17:39
  • The syntax of dd is: dd if=infile.img of=outfile.img. I don't see how one could choose the size of outfile.img with dd (?). And if I use resize2fs, it seems that the (larger) file size is not 'seen'... – Marius Hofert Dec 9 '13 at 18:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.