3

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

4
  • So you basically want to list the partition table of an unmounted disk image?
    – nohillside
    Commented Mar 16, 2016 at 17:56
  • 1
    As already mentioned, please focus on the problem you are trying to solve here. Just adding more details about missing commands etc. will not make the question more clear, as the approach required to solve the problem on OSX might be quite different from Linux (from where the instructions seem to come which you are trying to follow).
    – nohillside
    Commented Mar 16, 2016 at 18:08
  • @DavidAnderson Hardware may be corrupt. This device has been 5 times under Apple's warranty, but according to Apple, the device should be ok. Motherboard new, SSD new and OS X new. I will put this device once more to Apple if we cannot find out a logical reason for the output. Commented Mar 17, 2016 at 6:58
  • You may want to try running openssl sha1 2016-02-26-raspbian-jessie.img and compare with my results. Also, the DiskImageMounter.app is not needed. (See my Update 2) Commented Mar 17, 2016 at 9:55

4 Answers 4

8

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.

6
  • 1
    I get hdiutil: imageinfo failed - image not recognized with your first command. Do you have something additional installed? Commented Mar 16, 2016 at 19:03
  • 1
    @Masi Hmm no I have neither installed osxfuse nor Paragon drivers. Paralles/VMware is installed though.
    – klanomath
    Commented Mar 16, 2016 at 19:12
  • @Masi Have you been able to hunt down the error? You either tried to mount the image without locking it or your RAM/Processor/SSD is corrupted. Do you get any errors in the system log?
    – klanomath
    Commented Mar 17, 2016 at 12:50
  • No. I just know that some corruption error in RAM/Processor/SSD during the unzipping process. SSD is unlikely but possible. Which logs would you want to look at? Commented Mar 17, 2016 at 13:06
  • 1
    @Masi You may look in the system log for "I/O error" (SSD). RAM/Proc errors (like flipping bits) are rarely detected. It may also be a bus error. Did you try to mount the locked img (after unzipping it once more)?
    – klanomath
    Commented Mar 17, 2016 at 13:15
4

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$ 
5
  • Did you use the image of the full desktop image found here raspberrypi.org/downloads/raspbian ? Hmm, it seems to be just some part of your system. Commented Mar 16, 2016 at 19:07
  • @Masi: Yes, the full desktop image based on Debian Jessie: 2016-02-26-raspbian-jessie.zip Commented Mar 16, 2016 at 19:11
  • I provided a screenshot about what happens when attempting mounting with DiskImageMounter.app. I verified the hash and it is the same as in the website. Commented Mar 17, 2016 at 6:50
  • Your .img SHA is different than mine. Something wrong in unzipping of the system. Commented Mar 17, 2016 at 10:26
  • 1
    @Masi: Try unzipping the file again. I trying at least a dozen times on two different Macs which produced the same results. Also, your posted results from fdisk would indicate the beginning of your image file contains all zeros. I used the "Archive Utility.app" application to unzip the file. Commented Mar 17, 2016 at 10:49
0

Do you have to have it on the command line? If not, I would use Disk Utility.

2
  • I updated the body. I could not mount the image by Disk Utility. There is no such a feature as mount the .img file in the application Commented Mar 16, 2016 at 17:39
  • Ah; I didn't realize you were trying to mount an .img file. I thought you were trying to see all the partitions on the system. My mistake.
    – Tyll'a
    Commented Mar 16, 2016 at 17:50
0

UPDATE:

What you are looking to do is list all of the partitions of a disk image that you downloaded.

OS X isn't going to mount any ol' filesystem. Natively, it will mount HFS, HFS+, CDFS, FAT 16, FAT32, and ExtFAT and read/write. It will mount NTFS as read-only.

What filesystem does your image use? Since it is Linux based, it could be Ext2/3/4. Have a look at fuse-ext2 and fuse-ext4.

You can find more details here: How can I mount an ext4 file system on OS X?

Once you install the drivers for the Linux file syste, you will be able to mount the image.

2nd Update:

I want to setup Biosignal Pi system in SD card. For that, I need to prepare the card in my system.

Now that we know what you are trying to do, you don't need to mount the image, you need to copy it to your SD.

Basically, what you are going to do is

  • insert your SD Card
  • use diskutil list to list all the drives/partitions to find the SD card (it will be /dev/diskX where X is some integer). The easiest way to do this is to issue the command without the SD card inserted, and then again with it inserted and compare the output. The new entry will be your SD card.
  • use diskutil unmountDisk /dev/diskX to unmount (not eject) your SD card (so you can write to it)

  • use dd to copy the image from the file you downloaded to the SD card. Use the command: use the command: sudo dd bs=1m if=path_of_your_image.img of=/dev/diskX

  • use diskutil eject /dev/diskX to eject your SD card so you can use it in your Raspberry-Pi device.

These is the "quick guide" that gives you the essentials. Follow these more in depth instruction as provided by the Raspberry-Pi Download Page for Mac OS X: INSTALLING OPERATING SYSTEM IMAGES ON MAC OS

Those instructions are specific to the file you are attempting to install.



In your original question , you wanted to list all the partitions under OS X, just use the CLI for diskutil

$ diskutil list

/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *1.0 TB     disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:          Apple_CoreStorage iMacInternalStorage     999.3 GB   disk0s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3
/dev/disk1 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *121.3 GB   disk1
   1:                        EFI EFI                     209.7 MB   disk1s1
   2:          Apple_CoreStorage iMacInternalStorage     121.0 GB   disk1s2
   3:                 Apple_Boot Boot OS X               134.2 MB   disk1s3
/dev/disk2 (internal, virtual):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                  Apple_HFS iMac HD                +1.1 TB     disk2
                                 Logical Volume on disk0s2, disk1s2
                                 7A85AA25-03A0-4C4B-91F5-533D962DCFA1
                                 Unencrypted
10
  • I have just an image i.e. 2016-02-26-raspbian-jessie.img. How can you use your method with it? I could not mount the image in the system for some reason. I will update the body. Commented Mar 16, 2016 at 17:36
  • 1
    This answer is simply wrong. You don't need any file system (e.g hfs+ or ext4) driver to read a partition table of a disk.
    – klanomath
    Commented Mar 16, 2016 at 18:38
  • 1
    @klanomath - If it's an image written in a fstype not compatible with OS X he does. He can't read it now so that pretty much tosses your argument out a window. Secondly, I have a dual boot X Serve with OS X and FreeBSD UFS file system. OS X cannot see the multiple UFS partitions. Can't read it, period.
    – Allan
    Commented Mar 16, 2016 at 18:56
  • 1
    @Allan Just check my answer. All partitions are listed!
    – klanomath
    Commented Mar 16, 2016 at 19:00
  • 1
    @klanomath then you have something additional installed because I can't and he can't
    – Allan
    Commented Mar 16, 2016 at 19:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .