Mac OS X has been able to use parallel ATA disks larger than 128 GiB using the extended 48-bit Logical Block Addressing (LBA) since version 10.2, if it is also supported in the Open Firmware for booting the OS (Apple support article 86178, but xlr8yourmac.com lists more systems with native support).
Open Firmware signals this capability by the presence of a simple property in the device tree at the ATA controllers node. Since this is not a hardware limitation adding this property will enable certain older Macs to use large hard disks using the driver included in Mac OS X.
The following script (available for download as enable-lba48) can be launched from the Finder and will insert the required FCode (shown in single quotes after nvramrc=) in front of the nvramrc, as this property must be set on every system start:
(An administrator password is required to set nvram variables.)
#! /bin/bash - [[ `kextstat -lb com.apple.driver.KeyLargoATA` = *KeyLargoATA* && `ioreg -p IODeviceTree -n ata-4 -w0` != *lba-48* ]] || exit read -rd $'\0' nvram nvramrc << nvramrc `nvram nvramrc 2>&-` nvramrc sudo nvram 'use-nvramrc?=true' \ nvramrc='dev mac-io/ata-4 0 0 " lba-48" property device-end'" $nvramrc" && echo '48-bit LBA support will be enabled on the next reboot.' sudo -k
The script first verifies that the KeyLargoATA driver is used (the Key Largo south bridge hosting two ATA controllers was first introduced in the Sawtooth) and the property named lba-48 has not been set so far (indicating an older firmware limited to 28-bit LBA). It will only do this for the ATA-5 Ultra DMA/66 bus (where the hard disks are usually connected); replacing both ata-4
with ata-3
should enable support for large hard disks on the secondary bus used for optical and zip drives (although running large disks on the slow bus doesn't really make sense).
After a reboot large drives will get tagged with a property named extended LBA capacity and the full number of blocks as its value. The command line
ioreg -c ATADeviceNub | fgrep -1 "extended LBA capacity"
can be used to show the recognized drives which must be repartioned in Disk Utility to use the full capacity.
CAUTION: This will erase all data on those drives !
I'm running this configuration with a new WD 500 GB drive in a Sawtooth under Mac OS X 10.4.11 and 10.5.1 for a few weeks now without any problem. It should also work on other Macs without 48-bit LBA support built before 2002 as the PowerMac G4 or the Cube, maybe even the latest PowerBook G3. I'd like to see some feedback on this topic.
Advantages of this method:
- The required driver is already installed with Mac OS X (and has been there since 10.2).
- Future system updates won't break the systems own driver.
- Even the installation CD/DVD has the driver and can be used for a volume check or a restore from a Time Machine backup.
Disadvantages:
- (Native) MacOS 9 doesn't know (and care about) the lba-48 property so it will NOT be enabled to recognize storage beyond 128 GiB (the limit of 28-bit LBA) — I didn't mind, but Apple hints in the support article given above that the MDD comes with an enhanced version of MacOS 9.2.2 that can access partions up to 200 GB in size. Intech offers the Hard Disk SpeedTools For MacOS Classic as an alternative.
- Clearing the parameter RAM (
weak batterie, Command-Option-P-R on reboot, other installers overwriting the nvramrc) will limit the drives to 128 GiB again until the script is rerun and the system is rebooted; this poses a risk of file system corruption (but see below). - Booting fails if any system file needed in the early boot process extends beyond the first 128 GiB as the Open Firmware can't access it¹. This is the prime reason why Apple limits the driver on older systems. Even if it works on a fresh install it will fail when the disk gets filled up and the next system update relocates a critical system file above the limit. It is therefore strongly recommended to follow Intechs Safe Partitioning guidelines in the SpeedTools ATA Hi-Cap Support Driver User's Guide.
⑴ FireWire target disk mode is also implemented in the BootROM and will be limited to 128 GiB. - The partition table can't be easily extended if there are already files on a drive; again Intech seems to include an utility named Hi-Cap Extender for this purpose with its SpeedTools ATA Hi-Capacity Driver.
Some technical details can be learned from the open source of Leopards drivers:
- In KeyLargoATA-111.3.1/KeyLargoATA.cpp, method KeyLargoATA::probe tests for the lba-48 property.This leads to a second approach: Recompile the driver without this test and there will be no need for the nvramrc (but it has to be done for every new release).
- In KeyLargoATA::provideBusInfo the maximum transfer size at the driver level is raised for large drives from 128 KiB to 1 MiB to optimize the throughput of modern hard disks.
- IOATADevConfig::sDriveSupports48BitLBA in IOATAFamily-202.0.1/IOATADevConfig.cpp tests drives for 48-bit LBA capability (as they are all required to be 28-bit LBA compliant as well), used by ATADeviceNub::publishVendorProperties in IOATAFamily-202.0.1/ATADeviceNub.cpp to publish the extended LBA capacity property.
- Finally IOATAController::issueCommand in IOATAFamily-202.0.1/IOATAController.cpp splits an Extended LBA into two halves and sends them one after the other. This shows that 48-bit addressing is just a protocol extension designed to be compatible with older hardware.
3 comments:
More information on how to access large hard drives from Mac OS 9 can be found in a thread on CubeOwner.
You! Are! A! God!
Yep, you are just *great*!
As an Intech Hi-Cap-User I have been struggeling with each change of harddisks, each new OS-version and some OS-updates. Having almost given up on the cube, I googled about the imminent 10.5.7-problem of the Intech-drivers being deleted during the update and came across your site.
In hindsight, I could beat myself for not having look more thoroughly earlier. Your post exists since 2007.12. This could have spared me years (literally) of hassling with the Cube. Well, thanks for still having your site up!
While reading the other posts, it seems you are quite inside the open firmware. Now this is not exactly something we all will stumble upon at some time. How come you do take so much interest in it? Has it something to do with your work?
Simply Awesome!
I can sort of understand the logic of not making this native in older systems but woah...
I was seriously considering a new ATA or SATA PCI controller for my QS 2001 or even reluctantly, very reluctantly shelling out for the kext...
Not any more... genius bar material! :)
Post a Comment