Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > macOS > Mounting disk images from command line

Mounting disk images from command line
Thread Tools
lythari
Forum Regular
Join Date: Nov 2000
Location: The voice inside your head
Status: Offline
Reply With Quote
Mar 31, 2002, 09:50 PM
 
Yes, I know that's what disk copy does, but I'm wondering how it could be done from the command line, if it's possible at all.
     
<chad>
Guest
Status:
Reply With Quote
Mar 31, 2002, 10:54 PM
 
&gt;disktool
     
Mactoid
Grizzled Veteran
Join Date: Sep 2000
Location: Springfield, MA
Status: Offline
Reply With Quote
Mar 31, 2002, 10:56 PM
 
Originally posted by lythari:
<STRONG>Yes, I know that's what disk copy does, but I'm wondering how it could be done from the command line, if it's possible at all.</STRONG>
yup, possible. try hdiutil

edit: yeah, disktool should work too, but since hdiutil is documented, you can actually use it without any dangerous experimentation.

[ 03-31-2002: Message edited by: Mactoid ]
We hope your rules and wisdom choke you / Now we are one in everlasting peace
-- Radiohead, Exit Music (for a film)
     
[APi]TheMan
Mac Elite
Join Date: Sep 2001
Location: Chico, CA and Carlsbad, CA.
Status: Offline
Reply With Quote
Apr 1, 2002, 03:52 AM
 
Couldn't you also use...
<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier>
[localhost:~] theman% open -a /Applications/Utilities/Disk\ Copy.app/Contents/MacOS/Disk\ Copy /path/to/img
</font>[/code]
And just replace /path/to/img with the actual location of the image... I do this with Stuffit, and I assume it would work with Disk Copy, unless it isn't capable of handling this type of event...
"In Nomine Patris, Et Fili, Et Spiritus Sancti"

     
Paul McCann
Mac Enthusiast
Join Date: Nov 2001
Location: Adelaide, South Australia
Status: Offline
Reply With Quote
Apr 1, 2002, 09:42 AM
 
Originally posted by [APi]TheMan:
<STRONG>Couldn't you also use...
% open -a /Applications/Utilities/Disk\ Copy.app/Contents/MacOS/Disk\ Copy /path/to/img
</STRONG>
I guess so, if you were feeling like typing or tabbing a lot!

Let "open -a" work its little bit of magic...

% open -a "disk copy" /path/to/img

Cheers,
Paul

[ 04-01-2002: Message edited by: Paul McCann ]
     
Mactoid
Grizzled Veteran
Join Date: Sep 2000
Location: Springfield, MA
Status: Offline
Reply With Quote
Apr 1, 2002, 10:51 AM
 
using "Disk Copy" also assumes that you are logged into the Window Manager, so that Disk Copy can launch. Not a good assumption to make considering this is the Unix forum.
We hope your rules and wisdom choke you / Now we are one in everlasting peace
-- Radiohead, Exit Music (for a film)
     
lythari  (op)
Forum Regular
Join Date: Nov 2000
Location: The voice inside your head
Status: Offline
Reply With Quote
Apr 2, 2002, 02:38 AM
 
Thanks, I'll try hdiutil and disktool out.
     
lythari  (op)
Forum Regular
Join Date: Nov 2000
Location: The voice inside your head
Status: Offline
Reply With Quote
Apr 2, 2002, 03:28 AM
 
Is there anyway to specify the dev-entry and mount point for a disk image? The man page for hdiutil is cryptic (aren't they all ) and doesn't seem to say anything about that.
     
Oneota
Professional Poster
Join Date: May 2000
Location: Urbandale, IA
Status: Offline
Reply With Quote
Jul 8, 2003, 08:26 AM
 
Originally posted by lythari:
Is there anyway to specify the dev-entry and mount point for a disk image? The man page for hdiutil is cryptic (aren't they all ) and doesn't seem to say anything about that.
Sorry to ressurrect a REALLY old thread, but I'd like to know the answer to this, too. Anyone know how to get a disk image to mount someplace other than /Volumes/ ? Thanks!
"Yields a falsehood when preceded by its quotation" yields a falsehood when preceded by its quotation.
     
theory
Dedicated MacNNer
Join Date: May 2002
Status: Offline
Reply With Quote
Jul 8, 2003, 10:47 PM
 
(This is my guess) I think, I think
you can change it in the /etc/fstab. Since
I have never actually tried editing or
even lookin into the fstab I don't know
if you can do it this way
     
WJMoore
Grizzled Veteran
Join Date: Jan 2002
Location: Melbourne, Australia
Status: Offline
Reply With Quote
Jul 8, 2003, 11:54 PM
 
Originally posted by theory:
(This is my guess) I think, I think
you can change it in the /etc/fstab. Since
I have never actually tried editing or
even lookin into the fstab I don't know
if you can do it this way
I read the man pages and there doesn't seem to be a way to tell hdiutil or hdid where to mount the image. Also I had 3 fstab.xx files, all of which had a "This file is obsolete" comment at the top, I assume this info in in NetInfo now or something.

If you're interested though the hdid man page says how to create a RAM disk which I thought was interesting:
Code:
hdid -nomount ram://<sectors> will attach a ram disk that can be mounted and used after being formatted with a newfs utility or Disk Utility.app. A sector is 512 bytes. A small shell script to create and mount a ram disk: #!/bin/sh NUMSECTORS=128000 mydev=`hdid -nomount ram://$NUMSECTORS` newfs_hfs $mydev mkdir /tmp/mymount mount -t hfs $mydev /tmp/mymount
WM
     
darkcore
Dedicated MacNNer
Join Date: Apr 2002
Location: Red Bluff, CA
Status: Offline
Reply With Quote
Jul 15, 2003, 03:04 PM
 
Originally posted by WJMoore:
I read the man pages and there doesn't seem to be a way to tell hdiutil or hdid where to mount the image. Also I had 3 fstab.xx files, all of which had a "This file is obsolete" comment at the top, I assume this info in in NetInfo now or something.

If you're interested though the hdid man page says how to create a RAM disk which I thought was interesting:
Code:
hdid -nomount ram://<sectors> will attach a ram disk that can be mounted and used after being formatted with a newfs utility or Disk Utility.app. A sector is 512 bytes. A small shell script to create and mount a ram disk: #!/bin/sh NUMSECTORS=128000 mydev=`hdid -nomount ram://$NUMSECTORS` newfs_hfs $mydev mkdir /tmp/mymount mount -t hfs $mydev /tmp/mymount
WM
Do you suppose that it would be possible setup osx to create and mount a new ram disk at startup and then place the swapfile on the ramdisk?
     
Gene Jockey
Mac Elite
Join Date: Mar 2001
Location: Houston, TX
Status: Offline
Reply With Quote
Jul 18, 2003, 09:38 AM
 
Originally posted by darkcore:
Do you suppose that it would be possible setup osx to create and mount a new ram disk at startup and then place the swapfile on the ramdisk?
That would qualify for most useless but cool idea of the month. I approve

--Josh
     
theory
Dedicated MacNNer
Join Date: May 2002
Status: Offline
Reply With Quote
Jul 18, 2003, 08:00 PM
 
Unless you have 4GB of ram or you don't use
wont run lots of program you will quicly run
into problems. (Remember what used to
happen in OS 9 when you ran out of memory
)
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 08:56 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,