MacOS – How to list the partition table of an unmounted disk image

command linemacos

I want to prepare Raspian Jessie found here in SD card for Biosignal Pi, instructions found here, but I have only OS X 10.11.3 El Capitan of Macbook Air 2013-mid now.
The image is in fstype format so it is not compatible with OS X.
Verifying that using the correct hash by
openssl sha1 /Users/masi/code/2016-02-26-raspbian-jessie.zip which gives

SHA1(/Users/masi/code/2016-02-26-raspbian-jessie.zip)= 4a841dffd02197548bf2329b90a0a44eeeebb4ab

which is the correct hash found in the website so not corrupted file.
However, running SHA1 on the .img returns different SHA1 than with David

masi$ openssl sha1 2016-02-26-raspbian-jessie.img
SHA1(2016-02-26-raspbian-jessie.img)= da39a3ee5e6b4b0d3255bfef95601890afd80709

One step requires me to list the partition table of an unmounted disk image. On Linux I would use fdisk -l, but OS X fdisk image.img gives

Disk: 2016-02-26-raspbian-jessie.img    geometry: 0/4/63 [0 sectors]
Signature: 0x0
         Starting       Ending
 #: id  cyl  hd sec -  cyl  hd sec [     start -       size]
------------------------------------------------------------------------
 1: 00    0   0   0 -    0   0   0 [         0 -          0] unused      
 2: 00    0   0   0 -    0   0   0 [         0 -          0] unused      
 3: 00    0   0   0 -    0   0   0 [         0 -          0] unused      
 4: 00    0   0   0 -    0   0   0 [         0 -          0] unused   

where you can see that the system does not recognise the image.
I try to mount the image 2016-02-26-raspbian-jessie.img in DiskImageMounter.app application but I get

enter image description here

Best Answer

To properly get the partition table of a (disk-)image file use:

hdiutil imageinfo /path/to/image

Example:

hdiutil imageinfo /Users/user/Downloads/2016-02-26-raspbian-jessie.img 

Backing Store Information:
    URL: file:///Users/user/Downloads/2016-02-26-raspbian-jessie.img
    Name: 2016-02-26-raspbian-jessie.img
    Class Name: CBSDBackingStore
Class Name: CRawDiskImage
Checksum Type: Ohne
Size Information:
    Total Bytes: 4029677568
    Compressed Ratio: 1
    Sector Count: 7870464
    Total Non-Empty Bytes: 4029677568
    Compressed Bytes: 4029677568
    Total Empty Bytes: 0
Format: RAW*
Format Description: Lesen/Schreiben, reine Daten
Checksum Value: 
Properties:
    Encrypted: false
    Kernel Compatible: true
    Checksummed: false
    Software License Agreement: false
    Partitioned: false
    Compressed: no
Segments:
    0: /Users/user/Downloads/2016-02-26-raspbian-jessie.img
partitions:
    partition-scheme: fdisk
    block-size: 512
    partitions:
        0:
            partition-name: Master Boot Record
            partition-start: 0
            partition-synthesized: true
            partition-length: 1
            partition-hint: MBR
            boot-code: 0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000A83FF60C0000
        1:
            partition-name: 
            partition-start: 1
            partition-synthesized: true
            partition-length: 8191
            partition-hint: Apple_Free
        2:
            partition-start: 8192
            partition-number: 1
            partition-length: 122880
            partition-hint: Windows_FAT_32
            partition-filesystems:
                FAT16: boot
        3:
            partition-start: 131072
            partition-number: 2
            partition-length: 7739392
            partition-hint: Linux_Ext2FS
    burnable: false
Resize limits (per hdiutil resize -limits):
 min     cur     max 
7870464 7870464 393749544

Tested with the original image (shasum -a1 of the never mounted img: 6a9ac027081aa38213ebe1fcf9ed502a6d6ec14e) downloaded here.

This works at least in 10.9.5 Mavericks - 10.11.3 El Capitan.