2

My 16 GB USB flash drive works perfectly on Windows and Ubuntu OS. On plugging into my Macbook Pro, I don't see it fully mounted. On running

$ diskutil list

I see the following output

/dev/disk5 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     Apple_partition_scheme                        *15.4 GB    disk5
   1:        Apple_partition_map ⁨⁩                        4.1 KB     disk5s1
                    (free space)                         2.5 GB     -
   2:                  Apple_HFS ⁨⁩                        2.5 MB     disk5s2

[edit below]

$ diskutil info disk5
   Device Identifier:         disk5
   Device Node:               /dev/disk5
   Whole:                     Yes
   Part of Whole:             disk5
   Device / Media Name:       Ultra

   Volume Name:               Not applicable (no file system)
   Mounted:                   Not applicable (no file system)
   File System:               None

   Content (IOContent):       Apple_partition_scheme
   OS Can Be Installed:       No
   Media Type:                Generic
   Protocol:                  USB
   SMART Status:              Not Supported

   Disk Size:                 15.4 GB (15376000000 Bytes) (exactly 30031250 512-Byte-Units)
   Device Block Size:         512 Bytes

   Media OS Use Only:         No
   Media Read-Only:           No
   Volume Read-Only:          Not applicable (no file system)

   Device Location:           External
   Removable Media:           Removable
   Media Removal:             Software-Activated

   Solid State:               Info not available
   Virtual:                   No

Any help is appreciated, thanks!

[Edit #2] Solved:

Creating a new partition table using a partition manager solved the problem. (I used KDE Partition Manager in Arch Linux)

3
  • Is this correct? You have a 16GB drive formatting with an Apple partition scheme and it can be read in Windows and Linux but not Apple? How was this drive created? Can you add the output of diskutil info disk5 with an edit?
    – Allan
    Commented Aug 27, 2023 at 23:26
  • Hi @Allan I had formatted the USB drive on my Windows PC using Disk Management utility and it worked fine. Once I plugged it into my Mac I saw the error "The disk you attached was not readable by this computer" Commented Aug 27, 2023 at 23:50
  • 4
    I can't speak to how MS Disk Management formatted an Apple partition scheme, but I would back things up on your Windows/Linux box, then reformat it on macOS using a FAT32 file system for reliable compatibility. I've had excellent success with that path.
    – Allan
    Commented Aug 27, 2023 at 23:56

2 Answers 2

2

The Short Answer

You probably can fix your problem by entering the command below. To understand what "probably" means, you would probably need to read the rest of this answer.

dd if=/dev/zero count=1 seek=1 of=/dev/disk5

The Long Answer

A drive can contain both a Master Boot Record (MBR) scheme and an Apple Partition Map (APM) scheme simultaneously. When this happens, Windows (and PC firmware) will choose the MBR scheme and ignore the APM scheme. On the other hand, macOS/OS X (and Intel Mac firmware) does the opposite and chooses the APM scheme over the MBR scheme.

Usually, when both schemes are deliberately applied to the same drive, this is done in a way where conflicts are avoided. Since the volume contained by the partition of type Apple_HFS is not mounting, you probably have a conflict which resulted in the volume at least being partially corrupted.

Below is an example using 2013 iMac running Catalina and a HP PC running Windows 11.

I started by plugging a 16 GB flash drive into the Mac and then used the Disk Utility to erase the flash drive. The following was chosen.

Next, I ejected and plug the flash drive into the PC. Windows Disk Management shown this flash drive to be Disk 1, as seen below.

I delete the volume shown and creating a new volume using the default size. The following was chosen.

The result is shown below.

Next, I copied a file named scratch.txt to the flash drive. This file is sufficiently large enough to at least overwrite the header of the JHFS+ volume named MyJHFS+. The result is shown below.

I ejected and returned the flash drive to the Mac. Below is the output from the command diskutil list external that pertains to the flash drive. You can tell the Apple_HFS type volume did not mount, because the name MyJHFS+ is missing.

/dev/disk4 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     Apple_partition_scheme                        *15.9 GB    disk4
   1:        Apple_partition_map                         32.3 KB    disk4s1
   2:                  Apple_HFS                         15.7 GB    disk4s3

Below is the output from the command sudo fdisk /dev/disk4. This output shows the MBR Partition Table which is stored in sector 0 and was created by Windows 11.

Disk: /dev/disk4    geometry: 1929/255/63 [30998528 sectors]
Signature: 0xAA55
         Starting       Ending
 #: id  cyl  hd sec -  cyl  hd sec [     start -       size]
------------------------------------------------------------------------
 1: 0C    0  32  33 - 1023 254  63 [      2048 -   30994432] Win95 FAT32L
 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      

Note that sectors 1 through 2047 are unallocated. Typically, this is done to reserve space required for a legacy GRUB install.

Below is the output from the command sudo pdisk -l /dev/disk4. This output shows the APM which is stored in sectors 1 through 63 and was created by macOS Catalina.

Partition map (with 512 byte blocks) on '/dev/disk4'
 #:                type name     length   base     ( size )
 1: Apple_partition_map Apple        63 @ 1       
 2:          Apple_Free          262144 @ 64       (128.0M)
 3:           Apple_HFS        30736304 @ 262208   ( 14.7G)
 4:          Apple_Free              16 @ 30998512

Device block size=512, Number of Blocks=30998528 (14.8G)
DeviceType=0x0, DeviceId=0x0

The table below summarizes the locations of the partition tables and volumes. Note that the locations of the partition tables are not in conflict, but the volumes defined in these tables definitely are.

Use Type Name Start
Sector
End
Sector
Size in
Secors
MBR Partition Table FDisk_partition_scheme 0 0 1
APM Table Apple_partition_map 1 63 63
FAT32 Volume Windows_FAT_32 MYFAT32 2048 30996479 30994432
Mac OS Extended (Journaled) Volume Apple_HFS MyJHFS+ 262208 30998511 30736304

Since the MyJHFS+ volume failed to mount, the MYFAT32 volume was not be damaged by macOS. Therefore zeroing out the APM table would result in macOS using the MBR partition table. Actually, zeroing out the first sector would be sufficient. This can be done by using the command given below.

sudo dd if=/dev/zero count=1 seek=1 of=/dev/disk4

Below is the new output from the command diskutil list external that pertains to the flash drive. This was observed after entering the above command.

/dev/disk4 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *15.9 GB    disk4
   1:             Windows_FAT_32 MYFAT32                 15.9 GB    disk4s1

Below is a Finder view of the mounted FAT32 volume named MYFAT32. enter image description here

How to Prevent Two Partition Tables

Simply use the Windows diskpart command to clean the drive before using Windows Disk Management. See the example shown below.

C:\Users\david>diskpart

Microsoft DiskPart version 10.0.22621.1

Copyright (C) Microsoft Corporation.
On computer: HPWINDOWS11

DISKPART> list disk

  Disk ###  Status         Size     Free     Dyn  Gpt
  --------  -------------  -------  -------  ---  ---
  Disk 0    Online          931 GB   256 GB        *
  Disk 1    Online           14 GB      0 B

DISKPART> select disk 1

Disk 1 is now the selected disk.

DISKPART> clean

DiskPart succeeded in cleaning the disk.

DISKPART> exit

Note: The clean command does remove all volumes on the drive.

1
  • Thank you for the detailed answer. The dd command didn't help remove the data. However, creating a new partition table helped! +1 Commented Sep 5, 2023 at 2:02
0

Creating a new partition table using a partition manager solved the problem. (I used KDE Partition Manager in Arch Linux)

You must log in to answer this question.

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