APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

Mac OS X disk images .dmg dmg create
© December 2004 Tony Lawrence
creating disk images

From: Tony Lawrence <tony@pcunix.com>
Subject: Re: Recent switcher
Date: Mon, 03 Feb 2003 10:58:40 GMT

Pim Versteeg wrote:
> Probably a very dumb question ,but...
> Can anyone please give me a pointer towards some information re mounting
> (virtual) disks. When I download stuff, all of a sudden I see some (virtual)
> disks on my desktop which disappears when I install the apps
> There must be more to this, any assistance would be much appreciated

As others have explained, those are disk image files.

What wasn't mentioned is that disk images are easy to create, both 
graphicallly and from the command line.  Disk Copy 
(Apllications/Utilities) lets you create blank images which you can then 
double click, copy stuff to etc.  Eject by dragging to Trash, then go 
back to Disk Copy and "Convert" it.

Ftom a shell window, the process is a little harder but of course you 
get more control and you can put it in a script that you call whenever 
you need it.

# create a 4MB disk image
hdiutil create -megabytes 4 myimage.dmg -layout NONE
# associate a device with this but don't mount it
MYDEV=$(hdid -nomount myimage.dmg)
# create a file system
newfs_hfs -v Myvol $MYDEV
# diassociate device
hdiutil eject $MYDEV
# mount it
hdid myimage.dmg
# copy stuff to it
/bin/cp /Somefiles /Volumes/Myvol
# eject
hdiutil eject $MYDEV
# compress it and make it read only
hdiutil convert -format UDZO myimage.dmg -o mycompimage.dmg

Tony Lawrence
Free SCO, Mac OS X and  Linux Skills Tests: 

Got something to add? Send me email.

(OLDER)    <- More Stuff -> (NEWER)    (NEWEST)   

Printer Friendly Version

-> Mac OS X disk images .dmg dmg create creating diskimages

Inexpensive and informative Apple related e-books:

Sierra: A Take Control Crash Course

Photos: A Take Control Crash Course

Take control of Apple TV, Second Edition

iOS 8: A Take Control Crash Course

Photos for Mac: A Take Control Crash Course

More Articles by © Tony Lawrence

Printer Friendly Version

Have you tried Searching this site?

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us

Printer Friendly Version

Technology is both a tool for helping humans and for destroying them. This is the paradox of our times which we're compelled to face (Frank Herbert).

Linux posts

Troubleshooting posts

This post tagged:


Unix/Linux Consultants

Skills Tests

Unix/Linux Book Reviews

My Unix/Linux Troubleshooting Book

This site runs on Linode

SCO Unix Sales, Support, & Service

Phone:  707-SCO-UNIX (707-726-8649Toll Free: 833-SCO-UNIX (833-726-8649)