Skip to content

Instantly share code, notes, and snippets.

@mandeepbal
Last active July 15, 2020 20:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mandeepbal/872abb8916ae3e98a3ace848b3b4cef5 to your computer and use it in GitHub Desktop.
Save mandeepbal/872abb8916ae3e98a3ace848b3b4cef5 to your computer and use it in GitHub Desktop.
Formatting SD card with partition that mac doesn't recognize

Formatting SD card with partition that mac doesn't recognize

List Partitions

➜  ~ diskutil list                                
/dev/disk3 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *16.2 GB    disk3
   1:                  Apple_HFS Untitled                67.1 MB    disk3s1
   2:                      Linux                         16.2 GB    disk3s2

Format First Partition

➜  ~ diskutil eraseVolume JHFS+ drive /dev/disk3s1
Started erase on disk3s1 Untitled
Unmounting disk
Erasing
Initialized /dev/rdisk3s1 as a 64 MB case-insensitive HFS Plus volume with a 512k journal
Mounting disk
Finished erase on disk3s1 drive

Format Second Partition

➜  ~ diskutil eraseVolume JHFS+ drive /dev/disk3s2
Started erase on disk3s2
Unmounting disk
Erasing
Initialized /dev/rdisk3s2 as a 15 GB case-insensitive HFS Plus volume with a 8192k journal
Mounting disk
Finished erase on disk3s2 drive

Merge partitions

➜  ~ diskutil mergePartitions JHFS+ NewName disk3s1 disk3s2
Merging partitions into a new partition
     Start partition: disk3s1 drive
     Finish partition: disk3s2 drive
Started partitioning on disk3
Merging partitions
Waiting for partitions to activate
Growing disk
Finished partitioning on disk3
/dev/disk3 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *16.2 GB    disk3
   1:                  Apple_HFS drive                   16.2 GB    disk3s1

List Partitions

➜  ~ diskutil list                                         
/dev/disk3 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *16.2 GB    disk3
   1:                 Apple_HFS DRIVE                   16.2 GB    disk3s1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment