HFS Disk Maker: Tool for creating HFS disk images

Anything about Mac emulation that does not belong in the above categories.

Moderators: Cat_7, Ronald P. Regensburg

CharlesS
Granny Smith
Posts: 107
Joined: Thu Aug 14, 2008 9:05 am

HFS Disk Maker: Tool for creating HFS disk images

Post by CharlesS »

This is a pretty old project that's been sitting on my back burner, 95% complete, for a long time. I finally decided to dust it off and complete it, and at the present time it seems to be working pretty well.

http://www.charlessoft.com/HFS_Disk_Maker.zip

This is an app which will let you easily create an HFS disk image for any file and/or folder on your hard disk. This is intended to make it easy to import files into emulators such as Mini vMac, Basilisk, etc. which typically run operating systems that only support HFS. This tool will let you create an HFS disk image without having to resort to installing system-wide extensions like FUSE.

Usage is pretty simple; you just launch the app, choose a file or folder, then choose a filename for the disk image. Alternatively, you can just drag-and-drop a file or folder onto the app and it will make a disk image from it.

The disk image is made completely from scratch by assembling all of the HFS data structures, catalog file, etc. by hand. It is independent of any support for HFS in the operating sytem. Resource forks, HFS type codes, and other HFS metadata are preserved.

After creating a disk image, fsck_hfs is run on it to make sure no errors were inadvertently introduced into its structure while creating the image.

I hope you find this app useful.
There's no earthly way of knowing, which direction we are going, for the rowers keep on rowing, and they're certainly not showing any signs that they are slowing.
User avatar
adespoton
Forum All-Star
Posts: 4227
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: HFS Disk Maker: Tool for creating HFS disk images

Post by adespoton »

Wow! This is a creat util now that OS X has such lacklustre support for HFS images. Any chance of doing the reverse as well (allowing extraction of files from an HFS NDIF image)?

Also, is this code portable to other OSes?
CharlesS
Granny Smith
Posts: 107
Joined: Thu Aug 14, 2008 9:05 am

Re: HFS Disk Maker: Tool for creating HFS disk images

Post by CharlesS »

The reverse would certainly be possible, but since OS X still has read support for HFS images, it doesn't seem necessary to me, as you can just double-click the image and drag its contents out via the Finder. However, if there is enough demand for it, I may end up doing it.

The code is all in Objective-C and as such is probably not portable to other OSes without the use of tools such as GNUStep or Cocotron. However, there is a program called HFVExplorer which lets you create and manipulate HFS images on Windows.
There's no earthly way of knowing, which direction we are going, for the rowers keep on rowing, and they're certainly not showing any signs that they are slowing.
User avatar
adespoton
Forum All-Star
Posts: 4227
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: HFS Disk Maker: Tool for creating HFS disk images

Post by adespoton »

OS X still has read support for HFS, but no longer supports NDIF images; they have to be converted before reading, and I've started to find that my older images can't even be converted correctly under 10.9 (including my old Apple Update CD images). I'd rather have a working replacement before they kill off support in Disk Utlity altogether, rather than afterwards :)
CharlesS
Granny Smith
Posts: 107
Joined: Thu Aug 14, 2008 9:05 am

Re: HFS Disk Maker: Tool for creating HFS disk images

Post by CharlesS »

Reading from an uncompressed NDIF image would be pretty easy to do, given that I've already done most of the work for this project. The trouble is that some of them are compressed, and the compression algorithms used are proprietary. Reading those would require reverse-engineering the algorithms (and there's more than one of them). That would take a *lot* of work.
There's no earthly way of knowing, which direction we are going, for the rowers keep on rowing, and they're certainly not showing any signs that they are slowing.
User avatar
adespoton
Forum All-Star
Posts: 4227
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: HFS Disk Maker: Tool for creating HFS disk images

Post by adespoton »

Yeah; don't worry about compressed NDIF; that was only supported by a few versions of Disk Utility and is much more modern than most of the systems we're trying to work with here. Identifying it as compressed and throwing an error might be worthwhile though.
User avatar
Ronald P. Regensburg
Expert User
Posts: 7821
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: HFS Disk Maker: Tool for creating HFS disk images

Post by Ronald P. Regensburg »

I tried HFS Disk Maker in OSX 10.9.2 with folders and with separate files.

Each attempt results in an image file that indeed works in the emulators, but with also this message:
Creating disk image.

Checking validity of image:

Attaching image failed: Error Domain=com.charlessoft.CSFoundation.ErrorDomain Code=-1 "imageinfo failed - image not recognized
" UserInfo=0x7fd0fd0d96c0 {CSErrorKey=true, NSLocalizedDescription=imageinfo failed - image not recognized
, NSLocalizedFailureReason=imageinfo failed - image not recognized
}

Image verification failed. It is likely that this disk image is corrupted, possibly due to a bug in this program. Use this disk image only at your own risk.
User avatar
adespoton
Forum All-Star
Posts: 4227
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: HFS Disk Maker: Tool for creating HFS disk images

