You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

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

hdiutil: create failed - error -5341

Hi,

I have this error on 2 Macosx Mavericks machines:

hdiutil: create failed - error -5341



This happens when I create an image larger than 100MB. Here the srcfolder is 120MB:


$ hdiutil create -srcfolder myapp.app myapp.dmg

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

hdiutil: create failed - error -5341



The solution is to specify the size on the command line




valodm:~ jedi$ hdiutil create -size 130m -srcfolder myapp.app myapp.dmg

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

created: myapp.dmg



This is disturbing because this bug breaks the munkiimport tool. When trying to import the folder in Munki, I can't specify the size of the sourcefolder, so the tool fails with the error above. The workaround is to create the dmg with the command line, and then import the dmg.

I didn't have this problem on Mountain Lion.

iMac, OS X Mavericks (10.9)

Posted on Dec 15, 2013 1:43 AM

Reply
8 replies

Jan 12, 2014 3:18 AM in response to DlacVal

This might give somebody a clue:

today I tried creating a DMG file in a script. It fails with the same error:


$ DMG_create.sh myapp.app

hdiutil create -size 130m -srcfolder myapp.app myapp.dmg

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

hdiutil: create failed - error -5341


And the funny thing is that if I type the exact same command directly in my terminal (in fact, copy/paste the command from previous output of the script), it works:


$ hdiutil create -size 130m -srcfolder myapp.app myapp.dmg

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

created: myapp.dmg

Jun 29, 2014 4:57 AM in response to s-car-go

It is interesting that I just ran into this same problem after having done many dmg files previously. The file size was similar, about 520 MB. I tried several times to made the dmg file using Disk Utility and kept getting the same error. Next, I added another file to the folder I was trying to convert into the dmg making it about 600 MB and the dmg was produced with out the error -5341. I wonder if there is size of file that is causing the problem. Seems like a bug.

Apr 4, 2015 6:40 AM in response to Conor Schutzman

Maybe size does matter?


I once had a similar (maybe the same) error a while ago when I was creating disk images as backups of folders using Disk Utility. I eventually split the source folder into two folders and Disk Image was able to create the dmg file properly.


Fast forward. I use hdiutil to do the same task now in a more automated way from a bash script. I just ran the script on 25 folders. 23 of them were archived into dmg files as expected. Two failed with the -5341 error.


I edited one of the files in one of the folders slightly, reducing the file size by about 3%, ran the script again and it worked properly.


I modified a file in the other folder that hdiutil failed on the first time and, again, it worked.


There is no .Trash in either folder.


Neither folder was anywhere near 520 mb. They were different sizes (~130 mb and ~260 mb).


Conclusion: either there was something in those files, or on the area of the SSD that those files were sitting on, that was giving hdiutil a problem, or there is something with various sizes of dmg files that brings out a bug in hdituil.

hdiutil: create failed - error -5341

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