20

I am trying to extract a .img file (hard disk image with with Chromium OS on it). I have not been able to find any way to do this other than mounting it but that is not usable because it shows up as multiple drives so I cannot repack it.

5 Answers5

18

You do not extract an .img; you mount it. Example:

mkdir /mnt/ChromeOS
mount -o loop image.img /mnt/ChromeOS/

and this will list the contents:

cd /mnt/ChromeOS/
ls -l

Mind that .img can also be zipped. If that is the case (unlikely though) you also need to gunzip it.

Rinzwind
  • 309,379
7

You can use kpartx - create device maps from partition tables

Install the package kpartx and run

sudo kpartx ...

From man kpartx:

SYNOPSIS

kpartx [-a | -d | -l] [-v] wholedisk

DESCRIPTION

This tool, derived from util-linux' partx, reads partition tables on specified device and creates device maps over partitions segments detected. It is called from hotplug upon device maps creation and deletion.

EXAMPLE

To mount all the partitions in a raw disk image:

kpartx -av disk.img

You can clone from the image file to a drive

You can clone from the .img [image] file to a drive, for example a USB pendrive, that is big enough. This is the basic intention of the file.

You can use mkusb for that purpose. It works with compressed image files too (when compressed with gzip and xz), .img.gz and .img.xz files.

After the cloning you will see the partitions for example with

sudo lsblk -f
sudo lsblk -m
sudo parted -ls

After cloning you can mount and unmount the partition(s) on the drive 'as usual'.

sudodus
  • 47,684
3

The easiest way I found to extract .img files on Ubuntu is using PEAZIP FREE ARCHIVER, through its windows(ish) GUI.

First you have to install a bunch of i386 dependencies and so you'll have to enable i386 packages too:

sudo dpkg --add-architecture i386
sudo apt update
sudo apt install libgtk2.0-0:i386 libpango1.0-0:i386 libpangox-1.0-0:i386 libpangoxft-1.0-0:i386 libxft2:i386

Then download PeaZip Package and install it or simply run:

wget https://osdn.net/dl/peazip/peazip_6.5.1.LINUX.GTK2-2_all.deb
sudo dpkg -i peazip_6.5.1.LINUX.GTK2-2_all.deb

Finally launch peazip and go through the GUI to extract .img files. (I can confirm it works on chromium os .img files for me.)

Note: You can always rely on gdebi for handling dependencies.

3

I use the MATE desktop, so I mount ISO or IMG disk images using the MATE Disk Image Mounter. MATE Disk Image Mounter is a file tree dialog that you run to select an image file to mount.

MATE Disk Image Mounter

ChanganAuto
  • 1
  • 8
  • 15
  • 23
0

Maybe you can use Etcher.io to write the image on a USB drive or SD card and work with the files and finally repack using disk-utility.

manuti
  • 46
  • 6