Apple Intelligence is now available on iPhone, iPad, and Mac!

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Encountered a strange error when using hdiutil to create a dmg file in OSX 10.7.5

Hello all,


I encountered a very strange issue that when I use hdiutil to create a dmg file in OS 10.7.5. My commands and the result as below.


/usr/bin/hdiutil create -ov -fs HFS+ -srcfolder "/dummy/myApp" "myApp.dmg"

......................................................................

diskimages-helper: resize request is above maximum size allowed.

hdiutil: create failed - Invalid argument


The total size of myApp is about 200MB, so I don't think it is above maximum size allowed. Another very interesting thing is if I double click the myApp folder to create a temp file .DS_Store in myApp, then re-run the commands and it works. Does anyone know why it is or how to fix it?


Thanks,

-xixu


iMac, Mac OS X (10.7.5)

Posted on Jan 16, 2013 5:25 AM

Reply
7 replies

Jun 18, 2013 1:51 PM in response to xixu

I have encountered the same problem on 10.8.


By adding the -debug flag, I see that hdiutil is trying to grow the DMG by 2 blocks (1 KB) after copying all of the files in. I wonder if this is for alignment purposes? I have not tried playing with alignment settings.


The empty file trick worked. I used .Trash, though if I then add -scrub to the command line, the problem returns.


I eventually settled on working around this by adding -stretch 1g to the command line. Interestingly, -stretch 4g did not help.


It would be nice if Apple would have a look at this issue and confirm whether this is a bug or expected behaviour.

May 28, 2015 4:05 PM in response to xixu

I'm even later to the party:


You can optionally specify a '-size' parameter when you invoke hdiutil. If you specify a size large enough that the disk image doesn't need to be resized during .dmg creation, it seems you can avoid this error.

E.g.:

hdiutil create -size 240m -fs HFS+ -srcfolder test -volname Test test.dmg

Encountered a strange error when using hdiutil to create a dmg file in OSX 10.7.5

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.