Thursday, February 20, 2014

Adding programs to disk images

(This post is mostly taken from http://marss86.org/~marss86/index.php/FAQ)

First create a loopback device and add partition mappings
$ sudo kpartx -a your.img

Then mount the loopback device
$ sudo mount -o loop /dev/mapper/loop0p1 mnt/

In most cases the loopback device is loop01, but it could be something else, such as loop1p1.
Also, mnt/ can be any directory. This is just an example.

After mounting the device, you can access the disk image via mnt/.

When finish with accessing the image, unmount it and delete the loopback device
$ sudo umount mnt/
$ sudo kpartx -d your.img

No comments:

Post a Comment