Skip to content

Instantly share code, notes, and snippets.

@dsmith73
Last active June 22, 2020 23:45
Show Gist options
  • Save dsmith73/e1a2fc1f293b344a0830cb3d3d462deb to your computer and use it in GitHub Desktop.
Save dsmith73/e1a2fc1f293b344a0830cb3d3d462deb to your computer and use it in GitHub Desktop.

Deleting volume(s) on a flash drive from MAC terminal

I found myself searching for this a few times over the course of a couple days... So, it's time to make a small gist and "commit it to memory.".

This was the one that I liked the most -

diskutil list


/dev/disk3 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *32.0 GB    disk3
   1:             Windows_FAT_32 USB20FD                 32.0 GB    disk3s1



diskutil partitionDisk /dev/disk3 1 GPT HFS+ newdisk R


Started partitioning on disk3
Unmounting disk
Creating the partition map
Waiting for partitions to activate
Formatting disk3s2 as Mac OS Extended with name newdisk
Initialized /dev/rdisk3s2 as a 29 GB case-insensitive HFS Plus volume
Mounting disk
Finished partitioning on disk3
/dev/disk3 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *32.0 GB    disk3
   1:                        EFI EFI                     209.7 MB   disk3s1
   2:                  Apple_HFS newdisk                 31.7 GB    disk3s2

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