31

When trying to convert or resize a dmg image I get the error:

hdiutil: convert failed Resource Temporarily Unavailable error

or

hdiutil: resize: failed. Resource temporarily unavailable (35).

(hdiutil error code 35).

0
45

The problem appears to happen when you unmount the image using umount.

Remount the image (either using hdiutil attach or just double click the image) and use the command hdiutil detach it again. This will unmount and eject the image.

hdiutil detach /Volumes/<your image>
3
  • 1
    The mounted images still appear in "Disk Utility" when you can remove them. – Stefano Palazzo Sep 20 '15 at 1:07
  • I used 'hdiutil info" found the /dev then "hdiutil detach /dev/disk2". That way you don't have to remount the volume. – drudru Mar 29 '18 at 22:29
  • This is it! I tried to use umount /Volumes/<your image>/ but it only unmount the image but still seeing the Apple read/write Media in Disk Utility... – Richard Fu Aug 20 '19 at 1:34
2

Another possibility is that the disk image is still mounted (from previous work on it). In this case, just select the eject icon.

Afterwards, the hdiutil convert worked great.

2

In my case something was trying to access the image. What finally worked:

sudo lsof | grep ~/Unix.sparsebundle/
sudo kill -9 889
resize -size 100g ~/Unix.sparsebundle/
1

If you are accessing a disk image over a network then it's possible to have various operations interrupted if you encounter any kind of network issue, which can result in the image becoming "temporarily unavailable" when you try to resume whatever you were doing.

This happens because only a single system can have a disk image mounted at once, otherwise corruption could/will occur, but the locking mechanism for preventing double-access can end up being left in an inconsistent state, so even if you only have a single system accessing an image, you can end up with this error, as hdiutil thinks the image is already open on another system.

As others have pointed out, a restart can resolve this; I'm not actually sure why, as I'm not clear on how hdiutil/macOS marks an image as in-use. For a sparse bundle this has something to do with the token file, and there's a handy workaround if you don't want to have to restart.

NOTE: You must be absolutely certain that yours is the only system accessing this disk image, fiddling with the token file while an image is already mounted could destroy your image completely! Always have backups wherever possible, and be very careful at all times.

  1. Open Terminal.app
  2. If your image is on a remote share, connect to it now
  3. Navigate into the sparse bundle in the Terminal (type cd (with trailing space) then drag your sparse bundle file onto the Terminal window, hit enter)
  4. Rename the old token (mv token{,.old})
  5. Create a new copy of the token (cp token{.old,})
  6. If necessary, correct the permissions on the new token (chown 'user:group' token, with the correct user/group, it should match the user:group of the Info.plist file in the same folder.

After copying the token in this way, you should now be able to use hdiutil attach /path/to/image as normal to attach and mount the image.

NOTE: Be very careful using this method; I move the original out of the way rather than discarding it, so that it is always possible to recover it if anything goes wrong.

2
  • Is there any other way to get the user and group to change the token's owner to? I can't find anything that seems to match user or group info in Info.plist (nor any of the other plist files in the bundle). Specifically, if it's at all helpful, I'm attempting to fix a Time Machine backup that was apparenly corrupted or something as I updated the system from MacOS Mojave to Catalina. – Patrick L Mar 26 at 17:39
  • 1
    @PatrickL: ls -l Info.plist while cd'd into the sparsebundle should do the trick. In general you should just need it to match whichever user your system would be running as while accessing the image. – Haravikk Mar 27 at 19:03
-2

restart your machine and it run it again it should work.

1
  • 1
    We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed. – Tetsujin May 22 '17 at 8:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .