hdiutil notes: Difference between revisions

From ihaveahax's Site
Jump to navigationJump to search
No edit summary
Line 21: Line 21:
Currently the only way I found around this is to manually copy the files in Finder. Maybe there's another command-line tool to preserve this data. Either way though, it means the disk image needs to be manually created with the right size.
Currently the only way I found around this is to manually copy the files in Finder. Maybe there's another command-line tool to preserve this data. Either way though, it means the disk image needs to be manually created with the right size.


== Remnants of a Nintendo 3DS EmuNAND/RedNAND likely confuse hdiutil ==
== FAT32 partition created by EmuNAND9 somehow confuses hdiutil ==
Any time I've tried to create an image from an SD card that likely once had an EmuNAND or RedNAND on it has caused it to exit with <code>hdiutil: create failed - error -4</code>. Same if I created an image with dd and then tried to use hdiutil on it. Though I don't think this SD card had an EmuNAND on it, it could just be how EmuNAND9 once formatted it.
Any time I've tried to create an image from a FAT32 partition that was created by some version of EmuNAND9 caused hdiutil to exit with <code>hdiutil: create failed - error -4</code>. I thought it was due to an EmuNAND or RedNAND once existing, but I found out it happens even if I try to do so with just the partition.


This error is so weird and rare that I couldn't find anyone else with it through Google. I guess I shouldn't expect hdiutil to work with weird non-standard setups though.
This error is so weird and rare that I couldn't find anyone else with it through Google. I guess I shouldn't expect hdiutil to work with weird non-standard setups though.

Revision as of 06:25, 8 March 2021

Notes and other random things related to the macOS hdiutil command.

Create a loop device

Similar to losetup for Linux, this allows setting up a loop device for any file. Usually hdiutil tries to determine how to attach the file based on the file extension and contents.

hdiutil attach -imagekey diskimage-class=CRawDiskImage -nomount myfile.bin

Create a RAM drive

Create a RAM drive. The value is the amount of 512-byte sectors, so 8388608 * 512 = 4294967296 or 4.0 GiB.

The drive is not pre-formatted, therefore -nomount is required, or else hdiutil will newly-created drive will be scanned for partitions, find none because it's completely blank, and cancel attaching.

hdiutil attach -nomount ram://8388608

After attaching it can be formatted with any tool, such as diskutil, Disk Utility, or newfs_*.

create -srcfolder doesn't preserve creation time

Still does this as of Big Sur. Creation time is reset to modified time. This isn't really an issue unless you're like me and want to preserve as much info as possible.

Currently the only way I found around this is to manually copy the files in Finder. Maybe there's another command-line tool to preserve this data. Either way though, it means the disk image needs to be manually created with the right size.

FAT32 partition created by EmuNAND9 somehow confuses hdiutil

Any time I've tried to create an image from a FAT32 partition that was created by some version of EmuNAND9 caused hdiutil to exit with hdiutil: create failed - error -4. I thought it was due to an EmuNAND or RedNAND once existing, but I found out it happens even if I try to do so with just the partition.

This error is so weird and rare that I couldn't find anyone else with it through Google. I guess I shouldn't expect hdiutil to work with weird non-standard setups though.

Works fine with an SD card formatted with GodMode9.