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

Mount remote disk images locally Network
A little known capability of Mac OS X disk image system allows remote mounting of most disk images directly from "http://" URLs. However, this feature is not available in Disk Copy, so one must resort to the Terminal for mounting remote disk images. There are several reasons why one may want to mount a disk image remotely. Firstly, it allows selective downloads of just the interesting files from a disk image. This can be a real time-saver if you are on a modem trying to download just a few files from a huge disk image. Secondly, it avoids cluttering the hard drive with disk image files.

To mount a disk image remotely, enter the following command in Terminal:
 % hdiutil mount "http://url.com/diskimage.dmg"
For example:
 % hdiutil mount "http://a1568.g.akamai.net/7/1568/
1388/061-0008.20020604/download.info.apple.com/Apple_Support_Area/
Apple_Software_Updates/Mac_OS_X/downloads/061-0008.20020604/
MacOSXUpdateCombo.10.1.5.dmg.bin"
NOTE: Shown on multiple lines for narrower reading; type on one line with no additional spaces in order to use the command. That command will mount the disk image containing the 45 MB large combo update to 10.1.5. Useful if you only need to retrieve a file or two using Pacifier. The feature is documented in the manual page for hdid, the command line program that is used by hdiutil to do the actual mounting.

[Editor's note: I had no idea this was possible ... and as the tip author points out in the comments, there is a GUI for it. Simply select a ".dmg" file in any Cocoa application, then do Services -> Disk Copy -> Mount Image, and the remote .dmg file will mount -- very very cool!]
    •    
  • Currently 4.25 / 5
  You rated: 5 / 5 (4 votes cast)
 
[22,814 views]  

Mount remote disk images locally | 21 comments | Create New Account
Click here to return to the 'Mount remote disk images locally' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Works for me!
Authored by: mssdvm on Jul 16, '02 02:34:40AM

Just tried this on my home machine running a webserver. Dragged an image to the Web folder and mounted it thru the Terminal over the internet just as you detailed.
(e.g. hdiutil mount "http://www.mydomain.com/Image.dmg")

Very Cool



[ Reply to This | # ]
Not very hard at all...
Authored by: chmod007 on Jul 16, '02 04:23:41AM

Wouldn't be very hard at all to make a Cocoa wrapper...I'll see if I get around to it today...Any ideas on how it should be designed (feature-wise and/or gui-wise)?



[ Reply to This | # ]
Hey, there is already a GUI for it!
Authored by: chmod007 on Jul 16, '02 04:40:40AM

Select an URL in a Cocoa program. Go to the Services menu. Disk Copy. Mount Image. DC will launch and the disk image will be mounted remotely! That explains what that strange Service item was used for!



[ Reply to This | # ]
Services vs. app
Authored by: robg on Jul 16, '02 10:04:55AM

Since Services are only available in Cocoa apps, I think a general app that did this would still be quite useful. Drag-and-drop a URL onto the program, and that's basically it. Maybe when it's running there's a small "well" onscreen where you can drag stuff, in addition to the usual drag to dock.

Maybe a list of recently visited .dmg files, too, to make going back easier.

Thoughts off the top of my head...

-rob.



[ Reply to This | # ]
The obvious question - now or later?
Authored by: sjonke on Jul 16, '02 10:18:34AM

The obvious question is, is it a good idea to mount a large update like this remotely and then run the updater from it or is that going to be worse/slower/use-more-bandwidth than just downloading the entire image and mounting it then?



[ Reply to This | # ]
The obvious question - now or later?
Authored by: chmod007 on Jul 16, '02 01:41:50PM

It depends, really. It depends on how the programs you use on the files were written - if they keep files in memory or read them again or again. At the recent WWDC, Apple emphasized that developers should use the disk sparingly, as it could reside on a network with slow performance.

For most applications it probably doesn't matter. Its probably best to download the dmg if you are going to use most of its contents...I haven't done a lot of testing, so you may have to experiment some to find the optimal working pattern.



[ Reply to This | # ]
Terminal method works for me, but not the service
Authored by: hombre on Jul 16, '02 01:24:17PM

I just mounted a remote copy of the new QuickTime installer. Whee! I was able to examine the contents with Pacifist and SNAX, although examining them with the Terminal was much faster, including the VolumeCheck script. One use for this would be to quickly decide whether you wanted to download such a package at all (esp. if us are stuck with a dial-up connection). I was tempted to try running the installer, but I decided there was likely no faster road to spinning-beachball hell.

On a less successful note, when I try to mount a volume (even a local one) with the Disk Copy service, the classic version of Disk Copy is invoked, even though the correct application open it when it is double-clicked.



[ Reply to This | # ]
No Go for me
Authored by: haironfire on Jul 16, '02 03:49:13PM

Couldn't get this to work for me. Running 10.1.5 on a Powerbook. Tried one of the examples at the Terminal command line and got:

hdid: unable to convert path to CFURL - error 0x000003E7 (999)
hdiutil: mount: mount failed (59136).
hdiutil: mount failed - unknown error (59136)

No idea what that all means.



[ Reply to This | # ]
No Go for me
Authored by: haironfire on Jul 16, '02 03:55:01PM

Umm...never mind. I had a couple misplaced spaces in the imagename string.

Works fine now.



[ Reply to This | # ]
How does connection speed affect?
Authored by: adolph on Jul 16, '02 04:21:40PM

Does hdiutil have a timeout? Is it trying to pull the update over and then mount it, or when I access something on the remote disk image does it access that remote server?

It worked fine with my iBook 500 (10.1.5, 320MB) on a LAN connected to the outside world via a T1.



[ Reply to This | # ]
How does connection speed affect?
Authored by: chmod007 on Jul 17, '02 06:12:11AM

It doesn't download the complete image. It access it in a random fashion, using resume/continue commands, i would guess. Which is why some servers will not be supported.



[ Reply to This | # ]
How does connection speed affect?
Authored by: iv on Jul 26, '02 06:55:58AM

Yes, the content is only partially retrieved: here's a sample HTTP request made by hdid:
GET /diskImaget/encrypted.dmg HTTP/1.1.
Host: 192.168.7.12:80.
Range: bytes=0-511.

There is also a side note not yet mentioned: if you mount an encrypted disk image remotely, the encryption is deciphered only after the partial retrieval, that is the data is secured during transmission. (At least that is what it looks like, based on analyzing the HTTP requests sent. I wish someone could confirm this.)

iv



[ Reply to This | # ]
does this work with Jaguar?
Authored by: ppmax on Oct 05, '02 12:46:10AM

i remember the Disk Utility in the services menu under 10.1.5 but it seems to be missing from the jaguar services menu. can anyone confirm this?

thx

ppmax



[ Reply to This | # ]
does this work with Jaguar?
Authored by: calroth on Jan 21, '04 04:02:04AM

Not sure about Jaguar, but it sure ain't here under Panther.



[ Reply to This | # ]
does not work with img.bin
Authored by: pzyhlarz on Jul 17, '02 06:50:52AM

comes up with the error "does not appear to be a disk image: internal error". Seems to be logical since Apple binhexed the the images. Is there an option in hdiutil which allows binhexing first before the image is remotely mounted?



[ Reply to This | # ]
does not work with img.bin
Authored by: chmod007 on Jul 17, '02 01:17:23PM

I managed to mount a .bin image...Hmm...



[ Reply to This | # ]
Have GUI, will mount
Authored by: bombich on Jul 21, '02 02:15:58AM

Alright, I've spent a few hours (literally) hacking up a GUI for this little trick. Its written in AppleScript Studio, so Quick n' Dirty is the name of the game. Regardless, it works and is customizable. Check it out at Remote Image Mounter.

This could be really great for an IT department that wanted to make disk images available to its clients. There are dozens of handy uses for this!

[ Reply to This | # ]

A UNIX OS can remote mount almost anything..
Authored by: lmattera on Jul 23, '02 09:54:32AM

I've administered Suns, and as a matter of fact we used NFS servers (Network File Systems) to remote mount users home directories. This way you could log in to any system in the company and see all your files.

We even remote mounted CDs, as several older Sun systems didn't come with CD-ROMs as standard.

Local UNIX accounts from what I've seen are a bit unusual in the business world.



[ Reply to This | # ]
A UNIX OS can remote mount almost anything..
Authored by: bombich on Jul 25, '02 01:01:58AM

Macs have been able to remotely mount volumes and CDs as well, but this is the first time we have seen remote mounting of disk _images_.



[ Reply to This | # ]
iDisk-like functionality
Authored by: m7n on Jul 25, '02 12:33:12PM
Is there a way to mount the images so they are writeable? I've tried a few different things (setting permissions on the image itself, converting the type of image to UDRW, etc.) but nothing seems to work. Mounting the image locally will allow me to write, mounting the same image remotely wont.

I'd like to have a few 100 MB images on my server and allow my family and friends to access the images to mimick iDisk functionality. I'm aware that there might be better ways to provide space, but this way I can limit their disk use to 100 MB (or whatever)

Any information would be greatly appreciated.

[ Reply to This | # ]
"disk" URLs
Authored by: deejemon on Dec 29, '02 01:52:31PM

URLs which start with "disk://" automatically spawn Disk Copy to mount them over the internet. For an example, go check out WHAMB:

http://www.whamb.com

The download section offers you the option of downloading the disk image containing the software or mounting it over the internet. It seems that you just have to make sure it's an actual .dmg file (not .sit or .gz or any other compression applied), get the web download address, and replace "http" with "disk".

And all without the command-line.

Disk Copy doesn't seem to honor the Proxy settings in the Network System Preferences unfortunately, so this doesn't work for me behind our firewall, but it all should in theory.



[ Reply to This | # ]