2014年1月20日 星期一

Steps to mount .img

Ok, you may have a image with multi-partitions(for example, boot and rootfs )and you may need to access the data under rootfs, and, you don't want to flash this image.

The concept is you mount the partition inside the image you want and the following are steps.

1. find partition information
fdisk -l xxx.img
2. mount the partition as block device and have to specify the start address in bytes
 sudo losetup /dev/loop0 xxx.img -o $((Start Sectors*512))
3. mount it
sudo mount -t ext3 /dev/loop0 /mount/point

mount -o loop /path/to/image won't work in this case since the start byte does not contain file system information in this image type