hdiutil compact failed - internal error

Solution 1:

Update: I was running LenovoEMC's Storage Manager in another window and had a webpage opened to the ix2-dl drive.

After closing these applications, I did a full shutdown and restarted.

This time, when I tried hdiutil compact, it worked.

Just putting this answer here for anyone who runs into a similar issue. Most of the web pages that I found during searching were related to problems with sparsebundles that used FileVault.

Solution 2:

Same issue here, I had to mount/unmount the sparsebundle volume before running hdiutil to compact it.