Return to site

Diskutil Partitiondisk Apfs

broken image


When buying an SSD, the last thing I want to do is use FAT32, I want to just use APFS, because I'm only using Apple devices. I've done this twice now, and it works fine, but it's not as straightforward as many web postings make it out to be. So, I'm posting this as a step-by-step.

Open Disk Utility. Make sure in the upper left, the View button, choose Show All Devices. Now you can see to erase the default drive. Feel free. Notice you don't have any APFS choices. How do we get those?

Next, you need to use Terminal. This is the hard part, but well worth it. It's not too bad.

Type:

diskutil list

This will give you a list, like this:

Diskutil apfs addVolume disk1s1 APFS newAPFS. Hdiutil create -fs APFS -size 1GB foo.sparseimage. Enhanced APIs Foundation / FileManager. Specifying diskutil partitionDisk without any argument prints help for the command. If you are using Mac OS X High Sierra or better, you may want to try out the new APFS (Apple File System) instead of Mac OS Journaled file system. Try out whether it is available.

  1. /dev/disk2 is the full path to your external drive, which you can find out by going diskutil list VIDEO where I'll put the TeslaCam folder and MUSIC is where I'll store all of my music. Diskutil partitionDisk /dev/disk2 2 MBR FAT32 VIDEO 50% FAT32 MUSIC R So you use this in place of steps 1-4 above.
  2. Diskutil erasevolume HFS+ 'ramdisk' hdiutil attach -nomount ram://4194304 for macOS = 10.13 and you are using APFS diskutil partitionDisk $( hdiutil attach -nomount ram://4194304 ) 1 GPTFormat APFS 'ramdisk' '100%'.

/dev/disk0 (internal):

#: TYPE NAMESIZE IDENTIFIER

0:GUID_partition_scheme 1.0 TB disk0

1:EFI EFI 314.6 MB disk0s1

2: Apple_APFS Container disk1 1.0 TB disk0s2

/dev/disk1 (synthesized):

Diskutil

#: TYPE NAMESIZE IDENTIFIER

0:APFS Container Scheme –+1.0 TB disk1

Physical Store disk0s2

1:APFS Volume Cambeo197.4 GB disk1s1

2:APFS Volume Preboot 19.0 MBdisk1s2

3:APFS Volume Recovery517.8 MB disk1s3

4:APFS Volume VM1.1 GB disk1s4

/dev/disk2 (external, physical):

#: TYPE NAMESIZE IDENTIFIER

0: FDisk_partition_scheme*1.0 TB disk2

1:Apple_HFS MyT51.0 TB disk2s1

Notice the last one is my external, and that's the T5. In this case, it's disk2. Note which disk number it is. I recommend you disconnect any other external drives to avoid confusion. Once you do this, it can't be undone, so be careful.

Diskutil Partition Disk Apfs

Now type, replacing the '#' with your disk number, like 'disk2', like so:

diskutil partitionDisk /dev/disk# GPT JHFS+ New 0b

Gpt Diskutil

It will do it's magic. Macos mojave git. Should only be a few seconds, maybe ten.

When that's done, you can go into Disk Utility, and select the new device. It will say it's a Container Disk, with a number. If you select it, you can now see the SSD is APFS. Now when you choose erase, the drop-down choice includes all the APFS options you didn't have before. That's it!





broken image