Skip to main content

Mount image files with loop dev

Mounting file systems from loop device:

losetup -f <path to .img file>
dmesg | tail -n 1 # see which loop device got allocated for the image
partprobe /dev/loopX # probe partitions
mount /dev/loopXp1 /mnt/img1/ # mount partition

Once done:

umount /mnt/img1/ # umount all mounted partitions from the image loop devices
losetup --detach /dev/loopX # get rid of loop device