How can I list the partition table of an unmounted disk image?
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
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.
Update 2
Actually, there is no need to use the DiskImageMounter.app. The fdisk
command can be used directly on the .img file. In other words, the command
fdisk 2016-02-26-raspbian-jessie.img
produces the same results as when I executed fdisk /dev/disk2
. When I run the command
openssl sha1 2016-02-26-raspbian-jessie.img
I get the results shown below.
SHA1(2016-02-26-raspbian-jessie.img)= 6a9ac027081aa38213ebe1fcf9ed502a6d6ec14e
I also have a (21.5-inch, Mid 2011) iMac running El Capitan OS X 10.11.3. The results using this computer are the same.
Note that if the 2016-02-26-raspbian-jessie.img
file is mounted using the DiskImageMounter.app application, the hex value produced by openssl sha1 2016-02-26-raspbian-jessie.img
changes. This would indicate the image file is not mounted readonly.
Update 1
Since I also have El Capitan OS X 10.11.3 installed on my (20 inch, mid 2007) iMac, I can verify against your machine. Using the command
openssl sha1 2016-02-26-raspbian-jessie.zip
the result is
SHA1(2016-02-26-raspbian-jessie.zip)= 4a841dffd02197548bf2329b90a0a44eeeebb4ab
which is the same as your results. The rest is the same as shown below when I used Yosemite.
Original Answer
I am using Yosemite OS X 10.10.5.
I downloaded 2016-02-26-raspbian-jessie.zip
.
Using the Finder application, I right clicked on this file and selected the open with "Archive Utility.app". This created 2016-02-26-raspbian-jessie.img
.
Using the Finder Application, I right clicked on 2016-02-26-raspbian-jessie.img
and selected open with DiskImageMounter.app. This mounted at the image as /dev/disk2
on my Mac.
Here is what is in the the file you downloaded.
Steelhead:~ davidanderson$ fdisk /dev/disk2
Disk: /dev/disk2 geometry: 976/128/63 [7870464 sectors]
Signature: 0xAA55
Starting Ending
#: id cyl hd sec - cyl hd sec [ start - size]
------------------------------------------------------------------------
1: 0C 0 130 3 - 8 40 32 [ 8192 - 122880] Win95 FAT32L
2: 83 8 40 33 - 489 232 63 [ 131072 - 7739392] Linux files*
3: 00 0 0 0 - 0 0 0 [ 0 - 0] unused
4: 00 0 0 0 - 0 0 0 [ 0 - 0] unused
Steelhead:~ davidanderson$ diskutil list /dev/disk2
/dev/disk2
#: TYPE NAME SIZE IDENTIFIER
0: FDisk_partition_scheme *4.0 GB disk2
1: Windows_FAT_32 boot 62.9 MB disk2s1
2: Linux 4.0 GB disk2s2
Steelhead:~ davidanderson$