How to create the disk image file which is able to mount on APFS unsupported OS

CLI

The default file system of the macOS is changed to APFS since macOS High Sierra 10.13. The file system of the disk image file which is created by the Disk Utility had been changed to APFS also.

They are not able to mount on earlier OS than macOS 10.13 which not supports APFS.

This article how to create the disk image file with specify the file system.

スポンサーリンク

Creating the disk image file

To create the disk image file, you can following way:

  • Use the Disk Utility
  • Use the hdiutil

To specify the file system, use hdiutil to create the disk image file.

Creating the disk image file with hdiutil

To create the disk image file with hdiutil, enter the following line in the Terminal.

$ hdiutil create -srcfolder Test -fs HFS+ Test.dmg

The first argument is an action. The create specify create the disk image file.

The -srcfolder option specify the source folder which contains files and folders are copied into the disk image. Above example specify the Test folder in the current directory.

The -fs option specify the file system. The HFS+ is a default system which had been used until macOS 10.12.

The last argument is a disk image file. Above example creates the Test.dmg file.

The file system you can specify

The file system you can specify is not only HFS+. You can specify following values. If the value is composed of multiple words, surround with “”.

  • UDF
  • MS-DOS FAT12
  • MS-DOS
  • MS-DOS FAT16
  • MS-DOS FAT32
  • HFS+
  • Case-sensitive HFS+
  • Case-sensitive Journaled HFS+
  • Journaled HFS+
  • ExFAT
  • Case-sensitive APFS
  • APFS

Checking the file system of the disk image

To check the file system of the disk image, mount it or use hdiutil.

Check by mount

Do following steps.

  1. Mount the disk image file in the Finder.
  2. Select the mounted volume and select “Get Info” from the “File” menu.
  3. Check the “Format”.

“Mac OS Extended” indicates the file system is HFS+.

Check with hdiutil

To check with `hdiutil`, specify the `imageinfo` to the action.

$ hdiutil imageinfo Test.dmg

The `Test.dmg` is a file you want to check. Check the “Partition Information” from the output.

Partition Information:
	3:
		Name: disk image(Apple_HFS: 4)
		Partition Number: 3
		Checksum Type: CRC32
		Checksum Value: $3E471B93
	4:
		Name: (Apple_Free: 5)
		Partition Number: 4
		Checksum Type: CRC32
		Checksum Value: $00000000
	0:
		Name: GPT Header(Primary GPT Header: 1)
		Partition Number: 0
		Checksum Type: CRC32
		Checksum Value: $CEBAB25D
	5:
		Name: GPT Partition Data(Backup GPT Table: 6)
		Partition Number: 5
		Checksum Type: CRC32
		Checksum Value: $023D8A03
	1:
		Name: GPT Partition Data(Primary GPT Table: 2)
		Partition Number: 1
		Checksum Type: CRC32
		Checksum Value: $023D8A03
	6:
		Name: GPT Header(Backup GPT Header: 7)
		Partition Number: 6
		Checksum Type: CRC32
		Checksum Value: $E51B930E
	-1:
		Name: Protective Master Boot Record(MBR: 0)
		Partition Number: -1
		Checksum Type: CRC32
		Checksum Value: $81A8883E
	2:
		Name: (Apple_Free: 3)
		Partition Number: 2
		Checksum Type: CRC32
		Checksum Value: $00000000

You can see many partitions are contained in the disk image. The Name of the number 3 is disk image (APPLE_HFS: 4) that you can know the file system is HFS+ from that.

For example, if the file system is FAT16, hdiutil output following:

Partition Information:
	-1:
		Name: Master Boot Record(MBR: 0)
		Partition Number: -1
		Checksum Type: CRC32
		Checksum Value: $60F9AB31
	0:
		Name: (DOS_FAT_16: 1)
		Partition Number: 0
		Checksum Type: CRC32
		Checksum Value: $E6119278

The Name is DOS_FAT_16: 1, which indicates the file system is FAT16.

スポンサーリンク
最新情報をチェックしよう!
>現役のプログラマーが書くプログラミング情報

現役のプログラマーが書くプログラミング情報

日々の開発の中での学びや分かったこと、調べたことなどを書いていくブログです。

CTR IMG