Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Force-mount unmountable disk images System
On my machine, OS X 10.3.x seems to refuse to mount any disk image files (.DMG) after a few days of use, and DMG files which mounted just fine before now fail with a "No mountable file systems" error message.

Most people assume that this points to a problem with the DMG file(s), but this is not always the case. While the Finder refuses to mount these files (a reboot is the only solution to the problem I could find), you can still mount these files from the command line using hdiutil, run as root:
$ sudo hdituil attach file name.dmg
Replace file name.dmg with the name of the disk image file. This will properly mount the DMG files, which can then be unmounted normally using the Finder. Failure to mount DMG files has been a real problem for me, and I am surprised this issue has not been fixed. Having to mount DMG files as root points to a permission problem to me.

[robg adds: I haven't personally experienced this one, but Apple has a kbase article that implies it could happen on pre-10.3.2 systems. Their only listed solution is to upgrade to 10.3.2 or newer.]
    •    
  • Currently 2.50 / 5
  You rated: 3 / 5 (4 votes cast)
 
[37,302 views]  

Force-mount unmountable disk images | 16 comments | Create New Account
Click here to return to the 'Force-mount unmountable disk images' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Force-mount unmountable disk images
Authored by: dubmaster on Sep 15, '04 12:59:45PM

Great, Great, Great.

I am creating a lot of disk images at the moment for the distribution of a product and obviously I have to test those images. After mounting about 10 the Finder stops doing it's work as described in the hint. This problem exists even in 10.3.5 and I am very happy now, cause rebooting, the only solution I had figured out so far, really interrupts my work big time.

Thanks for the tip.

---
DubMaster
--
Rehab is for quitters!



[ Reply to This | # ]
Force-mount unmountable disk images
Authored by: neier on Sep 15, '04 07:27:03PM
I have an image that is password protected, and it still doesn't mount with this hint. Here's the output from terminal.

Initializing...
Attaching...
DI_kextDriveGetRequest: failed (0x00000025)
Finishing...
hdiutil: attach failed - no mountable file systems
Since the GUI password box came up on the display, I suspect that whatever OSX bug the command line evades is non-evaded when the PW function is called. Another encrypted image that mounts ok in the standard way (double-click) mounts fine using hdiutil. Haven't tried rebooting to see if that lets me mount the first image.

[ Reply to This | # ]
AppleScript to Force-mount unmountable disk images
Authored by: Frederico on Sep 16, '04 12:29:27AM
It just so happens that we already built an AppleScript solution using this method; I'll paste it below for those who are Terminally challenged. As for the issue with password protected disks, this script will indeed trigger a GUI window asking for any such passwords not already stored in Keychain. I have yet to find an instance where presentation of the password box triggered the failure we're looking to overcome in this hing, but the -stdinpass switch would likely resolve it (see the man page), and could be added to this script.

set theDMG to POSIX path of (choose file with prompt 
	"Where is the .DMG file or files you wish to mount?" of type {"devi", "devr"} 
	with multiple selections allowed)
set {a, b, c} to {"Cancel", "Verify", "Skip Verification"}

set verifyOption to button returned of 
	(display dialog "Would you like to skip verification? (recommended)" & return & return & 
		"CAUTION: verification can take a very long time, and you will receive no feedback or opportunity to cancel once selected." buttons {a, b, c} 
		default button 3 with icon 2)

if verifyOption is b then set verifyOption to " "
if verifyOption is c then set verifyOption to " -noverify "
set mountDMG to "sudo hdiutil attach" & verifyOption & theDMG
try
	do shell script mountDMG with administrator privileges
	display dialog "Disk Mount of disk image " & (theDMG as text) 
		& " is complete."
on error errMSG
	display dialog errMSG
end try

Sorry about the code wraps, Rob, I tried to install AS returns, but they wouldn't deal with the line wraps any better because of the parentheticals.

[ Reply to This | # ]
AppleScript to Force-mount unmountable disk images
Authored by: Frederico on Sep 16, '04 12:45:38AM
[Rob, you can delete the post above (when are we going to get edit privileges?) if you want; I modified the script to fit nicely--F]

It just so happens that we already built an AppleScript solution using this method; I'll paste it below for those who are Terminally challenged. As for the issue with password protected disks, this script will indeed trigger a GUI window asking for any such passwords not already stored in Keychain. I have yet to find an instance where presentation of the password box triggered the failure we're looking to overcome in this hing, but the -stdinpass switch would likely resolve it (see the man page), and could be added to this script.

set theDMG to POSIX path of (choose file with prompt 
	"Where is the .DMG file or files you wish to mount?" of type {"devi", "devr"} 
	with multiple selections allowed)
set {a, b, c} to {"Cancel", "Verify", "Skip Verification"}
set msg1 to "Would you like to skip verification? (recommended)" & return & return
set msg2 to "CAUTION: verification can take a very long time, and you will"
set msg3 to "receive no feedback or opportunity to cancel once selected."
set verifyOption to button returned of 
	(display dialog msg1 & msg2 & msg3 buttons {a, b, c} 
		default button 3 with icon 2)
if verifyOption is b then set verifyOption to " "
if verifyOption is c then set verifyOption to " -noverify "
set mountDMG to "sudo hdiutil attach" & verifyOption & theDMG
try
	do shell script mountDMG with administrator privileges
	display dialog "Disk Mount of disk image " & (theDMG as text) 
		& " is complete."
on error errMSG
	display dialog errMSG
end try



[ Reply to This | # ]
AppleScript to Force-mount unmountable disk images
Authored by: Frederico on Sep 16, '04 06:03:29AM
Man, it is amazing how fast folks around here report bugs. Sorry for the oversights; the script was originally written for single DMGs, and I added multiples without really testing it or thinking it through; also we rarely use a special character in a file path because we're so used to working on the web. All bugs should be resolved, except those idiosyncracies that exist with name problems in hdiutil (such as "image already specified" errors).

set theDMGs to (choose file with prompt 
	"Where is the .DMG file or files you wish to mount?" of type {"devi", "devr"} 
	with multiple selections allowed) as list
set {a, b, c} to {"Cancel", "Verify", "Skip Verification"}
set msg1 to "Would you like to skip verification? (recommended)" & return & return
set msg2 to "CAUTION: verification can take a very long time, and you will"
set msg3 to "receive no feedback or opportunity to cancel once selected."
set verifyOption to button returned of 
	(display dialog msg1 & msg2 & msg3 buttons {a, b, c} 
		default button 3 with icon 2)
if verifyOption is b then set verifyOption to " "
if verifyOption is c then set verifyOption to " -noverify "
try
	do shell script "sudo df -k" with administrator privileges -- just here to get sudo rights only once
on error errMSG
	display dialog errMSG & return & "Please try again." as string
	return
end try
with timeout of 60000 seconds
	repeat with i from 1 to number of items in theDMGs
		set theDMG to item i of theDMGs
		set mountDMGs to "sudo hdiutil attach" & verifyOption & "\"" & 
			(POSIX path of theDMG) & "\""
		try
			do shell script mountDMGs
			display dialog "Disk Mount of disk image " & return & (theDMG as text) 
				& " is complete." giving up after 4
		on error errMSG
			display dialog errMSG
		end try
	end repeat
	if (number of items in theDMGs) is greater than 1 then 
		set endOpt to button returned of (display dialog 
			"All operations complete" & return & return & 
			"Send comments to frederico@mac.com" buttons {"Comments", "Cool"} 
			default button 2)
	if endOpt is "Comments" then open location "mailto:frederico@mac.com"
end timeout



[ Reply to This | # ]
AppleScript to Force-mount unmountable disk images
Authored by: clith on Sep 21, '04 12:47:53PM

Now, if you could add an "on open" handler that handled drag-and-drop, you'd be all set! Just drag your dmg files onto the script and they would mount. No file dialog to get in the way.. :-)



[ Reply to This | # ]
AppleScript to Force-mount unmountable disk images
Authored by: mlaurenc on Mar 12, '05 11:58:16PM

Hi there...

Well, I tried both versions of your script on several disk images (including one that I KNOW mounts fine by itself), and most of them were grayed out in my file dialog. My first thought was that perhaps they were corrupted, but at least one of them mounts fine on its own, and it was not accessible either.

I very much appreciate your scripting skills, but do you have any idea why I might be having such problems? Any suggestions from anyone else out there? I would really appreciate the help!

Thanks in advance,

mlaurenc



[ Reply to This | # ]
AppleScript to Force-mount unmountable disk images
Authored by: slickseth on Jan 02, '05 10:48:43PM

I may just be a big newbie, (and I undoubtably am), but when running this script the only items I could select when it asked me which DMG I wanted to mount were file folders and no DMG files. Even with a foler selected, "Choose" never highlit. Am I doing something wrong?

Also, is there an applescript super newbie thread I should be hitting up before getting to knee deep in this?

by the way, rebooting still didn't allow me to mount the DMGs. I'm running 10.3.7.

Thanks for any/all help guys!

-Seth



[ Reply to This | # ]
AppleScript to Force-mount unmountable disk images
Authored by: slickseth on Jan 02, '05 10:48:59PM

I may just be a big newbie, (and I undoubtably am), but when running this script the only items I could select when it asked me which DMG I wanted to mount were file folders and no DMG files. Even with a foler selected, "Choose" never highlit. Am I doing something wrong?

Also, is there an applescript super newbie thread I should be hitting up before getting to knee deep in this?

by the way, rebooting still didn't allow me to mount the DMGs. I'm running 10.3.7.

Thanks for any/all help guys!

-Seth



[ Reply to This | # ]
Force-mount unmountable disk images
Authored by: bluehz on Sep 16, '04 10:04:57AM

While this is a nice workaround - I really wish the problem would be solved instead. Very annoying. On my machine - happens everyday after about my tenth disk mount. The image actually appears to get mounted and appears in /Volumes but it shows up no where else and is impossible to access.



[ Reply to This | # ]
Force-mount unmountable disk images
Authored by: oink on Sep 16, '04 11:42:40AM

I must say, it doesn't happen much with me. But if it shows up in /Volumes, you should be able to refresh the finder by doing "disktool -r". I am writing a script that triggers mounting of dmg and the "disktool -r" seems to solve some of my problem.

Good luck



[ Reply to This | # ]
Force-mount unmountable disk images
Authored by: clytie on Sep 21, '04 12:52:44AM

I tried this Hint for the first time today, but I didn't appear to have the relevant utility. Typing in hd and tab brought up

hdiutil

which is not the command quoted in the actual command string in the Hint.

Anyway, I tried hdiutil, and it tried to attach the dmg, but failed with the same problem: no mountable file systems. <sigh>

Back to restarting...

from Clytie, still having trouble

---
Clytie Siddall -- Renmark, in the Riverland of South Australia

iBook G3, 10.3.5, all updates current



[ Reply to This | # ]
Force-mount unmountable disk images
Authored by: Wevah on Sep 27, '04 01:39:23AM

Yeah, "hdituil" is a typo.



[ Reply to This | # ]
Force-mount unmountable disk images
Authored by: chantospride on Sep 23, '04 09:34:06PM

Unfortunately, this didn't work for me. :-(

---
Ron



[ Reply to This | # ]
Force-mount unmountable disk images
Authored by: GusDoeMatik on May 10, '05 01:30:28PM

I tried the applescript but nothing is highlight-able

---
Infants are born. Children learn as they grow. Knowledge is power. Information in the wrong minds is deadly!!!



[ Reply to This | # ]
Force-mount unmountable disk images
Authored by: GusDoeMatik on May 10, '05 01:49:45PM

Same here
It won't work

---
Infants are born. Children learn as they grow. Knowledge is power. Information in the wrong minds is deadly!!!



[ Reply to This | # ]