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

Mount .DMG images remotely via the Terminal UNIX
After reading the hdid man (via man hdid) page, I realized that we could mount .DMG images via HTTP under Terminal.app. And even cooler, the segmented images work too. Just reference the http-based DMG via this command:
% hdid http://server.company.com/Images/stuff.dmg
[robg adds: I haven't tested this one. The man page has a lot of good info; search on Mounting Images to jump to the section on http-based images.]
    •    
  • Currently 2.63 / 5
  You rated: 1 / 5 (8 votes cast)
 
[84,428 views]  

Mount .DMG images remotely via the Terminal | 7 comments | Create New Account
Click here to return to the 'Mount .DMG images remotely via the Terminal' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Mount .DMG images remotely via the Terminal
Authored by: boredzo on May 18, '05 12:04:12PM

from the manpage for hdid:

With OS X version 10.3, hdid calls the DiskImages.framework and its helpers take care of any out-of-kernel image serving duties. Thus hdid exists primarily for backwards compatibility. Generally, hdiutil attach should be favored over hdid.

so the correct command is hdiutil attach URL. works fine for me.



[ Reply to This | # ]
Mount .DMG images remotely via the Terminal
Authored by: zeigerpuppy on Sep 13, '05 12:28:08AM

This works fine on Tiger apart from one thing....

How do you mount an encrypted image remotely?
When I try to do this locally, it pops up a window on the desktop asking for the password.
When I attempt from a remote ssh session, I get the error:
hdid: attach canceled
hdiutil: attach failed - Network is unreachable

Thanks



[ Reply to This | # ]
Mount .DMG images remotely via the Terminal
Authored by: david-bo on May 18, '05 12:25:11PM

In earlier versions of Mac OS X (10.2?) you could simply

% open disk://host.tld/image.dmg

but doesn't work anymore, Any ideas why?

---
http://www.google.com/search?as_q=%22Authored+by%3A+david-bo%22&num=10&hl=en&ie=ISO-8859-1&btnG=



[ Reply to This | # ]
disk:// ?
Authored by: lullabud on May 18, '05 12:40:44PM

Is that the URL protocol? disk:// ? I've never heard of that one..

I just did an "open disk.dmg" while ssh'd into a system which I was also logged into and it worked, but it opened up the GUI app on the remote system to mount the image. When I logged out and tried again I got an error about not being able to connect to the windowserver. These were just local dmg files, but I the premise is the same.



[ Reply to This | # ]
Mount .DMG images remotely via the Terminal
Authored by: pstadelmann on May 18, '05 12:59:47PM
It was disabled last year for security reason :
    http://www.euronet.nl/~tekelenb/playground/security/URLschemes/archive.html
Patrick

[ Reply to This | # ]
Mount .DMG images remotely via the Terminal
Authored by: brettmjohnson on May 19, '05 12:21:18AM

Here is a writeup I did last year on how to download disk images, mount them, and install software from the command line. Very useful when you admin a machine only via SSH.


$ cat HeadlessInstall.txt
10 August 2004 Brett Johnson

This describes some of the steps necessary to perform the
installation of Mac OS X packages via the command line.


1) Download the Package

Download the installation image to a local directory.
I usually download packages to the ~admin/staging directory [a client convention].
Don't try to download it to some target directory like /etc or /usr

I use 'curl' to fetch the package from the net. I usually Ctrl-click
or right-click the package link in Safari (running locally) and select
'Copy link to Clipboard'. This copies the URL to the package to the
clipboard. I then paste the URL into the curl command in a ssh login
window to this server. Note that curl writes its output to stdout,
so be sure to redirect it to a file. For example

% curl http://www2.entropy.ch/download/Entropy-PHP-4.3.6-4.dmg > Entropy-PHP-4.3.6-4.dmg

This DOESN'T work for things on SourceForge, where the links are actually
javascript that goes to a mirror. In that case, download it locally,
then use sftp (or Fugu) to move it to this server.



2) If it is a compressed archive, decompress it using the appropriate tool.
For instance suppose you have a .tar.gz file:

% ls
xyzzy.pkg.tar.gz

% gunzip xyzzy.pkg.tar.gz
% tar -xvf xyzzy.pkg.tar



3) If it is a disk image file (.dmg) mount it using hdid. By default,
the disk images are mounted under the /Volumes directory. I see no
reason to do otherwise.

% hdid Entropy-PHP-4.3.6-4.dmg
% ls /Volumes
Backup HD Entropy PHP 4.3.6-4 Server HD
% cd "/Volumes/Entropy PHP 4.3.6-4"
% ls
Documentation.html php-4.3.6.pkg


4) Run the command line version of the Mac OS X installer. By default
the installer produces terse output suitable for parsing by scripts
doing installations. We will make the output verbose [human readable].
The installer takes the package name as well as the target Volume.
The installer is /usr/sbin/installer , which should be on the path.
The installer must be run as root, so be prepared to sudo...

% sudo /usr/sbin/installer -verbose -pkg php-4.3.6.pkg -target /



5) Don't forget to unmount the .dmg disk image if you mounted one.
Here we execute the 'mount' command to determine which virtual
disk device our dmg is mounted as (in this case it is /dev/disk2s2).
Then we use 'hdiutil detach' to unmount it.

% mount
/dev/disk0s3 on / (local, journaled)
/dev/disk1s3 on /Volumes/Backup HD (local)
automount -nsl [336] on /Network (automounted)
/dev/disk2s2 on /Volumes/Entropy PHP 4.3.6-4 (local, nodev, nosuid, read-only, mounted by admin)

% hdiutil detach /dev/disk2s2 -force
"disk2" unmounted.
"disk2" ejected.



[ Reply to This | # ]
Mount .DMG images remotely via the Terminal
Authored by: brettmjohnson on May 19, '05 12:30:33AM

Here is a writeup I did last year on how to download disk images, mount them, and install software from the command line. Very useful when you admin a machine only via SSH.


$ cat HeadlessInstall.txt
10 August 2004 Brett Johnson

This describes some of the steps necessary to perform the
installation of Mac OS X packages via the command line.


1) Download the Package

Download the installation image to a local directory.
I usually download packages to the ~admin/staging directory [a client convention].
Don't try to download it to some target directory like /etc or /usr

I use 'curl' to fetch the package from the net. I usually Ctrl-click
or right-click the package link in Safari (running locally) and select
'Copy link to Clipboard'. This copies the URL to the package to the
clipboard. I then paste the URL into the curl command in a ssh login
window to this server. Note that curl writes its output to stdout,
so be sure to redirect it to a file. For example

% curl http://www2.entropy.ch/download/Entropy-PHP-4.3.6-4.dmg > Entropy-PHP-4.3.6-4.dmg

This DOESN'T work for things on SourceForge, where the links are actually
javascript that goes to a mirror. In that case, download it locally,
then use sftp (or Fugu) to move it to this server.



2) If it is a compressed archive, decompress it using the appropriate tool.
For instance suppose you have a .tar.gz file:

