Mounting raw disk image


#1

I’m trying to mount a raw Armbian disk image without writing it to sd card or an usb stick with following command and getting error:

$ sudo mount -o loop Armbian_5.35_Orangepizero_Ubuntu_xenial_default_3.4.113.img /mnt/tmp
mount: wrong fs type, bad option, bad superblock on /dev/loop0,
       missing codepage or helper program, or other error

       In some cases useful info is found in syslog - try
       dmesg | tail or so. 

How can I mount the partition in the image? file output shows following information about image:

$ file Armbian_5.35_Orangepizero_Ubuntu_xenial_default_3.4.113.img
Armbian_5.35_Orangepizero_Ubuntu_xenial_default_3.4.113.img: DOS/MBR boot sector; 
  partition 1 : ID=0x83, start-CHS (0x40,0,1), end-CHS (0x3ff,3,32), 
  startsector 8192, 2834432 sectors

#2

It is quite easy but you need to skip some bytes to position on the first partition.

As you can see on the output of the file command, start sector of given image is 8192

Because of the each sector in a disk is 512 bytes, you need to skip 512x8192 = 4194304 bytes. So, exact command must be like that:

$ sudo mount -o loop,ro,offset=4194304 \
        Armbian_5.35_Orangepizero_Ubuntu_xenial_default_3.4.113.img /mnt/tmp