This procedure worked for me. I used two Intel Mac's and one PowerPC Mac in the recipe. If you don't have so many Macintoshes, you'll have to run Disk Utility off the Install CD, involve external Firewire hard drives set up a Linux NFS and BSDP server for NetBoot, or something.
luser@mac:/Volumes/the_image$ sudo rm var/db/BootCache.playlist var/db/volinfo.database System/Library/Extensions.kextcache System/Library/Extensions.mkext
luser@mac:/Volumes/the_image$ sudo rm -rf var/vm/*
Be sure to leave off the leading slash, so you're not deleting these files from the booted system. There is an alternate list of ``special'' files here, but that is not the list I used.
Unchecking Erase asks for a file-copy restore, while checking Erase asks for a block-copy restore. In our case, the end result should be the same, because we've just erased the target disk by partitioning it.
The utility which implements Restore, asr
, claims in its
man page that it's able to do an Erase-style block copy from an HFS+
image into an HFSX filesystem (that's what we want). However, when
invoking it through Disk Utility, I found if I allow asr to Erase the
target, I always get the same case sensitivity type of restored
filesystem as the image type. asr needs some special command line
options to work in filesystem conversion mode. I discovered the
workaround just described before reading the man page, so I'm telling
you the tested procedure instead of the possibly faster but likely
broken alternative through Terminal.
/dev/disk1s<n>
where
<n>
varies.
/dev/disk1s3
according to Console, then type the
following command:
Script started on Tue Apr 22 17:56:23 2008
bash-3.2$ PS1=\\h:\\w\\\$\
cashiers-imac:~$ sudo pdisk /dev/disk1
Password:
Edit /dev/disk1 -
Command (? for help): p
Partition map (with 512 byte blocks) on '/dev/disk1'
#: type name length base ( size )
1: Apple_partition_map Apple 63 @ 1
2: Apple_Boot Booter 262144 @ 64 (128.0M)
3: Apple_HFSX Untitled 264347312 @ 262208 (126.1G)
4: Apple_Boot Booter 262144 @ 264609520 (128.0M)
5: Apple_HFSX Untitled 47710128 @ 264871664 ( 22.7G)
6: Apple_Free 16 @ 312581792
Device block size=512, Number of Blocks=312581808 (149.1G)
DeviceType=0x0, DeviceId=0x0
Command (? for help): t
Partition number: 2
Existing partition type ``Apple_Boot''.
New type of partition: Apple_HFS
Command (? for help): w
Writing the map destroys what was there before. Is that okay? [n/y]: y
The partition table has been altered!
Command (? for help): q
cashiers-imac:~$
You need to make some effort to enjoy working with pdisk. The Apple Partition Map is the finest partition map on any operating system. It contains no bullshit about ``geometry'', allows sector-granularity allocation, includes a partition for the partition map, and is extremely old. It includes important sanity-maintaining concepts which other maps have abandoned like ``every sector must be covered by the map exactly once, no overlapping partitions and no unpartitioned space allowed,'' and ``partitions have a 'type' which must match the expectation of the software writing to the blocks inside the partition, and a 'name' which said software may safely ignore,'' and ``partitions have a definite numbering starting at 1, a numbering which cannot have any gaps in it because it is implied, but there is no fixed limit on the number of partitions, and also in general the best way to find a partition is by looking for the desired 'type' and then peeking at labels and serial numbers inside the contained filesystem itself, NOT using the map partition number.'' Unix and MBR partitions break ALL these rules, and many others. In addition older Mac OS had a couple other really cool rules:
I love these rules. I don't know why they weren't obvious to everyone, yet almost no one but Apple got them right.
The EFI map copies its spirit, but without the merit of being so old and with some added elegance (GUID's), some missing elegance. There were some very old Macs that used a different, worse partition map, though. There are fancier arguably better ways to partition disks, like LVM2 physical volume tags in Linux/AIX, and ZFS whole-disk mode, but for a plain old partition map, which is still often needed, the Apple map is the best that ever existed. Too bad almost nothing understands it!
You'll notice Disk Utility created quite a few partitions for which we never asked. It always makes those Apple_Boot partitions near other partitions with modern filesystems on them. The Apple_Boot partitions are plain HFS partitions which are easy for old firmware to read.
In this typescript above we've converted the Apple_Boot partition which immediately preceeds our interesting partition into an Apple_HFS partition which the Mac OS will be willing to mount. And quitting pdisk should signal the Mac OS to try remounting all the new partitions. The old Apple_Boot volume should pop onto the Desktop now. You can see the HFS filesystem inside it is named Boot OSX. Spooky, eh?
There are three kinds of blessings: Mac OS 9, Mac OS X ppc, and Mac OS
X i386. And blessing itself is a tangled concept involving several
tasks: setting firmware variables, writing bootblocks, writing
second-stage loaders, and marking the folders containing second-stage
loaders in the filesystem's headers. The bless
tool can
do all these things, but in particular the writing of firmware
variables is impossible in this case because we are not running on the
same machine that'll do the booting, and there's no way to warn
bless
of this fact (booting off Firewire is
possible), and rumors on the web say Startup Disk does a better job
than bless
at writing firmware variables. And boot
blocks only apply to OS 9: all OpenFirmware machines are filesystem
grovelers and don't use bootblocks except when older OpenFirmware
machines are booting NetBSD. I'm not totally sure how to control all
these bless
functions independently, to
stop bless
from writing firmware variables
wrongly, but I didn't have any problems. FTR, what we care about: Mac
OS X ppc blessing, Mac OS X i386 blessing, second-stage loader
writing, and marking folders in filesystem headers.
cashiers-imac:~$ sudo bless --folder /Volumes/ppc-firewireHD/System/Library/CoreServices/ --bootinfo --bootefi
Password:
cashiers-imac:~$
bless
just wrote into the root of
the Boot OSX volume, and bless the Boot OSX volume.
cashiers-imac:~$ sudo cp /Volumes/ppc-firewireHD/System/Library/CoreServices/BootX /Volumes/Boot\ OSX/
cashiers-imac:~$ sudo bless --folder /Volumes/Boot\ OSX/
cashiers-imac:~$
cashiers-imac:~$ pdisk /dev/disk1
Edit /dev/disk1 -
Command (? for help): p
Partition map (with 512 byte blocks) on '/dev/disk1'
#: type name length base ( size )
1: Apple_partition_map Apple 63 @ 1
2: Apple_HFS Booter 262144 @ 64 (128.0M)
3: Apple_HFSX Untitled 264347312 @ 262208 (126.1G)
4: Apple_Boot Booter 262144 @ 264609520 (128.0M)
5: Apple_HFSX Untitled 47710128 @ 264871664 ( 22.7G)
6: Apple_Free 16 @ 312581792
Device block size=512, Number of Blocks=312581808 (149.1G)
DeviceType=0x0, DeviceId=0x0
Command (? for help): t
Partition number: 2
Existing partition type ``Apple_HFS''.
New type of partition: Apple_Boot
Command (? for help): w
Writing the map destroys what was there before. Is that okay? [n/y]: y
The partition table has been altered!
Command (? for help): q
cashiers-imac:~$
If for some reason it doesn't, hold down Option during boot to make OpenFirmware probe for a choice of auto-bootable devices (this takes like a minute, while it shows you the wristwatch pointer). There are even more forceful ways through Command-Option-O-F command line interface to explicitly name an Apple_Boot partition and a file within it, regardless of Blessings, but I did not need to do that.
You might think these things would work, but they don't:
It's an order of magnitude slower than a Firewire case. Then, it craps out entirely. A PowerPC iMac or an i386 iMac both seem approximately half the speed of a Firewire case.
It gives errors during the checksum phase, or it restores images that don't boot. Maybe the problems are with the Firewire initiator, or the partitioning, or some other small piece. Whatever. After I had a few problems with it that I didn't have on 10.5, I quit using it entirely. Use 10.5 Disk Utility and 'bless' tools for everything.
I think there is all kinds of background indexing and time machine garbage that isn't properly synchronized and abortable through ``volume management'' or ``disk arbitration'' or whatever they are calling this constantly problematic subsystem these days. But I have found nothing with 'lsof', and 'fuser' and 'fstat' seem to be missing.