How to create an APFS volume inside an ordinary file

apfs

Normally in the Disk Utility you need to select a device. Is it possible to create an AFPS volume as an ordinary file in other filesystem? And if so, how would that be done?

Best Answer

You can use the Disk Utility application or a combination of the hdiutil and diskutil commands. The files can be either full images (.dmg) or sparse images (.sparseimage). You can also create a sparse bundle which is actually a folder (.sparsebundle) containing files. The sparse bundle can be used, for example, to create a 10 GB APFS drive on a physical partition that is FAT32 formatted. This would allow a person save a file greater than 4 GB on a drive/partition that was physically FAT32 formatted.

Below is an example of where the Disk Utility is used to create a 1 TB FAT32 formatted sparse image.

  1. Open the Disk Utility application.
  2. From the menu bar select File->New Image->Blank Image....
  3. Enter the following information, then click on Save.

An example of creating a 10 GB APFS sparse bundle is given below.

Note: This sparse bundle folder is created in the FAT32 sparse image from the previous example.

  1. Open the Disk Utility application.
  2. From the menu bar select File->New Image->Blank Image....
  3. Enter the following information, then click on Save.
  4. If the Disk Utility hangs after the pop up shown below appears, then Force Quit the Disk Utility.