APFS - USB flash drive

Discussion in 'macOS High Sierra (10.13)' started by HallStevenson, Jul 4, 2017.

  1. HallStevenson macrumors 6502a

    HallStevenson

    Joined:
    May 1, 2012
    #1
    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 ?
     
  2. Fishrrman macrumors G5

    Fishrrman

    Joined:
    Feb 20, 2009
    #2
    You could try to format it for HFS+ (GUID) first, and then try for APFS.
    If that works, let us know.
     
  3. HallStevenson thread starter macrumors 6502a

    HallStevenson

    Joined:
    May 1, 2012
    #3
    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.
     
  4. gmanist1000 macrumors 68030

    gmanist1000

    Joined:
    Sep 22, 2009
    #4
    Can't you just use Disk Utility and format it that way?
     
  5. HallStevenson thread starter macrumors 6502a

    HallStevenson

    Joined:
    May 1, 2012
    #5
    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.
     
  6. madrag macrumors 6502

    Joined:
    Nov 2, 2007
    #6
    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?
     
  7. monkeybagel macrumors 65816

    Joined:
    Jul 24, 2011
    Location:
    United States
    #7
    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.).
     
  8. saulinpa macrumors 6502a

    Joined:
    Jun 15, 2008
    #8
    I have done a "sudo gpt destroy /dev/disk2" after the unmount to quickly wipe a disk.
     
  9. MacPro 2018 macrumors newbie

    Joined:
    Dec 12, 2017
    #9
    monkeybagel, This worked perfectly for me. Thanks for the excellent instructions.

     
  10. Sirchief macrumors newbie

    Joined:
    Jun 25, 2013
    #10
    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!
     

Share This Page