Post by adespoton »

What does Disk Utility say about them?
User avatar
Ronald P. Regensburg
Expert User
Posts: 7821
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: HFS Disk Maker: Tool for creating HFS disk images

Post by Ronald P. Regensburg »

Oops! This was an unfinished text that I did not intend to post. I have no time now to explain, have to go to a business meeting. I'll come back later.
User avatar
Ronald P. Regensburg
Expert User
Posts: 7821
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: HFS Disk Maker: Tool for creating HFS disk images

Post by Ronald P. Regensburg »

While I was composing the text that I accidentally posted, I realized what could be a cause for the error message. And it appeared to be that indeed.

The validation error occurs when I do not give the file to be created a file name extension in the Save dialog. The resulting image file itself is fine and can be used in Mini vMac, BasiliskII, and SheepShaver.

When I try to add a wrong extension in the Save dialog, I will get a warning, but not when I do not add an extension.

If I add an .img extension to the name in the Save dialog, verification is successful and the resulting image can also be mounted (of course read-only) fine in OSX.
Last edited by Ronald P. Regensburg on Thu Apr 10, 2014 9:45 pm, edited 1 time in total.
Reason:  
CharlesS
Granny Smith
Posts: 107
Joined: Thu Aug 14, 2008 9:05 am

Re: HFS Disk Maker: Tool for creating HFS disk images

Post by CharlesS »

Ah, sorry about that. I forgot that hdiutil (which I use to attach the image so that I can run fsck on it) is fussy about filename extensions. I've updated the app, which should now disallow any filename extension that hdiutil doesn't recognize.
There's no earthly way of knowing, which direction we are going, for the rowers keep on rowing, and they're certainly not showing any signs that they are slowing.
User avatar
adespoton
Forum All-Star
Posts: 4227
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: HFS Disk Maker: Tool for creating HFS disk images

Post by adespoton »

Hmm; hdiutil for fsck sounds like a good idea; however, if hdiutil stops supporting the format, this verification will die. Can't think of an alternative method to verify offhand though (except maybe a custom Mini vMac-based tool).

As long as it's purely informative as you've done now, it's probably good as-is :)
CharlesS
Granny Smith
Posts: 107
Joined: Thu Aug 14, 2008 9:05 am

Re: HFS Disk Maker: Tool for creating HFS disk images

Post by CharlesS »

The "format" for an uncompressed disk image is just the raw bits and bytes of the disk copied straight into a file. If you copy the bytes straight from /dev/rdiskN to a file, you've basically just made an uncompressed disk image. Actually, you can actually create a completely empty file containing nothing but zeroes, stick a ".dmg" extension on it, and hdiutil -nomount will attach it. It won't mount on the Desktop, of couse, but it will show up as a non-formatted hard drive that you can then format using the standard tools, after which it's a perfectly ordinary disk image.

An uncompressed NDIF and an uncompressed DMG are pretty much exactly the same thing. In fact, if you have one of those NDIF images that the Finder gives you that "legacy image should be converted" error for, if it's uncompressed, you can make a copy of it, nuke the resource fork, and nuke the type/creator code, and suddenly it will mount just fine with no errors at all. This is because the bits in the resource fork and HFS metadata that identify the format as NDIF are the only thing that distinguish an uncompressed NDIF from an uncompressed DMG. Where the two differ are when you start doing fancy stuff like compression, encryption, etc. And since just writing out the structure of an HFS volume straight to a file is exactly what my tool is doing, I'm not worried about hdiutil ever discontinuing support for it.

What could happen is fsck eventually losing support for scanning HFS volumes, but that's not a problem either since it's open source software. If and when HFS support is removed from the current fsck (and I'm sure it'll happen eventually), all I'd have to do is download the source code for the last version of fsck that supported HFS, bundle it with the app, and add the appropriate attributions to the documentation in accordance with the terms of the APSL. Theoretically, I could even modify the fsck code so that it could read directly from my image and cut out the hdiutil middleman completely (and then I could go back to supporting .dsk and other arbitrary extensions that hdiutil doesn't like), although as long as HFS support remains in the trunk, I might as well just continue using that and automatically get any improvements Apple happens to make to it in future OS X releases.
There's no earthly way of knowing, which direction we are going, for the rowers keep on rowing, and they're certainly not showing any signs that they are slowing.
User avatar
Ronald P. Regensburg
Expert User
Posts: 7821
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: HFS Disk Maker: Tool for creating HFS disk images

Post by Ronald P. Regensburg »

A very useful tool indeed, especially now that we cannot write to HFS volumes anymore in later OSX versions.

I added a link to this topic on the Downloads page in our wiki: http://www.emaculation.com/doku.php/downloads
User avatar
adespoton
Forum All-Star
Posts: 4227
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: HFS Disk Maker: Tool for creating HFS disk images

Post by adespoton »

