3

Creating a raw image with an APFS filesystem in it is pretty straight-forward:

$ hdiutil create -megabytes 1 -layout NONE -fs apfs -volname unicode unicode.dmg
created: /Users/daniel/test/apfs/unicode.dmg

Now I want to put files in it for a particular test I'm trying to perform, but I can't seem to attach it:

$ hdiutil attach unicode.dmg 
hdiutil: attach failed - no mountable file systems

Diagnostics:

$ hdiutil imageinfo unicode.dmg 
nx_kernel_mount:1366: checkpoint search: largest xid 2, best xid 2 @ 3
nx_kernel_mount:1366: checkpoint search: largest xid 2, best xid 2 @ 3
nx_kernel_mount:1366: checkpoint search: largest xid 2, best xid 2 @ 3
nx_kernel_mount:1366: checkpoint search: largest xid 2, best xid 2 @ 3
nx_kernel_mount:1366: checkpoint search: largest xid 2, best xid 2 @ 3
nx_kernel_mount:1366: checkpoint search: largest xid 2, best xid 2 @ 3
Backing Store Information:
    URL: file:///Users/tester/test/apfs/unicode.dmg
    Name: unicode.dmg
    Class Name: CBSDBackingStore
Class Name: CRawDiskImage
Checksum Type: none
Size Information:
    Total Bytes: 1048576
    Compressed Ratio: 1
    Sector Count: 2048
    Total Non-Empty Bytes: 1048576
    Compressed Bytes: 1048576
    Total Empty Bytes: 0
Format: UDRW
Format Description: raw read/write
Checksum Value: 
Properties:
    Encrypted: false
    Kernel Compatible: true
    Checksummed: false
    Software License Agreement: false
    Partitioned: false
    Compressed: no
Segments:
    0: /Users/tester/test/apfs/unicode.dmg
partitions:
    partition-scheme: none
    block-size: 512
    appendable: false
    partitions:
        0:
            partition-name: whole disk
            partition-start: 0
            partition-synthesized: true
            partition-length: 2048
            partition-hint: unknown partition
            partition-filesystems:
                APFS: Untitled
    burnable: false
Resize limits (per hdiutil resize -limits):
 min     cur     max 
2048    2048    2048

The output here seems iffy because the block size and volume label are wrong. So I'm not sure what's going on. Is APFS one of those things that only mounts under some specific condition? If so, what condition? Or is there a way to work around it to mount this one image I already have?

Hakanai
  • 173
  • 9
  • 1 megabyte might be a bit small for an APFS image. Try something larger, like 1024 megabytes. Seems APFS doesn’t like `-layout NONE`. I was able to create and mount an image with `-layout GPTSPUD` (and a larger size too) – Martin Maciaszek Mar 09 '18 at 11:02
  • Nuts... the actual sample data I have to work with is a raw disk image, so now I might have to do further workarounds to pull it back out of the partition table after I"m done putting data into it. – Hakanai Mar 11 '18 at 22:20
  • The layout appears to be enough (it still allowed 1MB) – Hakanai Mar 13 '18 at 23:19

0 Answers0