This page is a wiki. Please login or create an account to begin editing.


6 posts / 0 new
Last post
Offline
Joined: 2011 Feb 21
Posts:
How to create a .dsk file on Mac OS X 10.5?

I have got some apps for Mac OS. But I need to format a Apple HFS disk. Not HFS+, so it is readable in the emulator like mini vmac. How would I do that. Is there an app just like HFV explorer, just for Mac OS X, or the dd command in the terminal (For the dd command, Tell me how to use it to create a 1.5 MB .dsk file)? This is a very quick question. I need an answer, I have to go somewhere and want to get it done fast.

Comments

IIGS_User's picture
Offline
Joined: 2009 Apr 8
Posts:

I've no idea how to create .dsk files, because I'm using Disk Copy 6.3 (on Mac OS 7 to 9, even within emulators) to create depending .img files. On Mac OS X, I've no idea how to create .img files, as Mac OS X creates .dmg files, which can't be read from Mac OS 9 native.

On the other hand, you can create standard .dmg files on Mac OS X for use with Mac emulators, but before storing data on it, they'll need to be formatted within the emulator first.

Third hand, Mac OS X 10.6 can't write on HFS disks.

MCP's picture
MCP
Offline
Joined: 2010 Mar 12
Posts:

Maybe this will be of use: http://minivmac.sourceforge.net/extras/blanks.html

Offline
Joined: 2011 Feb 21
Posts:

I found the other way around, the hard way. I wouldn't explain it as it is a very time-consuming process. MCP, thanks for pointing out blanks to me, but I already downloaded before (Haven't done it on my mac yet). The only concern I have is if it gives me a message saying mount error, because it is a HFS formatted disk. Mac OS X uses HFS+.

bertyboy's picture
Offline
Joined: 2009 Jun 14
Posts:

Don't know how to di it in a one-liner, but it may be possible on two lines:

hdiutil create -size 100M -type SPARSE -fs HFS -layout NONE -volname 'My HFS Disk' My_HFS_Disk

hdiutil convert -format RdWr -o 'My_HFS_DiskRW' My_HFS_Disk.sparseimage

OK, so I've set the size to 100M, but that's to help anyone else wanting to create the same, and because it's more than 1440K, you won't be able to convert it to Disk Copy 4.2 format (but see below).
OK, so you must create it -type SPARSE, rather than type UDIF,
the -fs HFS (Mac OS Standard rather than HFS+ or HFS+J.
Then you must specify -layout NONE so there is no partition map used.
The -volname gives the volume a name, you can miss this out and it'll be called "Untitled".
And the My_HFS_Disk is the filename of the disk image file created, call it whatever you like, you don't need the suffix, it's added by the -type flag (in this case, .sparseimage).

Then you must convert it with the second command:
Use -RdWr to create a NDIF (Disk Copy 6.x format) read-write image.
The -o specifies the output filename, suffix added automatically,
and give it the file to convert - I used My_HFS_Disk.sparseimage from the output of the first command.

So if you want Disk Copy 4.2 format files, the size can be no larger than 1440K, so simply change the -size 100M in the first command for "-size 1440K".
Then you can specify "-format DC42" instead of "-format RdWr" in the second command.

Edit:
====
Oh yeah, if you want to add files to it, you can either do it at the end, or before the convert, just in case your OS doesn't like Disk Copy 4.2 format

mjgleason's picture
Offline
Joined: 2010 Aug 14
Posts:

If you are comfortable using Terminal, I suggest trying the HFSUtils (http://www.mars.org/home/rob/proj/hfs/) set of command line programs to make HFS .dsk files. I use a Perl script to invoke the programs and do the dirty work of calculating the size of the image. I have been intending to write a Cocoa app that would let you drop files on it and it would create a disk image, but I haven't had time and this script is good enough for now.

A helpful feature of hfsutils is that it will decode MacBinary files as it makes the disk image, so an application.bin file will appear as an Application with type APPL when you use the disk in the emulator.

Here is a tarball of the script and hfsutils:
http://hotfile.com/dl/110124178/6c39660/HFSUtils_for_UNIX.tar.gz.html
or http://www.megaupload.com/?d=ONZUR0Y5

And here is the usage screen for the script.

file2hfsdisk.pl creates HFS disk images containing desired files.
Usage: ./file2hfsdisk.pl disk-image-name [--800k|--1440k|--size=X|--pad=N|-2|-3|-4|-5] [--label=X] [--overwrite] [--script-only] [-m|-b|-t|-r|-a] [files to copy to it...]

By default, the program tabulates the total size of all the specified files and
creates a disk image just large enough to contain the specified files. The size
options allow you to override this behavior and specify the size of the image.
The --800k, --1440k, and --size options are self-explanatory. The --pad option
lets you specify the exact amount of additional blank space to add to the disk.
The -2/-3/-4/-5 options multiply the total size by the value specified, so for
example, the -3 option triples the size, leaving 2/3rds empty.

The --label option can be used to name the disk as it appears in the Finder.

By default, the program won't overwrite existing disk image files, but you can
use the --overwrite option to force and overwrite.

The --script-only option can be used to output an equivalent set of shell
commands to create the disk image. This is mostly useful for debugging this
program.

The -m/-b/-t/-r/-a options apply to the hcopy command. You probably won't ever
need to worry about them, but you can consult the hcopy manual page for details
if you do.

Example:

file2hfsdisk.pl '/tmp/My Temp Disk.dsk' Disinfectant.bin stuffitdeluxe-401.sit

This creates a disk containing the Disinfectant application (automatically
converted from MacBinary format) and a raw data file containing named
stuffitdeluxe-401.sit.

Output:

Volume name is "My Temp Disk"
Volume was created on Sun Mar 13 15:25:14 2011
Volume was last modified on Sun Mar 13 15:25:14 2011
-rw------- 1 guestusr guestusr 3511296 Mar 13 15:25 /tmp/My Temp Disk.dsk
f APPL/D2CT 354570 0 Jul 9 1997 Disinfectant
f ????/UNIX 0 2988520 Mar 13 15:25 stuffitdeluxe-401.sit

This program can also be used to create blank HFS disk images. You do this by
simply not specifying any files to include with the image.

Version 1.0, 2011-03-13, Mike Gleason.