Mount an Image (.img) File

It is possible to loop mount an image in order to inspect the filesystem without booting it. All of the .img files on Stacklet contain a single partition without an mbr or partition map, hence the offset of the filesystem is zero with respect to the file. The default filesystem type is ext4 for Linux distributions. Execute these commands as root, replacing img_file with the image you want to inspect:

# mkdir -p /mnt/loop
# mount -o loop image_file /mnt/loop
# ls -alh /mnt/loop
# umount /mnt/loop

Generally, loop mounted filesystems can be used like any other filesystem. If you want to accidentally avoid editing the filesystem use the "ro" option to mount the image read-only.


© 2010-2013 Stacklet LLC - Privacy