You can use High Sierra’s Disk Utility (or the diskutil terminal command) to manually reformat any of these to APFS, except possibly for Fusion drives. 0 John Martellaro (@john-martellaro). Diskutil partitiondisk disk0 2 gpt apfs MyAPFS 1400G jhfs+ MyJHFS+ R The EFI partition will be created automatically. If the above command was executed on a 2 TB drive, then result would be the partitioning. APFS offers a lot of advantages for SSD performance and durability, as well as encryption for any type of drive. But it’s not backwards compatible with older versions of OS X or macOS.
I purchased a 2015 Macbook Air 13. It came with Mac OS X 10.10 Yosemite. I decide to install macOS 10.14 Mojave. (I am not ready to move to 64bit only with macOS 10.15 Catalina.)
After booting from my USB flash drive containing the macOS 10.14 Mojave installer, I run the “Disk Utility” and erase the internal drive, selecting APFS (Apple File System) as the target file system. APFS is the latest file system, first supported by macOS 10.13 High Sierra.
Unfortunately, formatting as APFS is a mistake when upgrading from a very old macOS version like Yosemite.
When I proceed to install macOS 10.14 Mojave, the installer shows the internal drive as a greyed-out option. The pop-up tip on it reads “Your Mac needs a firmware update in order to install to this volume. Please select a Mac OS Extended (Journaled) volume instead”.
No problem, I think. I quit the installer and run “Disk Utility”. However, when I attempt to erase the internal drive, the only file system options shown are APFS variations.
Note: Below, “HFS+” is “Mac OS Extended” and “JHFS+” is “Mac OS Extended (Journaled)”.
A quick google search leads me to this page, How to Revert a drive from APFS back to HFS+. The main point is that if the “Disk Utility” application fails to do something, the “diskutil” (disk utilities) command line is almost always the solution.
I quit “Disk Utility” and launch the Terminal. I then run the diskutil commands below:
# Describe internal disk (usually 1st and tagged as 'internal, physical') and its partitions.
# Note the identifier for the Apple_APFS partition, which is 'disk0s2'. [-bash-3.2# diskutil list /dev/disk0 (internal, physical) #: TYPE NAME SIZE IDENTIFIER 0: GUID_partition_scheme *121.3 GB disk0 1: EFI EFI 209.7 MB disk0s1 2: Apple_APFS Container disk1 121.1 GB disk0s2 /dev/disk1 (synthesized): .. # Delete the APFS partition, which will reformat it to JHFS+ format [-bash-3.2# diskutil apfs deleteContainer /dev/disk0s2 Started APFS operation on disk1 Deleting APFS Container with all of its APFS Volumes Unmounting Volumes Unmounting Volume 'macOS' on disk1s1 Deleting Volumes Deleting Container Wiping former APFS disks Switching content types Reformatting former APFS disks Initialized /dev/rdisk0s2 as a 113 GB case-insensitive HFS Plus volume with a 16384k journal Mounting disk 1 new disk created or changed due to APFS operation Disk from APFS operation: disk0s2 Finished APFS operation on disk1
Just to be sure, I quit the Terminal and launch the “Disk Utility” application. The internal drive is now named “Untitled”. This time, I am allowed to select “Mac OS Extended (Journaled)” when erasing the internal drive. I do so.
Finally, the macOS 10.14 Mojave installer allows me to select the internal drive and the installation proceeds successfully. At the end of the process, the internal drive is formatted as APFS. Evidently, the Mojave installer updates the firmware and then converts the internal drive to APFS as part of the installation process.
Question or issue on macOS:Diskutil Erasevolume
usually creating RAM disks works with the following commands
Returns e.g. /dev/disk2
Then I would format the disk, with say
followed by mounting it:
Diskutil Repairdisk
This procedure doesn’t seem to work with APFS. I’m on High Sierra beta 9. The mount command doesn’t output any error, but the path is not mounted.
In my case, after the hdid command finished, newfs_apfs -i /dev/disk2 yields
Diskutil Partition Disk Apfs
When I then enter mount -t apfs /dev/disk2 /some/target/path then the mount commands seems to work for 2 seconds, doesn’t give any output and the mount was NOT succesful. Tsioque 1 1 2.
Can anyone tell me how to actually make a APFS RAM disk s.t. it works? :p
PS: I’ve also tried something like diskutil partitionDisk /dev/disk2 GPT APFS myvolumename 0b which does mount the volume to /Volumes/myvolumename but creates yet another disk (disk3 in this case) which seems odd to me!
How to solve this problem?Solution no. 1:
@Glyph provided the best answer in a comment to the accepted answer, but it deserves its own answer:
Change
sizeInMB to your desired size.
I’ve updated Glyph’s answer to simplify the volume name a little.
Solution no. 2:
Found a solution: Mavis beacon tutorial.
where
<format> is taken from diskutil listFilesystems from the “Personality” column. Yes, it seems weird to me too that you may have to quote this parameter, e.g. when specifying case-sensitive variants, but oh well…
<blocksize> is 2048 * desired size in megabytes
The last command formats the RAM disk and mounts it to
/Volumes/<diskname>
It seems to be the case that when now entering
diskutil list that you will see two new disks, the one hdid created, and a synthesized one.
To destroy the RAM disk again, call
diskutil eject <output path of previous hdid command> , e.g. diskutil eject /dev/disk2
This will do all the work for you, unmounting the
/Volumes/<diskname> path and destroy the two disks, releasing your memory.
Keep in mind that the minimum/maximum values for
<blocksize> depend on the chosen <format> . Also, <diskname> cannot always be chosen arbitrarily. Exemplary, FAT32 requires it to consist of upper-case letters!
Mac Diskutil Commands
Cheers!
Solution no. 3:
Also, info to delete/destroy the RAM disk needs to be corrected. ramdisk will be created at path /Volumes/’ramdisk’, so the command is:
Mac Diskutil ErasediskHope this helps!Comments are closed.
|
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2021
Categories |