I know that I'm not the only one out there who uses OS 9 once in a while. Not everyone has upgraded their software to Mac OS X, so whether you are trying to be compatible with other people, or just taking care of your own computers, it's nice to be able to support OS 9.
Of course, one of the things it'd be nice to do is to be able to still MAKE Mac OS 9 compatible disk images. That way if you have to use OS 9 to recover from a backup, you can do it. Handily, OS X can open the .img files too! However, creating them is a different story. For a long time, the only way i found was to boot up in OS 9 and make the images there. At long last I have now found a way to do it directly in Mac OS X. As is true with most things in OS X, there are two methods: GUI and CLI.
One last thing, before we begin. All this is done under OS 10.2 I sincerely hope that Apple has made the process work correctly in 10.3 or 10.4 (yet to be released) so that you can simply image a folder as an NDIF image. Until then...
This part essentially walks you through the making your nice image. It's really easy, and you should have no trouble whatsoever with it as long as you follow the instructions. You only have to type ONE command in the terminal, and that's only once... never again. Before you begin, as always, it's a good idea to read through the entire process before you begin. Here's the steps:
defaults write com.apple.DiskCopy expert-mode 1
and hit return. There. That wasn't so bad.Just a quick note before we start, this section is not for people who are easily intimidated, scared, or otherwise destabilized by advanced ideas. Everything in this method is in the terminal. EVERYTHING. You can even log in in console mode if you like (at the login screen, select other, and type ">console" as the username and leave the password blank. At the prompt, you can then enter your username and password. Keep in mind that the terminal gives no visual as you type a password, but it does see you typing.)
This part is also where I get to explain to you all WHY you cannot simply use Disk Copy to create the image in one go, but have instead to create a special sparseimage first and then convert that to an NDIF. The main reason is that NDIF images don't support partition maps. Apparently Disk Copy's normal mode of operation is to create a .sparseimage with a partition map(CD I think) with your files and then convert that into the final image, unless your original image is a UDIF read/write (possibly a UDIF read only). UDIF is the format of a .dmg disk image. Well, when you try to use it to image a folder to an NDIF image, Disk Copy still makes the .sparseimage the normal way, and then proceeds on to converting to an NDIF. BAM. Dead stop. You can't convert an image with a partition map to a format that doesn't support the partition map. Ouch.
Anyway, the point of all this is that if you want to make a nice NDIF, you have to do it by hand... or at least, make a .sparseimage with no partition map, and then convert it to an NDIF. Fun, fun!
du -s imagedirectory
will return a number which is the number of 512 byte sectors in that directory.hdiutil create -sectors number -type SPARSE -fs HFS+ -volname volumename -layout NONE imagelocation
du
returned. Give it whatever volume name and image location you'd like.hdiutil mount imagelocation
cp
to copy all your files into /Volumes/volname
... something like cp -R ~/* /Volumes/myimage/
cp
does not duplicate resource forks, so if they're important to you, its best to use ditto -rsrc
or /Developer/Tools/CpMac
whichever suits your preferences and your installation better. Thanks to Rob for pointing this out.hdiutil unmount /Volumes/volname
hdiutil convert imagelocation -format imageformat -o outputfile
RdWr
(NDIF read/write), Rdxx
(NDIF read only), ROCo
(NDIF Compressed), Rken
(NDIF compressed, KenCode)rm sparseimagelocation
man
is your friend, and hdiutil
will print out help if you just type in hdiutil verb