Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

HallStevenson

macrumors 6502a
Original poster
May 1, 2012
551
323
I'm trying to format a 32gb flash drive to APFS and am unable to. I'm using Terminal and the 'diskutil' command

Code:
diskutil apfs createContainer /dev/disk2s1

and it returns

Code:
Started APFS operation on disk2s1 NO NAME
Creating a new empty APFS Container
Error: -69773: A GUID Partition Table (GPT) partitioning scheme is required

This is probably related to the fact that this flash drive was originally formatted (by fdisk) in FAT32 format:

Code:
/dev/disk2 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *30.8 GB    disk2
   1:                  Apple_HFS NO NAME                 30.8 GB    disk2s1

From what I can determine, I need to get rid of 'fdisk' partition scheme container before I can proceed. Yes ? The 'gpt' commands I've tried just give me 'permission denied' errors.

How do I do this ?
 

Fishrrman

macrumors Penryn
Feb 20, 2009
29,041
13,073
You could try to format it for HFS+ (GUID) first, and then try for APFS.
If that works, let us know.
 

HallStevenson

macrumors 6502a
Original poster
May 1, 2012
551
323
I was trying that and I think that's what the 'gpt' command(s) would do but they didn't work. I don't remember exactly what it said - I'll try again - but I thought it was the "permission denied" error.

It now has that # 1 partition (?) that is HFS. Before it was FAT32 or exFAT (same thing, I recall). That alone wasn't enough though. It seems to still have an MBR that's "DOS" style.
 

HallStevenson

macrumors 6502a
Original poster
May 1, 2012
551
323
Can't you just use Disk Utility and format it that way?
It doesn't give the option for APFS .... if fdisk MBR exists on the drive*. Unless you buy a factory-formatted drive with HFS+ format, it will almost certainly have been formatted (or imaged) with DOS-style fdisk.

Solution: Remove any/all volumes or partitions or whatever they're called. On a Mac, I don't know how to do this (not saying it can't be done). I ended up using our Windows laptop, Disk Management, and removed the volume. After that, moved it to my MBA and 5-6 Apple filesystem options were available.
 

madrag

macrumors 6502
Nov 2, 2007
373
96
Even though you haven't the option for the APFS at Disk Utility, it allows you to format and change it to a GUID Partition Table; after that couldn't you try the terminal way?
 

monkeybagel

macrumors 65816
Jul 24, 2011
1,142
61
United States
You could try this to make the disk appear unformatted. First you need to get your disk device number without the partition.

Code:
sudo diskutil list

Code:
/dev/disk0 (internal, physical):

   #:                       TYPE NAME                    SIZE       IDENTIFIER

   0:      GUID_partition_scheme                        *500.3 GB   disk0

   1:                        EFI EFI                     209.7 MB   disk0s1

   2:                 Apple_APFS Container disk1         499.4 GB   disk0s2

   3:       Apple_KernelCoreDump                         655.4 MB   disk0s3


/dev/disk1 (synthesized):

   #:                       TYPE NAME                    SIZE       IDENTIFIER

   0:      APFS Container Scheme -                      +499.4 GB   disk1

                                Physical Store disk0s2

   1:                APFS Volume Macintosh HD            483.5 GB   disk1s1

   2:                APFS Volume Preboot                 22.0 MB    disk1s2

   3:                APFS Volume Recovery                520.9 MB   disk1s3

   4:                APFS Volume VM                      3.2 GB     disk1s4


/dev/disk2 (external, physical):

   #:                       TYPE NAME                    SIZE       IDENTIFIER

   0:     FDisk_partition_scheme                        *62.1 GB    disk2

   1:               Windows_NTFS U                       62.1 GB    disk2s1

The USB drive is clearly visible above as "disk2". You will not want to include the partition number, which is what "disk2s1" represents, so leave off any s# you see and only include disk2 in the example above. Your actual disk device number will almost certainly be different. Going back to my machine and my USB device number, you would first unmount the disk (not eject it) by doing the follow:
Code:
diskutil unmountDisk disk2

Then the command to wipe the first 20MB of the USB drive:

Code:
sudo dd if=/dev/zero of=/dev/disk2 bs=1m count=20

Remove the USB drive and reinsert it, and OS X should see it as an unusable drive and offer to initialize it. Then select the options you want (GUID, APFS, etc.).
 
  • Like
Reactions: ScudB

saulinpa

macrumors 65816
Jun 15, 2008
1,257
716
I have done a "sudo gpt destroy /dev/disk2" after the unmount to quickly wipe a disk.
 

Sirchief

macrumors newbie
Jun 25, 2013
6
11
I know this is an old thread - but I was looking for this answer and it turns out it is easier than I'd have thought.

In Disk Utility, near the close/minimize/fullscreen buttons, you can see a "View" mode dropdown menu. Set the view mode to "Show All Devices", then you'll see the "root" drives. Click on a root drive, and then click on the "Erase" button. Now an option to change the "Scheme" from Master Boot Record to GUID appears in the Erase subwindow and you will be free to choose the various flavors of APFS formats.

Enjoy!
 

Sciuriware

macrumors 6502a
Jan 4, 2014
735
158
Gelderland
I know this is an old thread - but I was looking for this answer and it turns out it is easier than I'd have thought.

In Disk Utility, near the close/minimize/fullscreen buttons, you can see a "View" mode dropdown menu. Set the view mode to "Show All Devices", then you'll see the "root" drives. Click on a root drive, and then click on the "Erase" button. Now an option to change the "Scheme" from Master Boot Record to GUID appears in the Erase subwindow and you will be free to choose the various flavors of APFS formats.

Enjoy!
Hi, I did as you wrote with a stick of 64Gb; I chose APFS, is that case insensitive? is that the right choice?
Now Disk Utility shows 2 devices, is that OK?
;JOOP!
 

Sciuriware

macrumors 6502a
Jan 4, 2014
735
158
Gelderland
Well, the "Sirchief" procedure turns out to be a good solution, so I applied it to all off-line storage.
No problems whatsoever.
;JOOP!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.