I recently formatted all my external drives to APFS.
The result was this:
diskutil list /dev/disk3 (internal, physical): #TYPE NAME SIZE IDENTIFIER 0: GUID_partition_scheme *500.1 GB disk3 1: EFI EFI 209.7 MB disk3s1 2: Apple_APFS 499.8 GB disk3s2
There is no container, seems to be just the raw APFS. I didn't notice. I could write to the disk, all was fine. Until I rebooted. Now, it's unmountable, unrepairable with disk utility.
Today I upgraded to MacOS 10.13.1 and repeated the same thing on an USB stick:
/dev/disk9 (synthesized): #: TYPE NAME SIZE IDENTIFIER 0: APFS Container Scheme - +64.3 GB disk9 Physical Store disk6s2 1: APFS Volume tester 978.9 KB disk9s1
Clearly, it works correctly, with container, all fine, after the patch.
I was foolish enough to entrust data to the 500GB partition... desperately trying to find a way now, to make the data readable. diskutil man page explains, you can create a container, add a NEW device, add a volume, but no way apparently to add an existing "APFS physical store" to an existing container. If I could create a new container and add this raw device, maybe it works, maybe not, but I couldn't find any option for that.
I wrote myself a bash script to get rid of another APFS bug, that prevented diskutil from formatting a disk:
### sudo ./format.sh disk5 DATA1 diskutil list | grep $1 echo "Name: $2" sleep 10 diskutil unmountDisk force $1 sudo dd if=/dev/zero of=/dev/$1 bs=1024 count=1024 diskutil partitionDisk $1 GPT JHFS+ "$2" 0g
So this creates a journaled HFS+ filesystem with GPT table, after which disk utility offers all FS to format onto it.
I'm grateful for any hints or ideas, on how to make this device readable again. Creating an image with dd or other tool of the raw device might not work either, since man pages explained about APFS, it needs it's container to be readable. But was does the container store, besides a "link" to it ?