CharlesS wrote:...the bits in the resource fork and HFS metadata that identify the format as NDIF are the only thing that distinguish an uncompressed NDIF from an uncompressed DMG.
Aha! This it the bit that was troubling me, as I couldn't figure out why Disk Utility was erroring on NDIF when I couldn't see any difference between them myself. I think I'll write up an "Uncompressed NDIF to DMG converter" when I get home tonight... I could probably even make it work in both directions :) Since the resource fork won't have anything in it pertaining to the contents (just the image itself), I think such a thing would be pretty safe.

Then again, you could roll this into your disk maker too ;)

Now to see if I can make this work with my HFS CD images.
robbo007
Student Driver
Posts: 10
Joined: Mon Jul 07, 2008 9:22 pm
Location: Valencia, Spain

Re: HFS Disk Maker: Tool for creating HFS disk images

Post by robbo007 »

Seems diskmaker crashses on Mavricks? Anyone else got the same problems. I'm trying to create a HFS image for Shoebill.

Thanks,
Rob
User avatar
Ronald P. Regensburg
Expert User
Posts: 7821
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: HFS Disk Maker: Tool for creating HFS disk images

Post by Ronald P. Regensburg »

robbo007 wrote:Seems diskmaker crashses on Mavricks?
Must be something else. HFS Disk Maker works fine here in Mavericks (10.9.2).
robbo007
Student Driver
Posts: 10
Joined: Mon Jul 07, 2008 9:22 pm
Location: Valencia, Spain

Re: HFS Disk Maker: Tool for creating HFS disk images

Post by robbo007 »

I'm trying to get A/ux running under Shoebill. You don't happen to have a created HFS volume do you?
User avatar
Ronald P. Regensburg
Expert User
Posts: 7821
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: HFS Disk Maker: Tool for creating HFS disk images

Post by Ronald P. Regensburg »

robbo007 wrote:You don't happen to have a created HFS volume do you?
Not sure why you ask. Isn't that what HFS Disk Maker does? I used it to make a HFS disk image from a folder with files.
User avatar
Ronald P. Regensburg
Expert User
Posts: 7821
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: HFS Disk Maker: Tool for creating HFS disk images

Post by Ronald P. Regensburg »

Apparently HFS Disk Maker works only in OSX 10.9 (Mavericks). Maybe because it was compiled on 10.9? I wonder if it could be created fro 10.6 and up.

In the meantime I will add this information in the link's label in the download area in our wiki.
User avatar
cardioid
Student Driver
Posts: 18
Joined: Mon Jan 05, 2015 11:55 pm

Re: HFS Disk Maker: Tool for creating HFS disk images

Post by cardioid »

Hi and sorry if this a really dumb question, but this app only seems to run in Classic mode. I thought you'd create a disk image in OSX and then open that in the emulator? Is that not how it's supposed to work?

Thanks,
cardioid
MacPro with OSX 10.6.8, Mini vMac 3.2.3 with 6.0.7
User avatar
Ronald P. Regensburg
Expert User
Posts: 7821
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: HFS Disk Maker: Tool for creating HFS disk images

Post by Ronald P. Regensburg »

The app runs in OSX. It did run fine here in OSX 10.9.x (Mavericks) and still does in 10.10.1 (Yosemite). It creates HFS volumes that can be used with emulators that run MacOS versions (8.0 and earlier) that cannot use HFS+ volumes.
User avatar
cardioid
Student Driver
Posts: 18
Joined: Mon Jan 05, 2015 11:55 pm

Re: HFS Disk Maker: Tool for creating HFS disk images

Post by cardioid »

Ok, the app requires 10.9. I have 10.6.8 and I get an error message that it requires 10.9. An interesting message actually, since I never knew there could be messages that refer to a future system...

Do you know of a tool that creates an image under 10.6 or a link where I can download one?

Thanks,
cardioid
MacPro with OSX 10.6.8, Mini vMac 3.2.3 with 6.0.7
User avatar
Ronald P. Regensburg
Expert User
Posts: 7821
Joined: Thu Feb 09, 2006 10:24 pm
Location: Amsterdam, Netherlands

Re: HFS Disk Maker: Tool for creating HFS disk images

Post by Ronald P. Regensburg »

(The file info.plist inside the application states that minimum system version is 10.9. That's how your system knows about a future system version.)

With which emulator do you want to use the disk images?
User avatar
cardioid
Student Driver
Posts: 18
Joined: Mon Jan 05, 2015 11:55 pm

Re: HFS Disk Maker: Tool for creating HFS disk images

Post by cardioid »

Ronald P. Regensburg wrote:(The file info.plist inside the application states that minimum system version is 10.9. That's how your system knows about a future system version.)

With which emulator do you want to use the disk images?
I'm using Mini vMac. I just used my wife's MacBook Pro which has 10.9 (go figure) and now it worked. So I now have bootable disk image transfered via a USB stick to my SL machine with all my goodies. Unfortunately, I can't get ImportFL to work, but I'll post that into a new thread.

Thanks!
MacPro with OSX 10.6.8, Mini vMac 3.2.3 with 6.0.7
Post Reply