ghw icon indicating copy to clipboard operation
ghw copied to clipboard

On macOS the disk size is wrong

Open Migulon opened this issue 4 years ago • 3 comments

It's doubled. Strange. For block storage.

Migulon avatar Jul 30 '21 01:07 Migulon

So I know this is a kinda old issue but just ran into this issue as well. Looks to be because of the way diskutil reads the drives from MacOS. When I run the diskutil list i get 3 total drives, one being marked as (internal, physical). Which seems to be the right one, and then a second one marked (synthesized), which seems to be something that occurs because of the APFS filesystem. It was introduced in macOS 10.12.4

Here is the output

/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *500.3 GB   disk0
   1:                        EFI ⁨EFI⁩                     314.6 MB   disk0s1
   2:                 Apple_APFS ⁨Container disk1⁩         500.0 GB   disk0s2

/dev/disk1 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +500.0 GB   disk1
                                 Physical Store disk0s2
   1:                APFS Volume ⁨Macintosh HD - Data⁩     458.4 GB   disk1s1
   2:                APFS Volume ⁨Preboot⁩                 476.1 MB   disk1s2
   3:                APFS Volume ⁨Recovery⁩                1.1 GB     disk1s3
   4:                APFS Volume ⁨VM⁩                      3.2 GB     disk1s4
   5:                APFS Volume ⁨Macintosh HD⁩            15.7 GB    disk1s5
   6:              APFS Snapshot ⁨com.apple.os.update-...⁩ 15.7 GB    disk1s5s1

/dev/disk2 (disk image):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        +838.9 MB   disk2
   1:                  Apple_HFS ⁨FontForge⁩               838.8 MB   disk2s1

I will try and look into if its possible to see from diskutil list -plist which one is the right one

rareinator avatar Dec 01 '21 17:12 rareinator

Hi @rareinator and @Migulon! sorry for the delay in looking into this, and thank you @rareinator for providing some hints as to why this is happening on MacOS. I don't have a Mac handy at this point to experiment with, unfortunately, which is part of the reason why Mac support in ghw is so much behind Linux and Windows.

jaypipes avatar Dec 02 '21 14:12 jaypipes

Hi, @jaypipes yeah no worries 😃 I looked into it a bit last night and from what I could gather it seems that the -plist option returns the APFS scheme with a key called APFSPhysicalStores. If you need anything else from me you can always reach out, I can also upload the entire output on Pastebin or something😃

rareinator avatar Dec 02 '21 16:12 rareinator