% ls
xyzzy.pkg.tar.gz

% gunzip xyzzy.pkg.tar.gz
% tar -xvf xyzzy.pkg.tar



3) If it is a disk image file (.dmg) mount it using hdid. By default,
the disk images are mounted under the /Volumes directory. I see no
reason to do otherwise.

% hdid Entropy-PHP-4.3.6-4.dmg
% ls /Volumes
Backup HD Entropy PHP 4.3.6-4 Server HD
% cd "/Volumes/Entropy PHP 4.3.6-4"
% ls
Documentation.html php-4.3.6.pkg


4) Run the command line version of the Mac OS X installer. By default
the installer produces terse output suitable for parsing by scripts
doing installations. We will make the output verbose [human readable].
The installer takes the package name as well as the target Volume.
The installer is /usr/sbin/installer , which should be on the path.
The installer must be run as root, so be prepared to sudo...

% sudo /usr/sbin/installer -verbose -pkg php-4.3.6.pkg -target /



5) Don't forget to unmount the .dmg disk image if you mounted one.
Here we execute the 'mount' command to determine which virtual
disk device our dmg is mounted as (in this case it is /dev/disk2s2).
Then we use 'hdiutil detach' to unmount it.

% mount
/dev/disk0s3 on / (local, journaled)
/dev/disk1s3 on /Volumes/Backup HD (local)
automount -nsl [336] on /Network (automounted)
/dev/disk2s2 on /Volumes/Entropy PHP 4.3.6-4 (local, nodev, nosuid, read-only, mounted by admin)

% hdiutil detach /dev/disk2s2 -force
"disk2" unmounted.
"disk2" ejected.



[ Reply to This | # ]