On 6/5/07, Dan Shoop <email@hidden> wrote:
At 3:38 PM -1000 6/4/07, Sergio Trejo wrote:
Thanks for pasting the above
controllerHasFixedHeight error information (I was not able to find
that specific information yesterday). Is it located in a header (.h)
file somewhere within the recesses of Mac OS X Server?
Use the following to locate "known error" codes in OS
X:
#!/usr/bin/perl
use warnings;
use strict;
# variables:
my ($path,$file,$name,$desc,$errnum);
# set the path to the header file
$path = '/System/Library/Frameworks/'
.'CoreServices.framework/Versions/Current/Frameworks/'
.'CarbonCore.framework/Versions/Current/Headers/MacErrors.h';
# open it and search for each argument.
while($errnum=shift){
open $file, '<', $path;
while(<$file>){
if (m/=\s$errnum\,/) {
$name=$_;
$name=~s/^\s*(\S*)\s.*$/$1/;
chomp $name;
$desc=$_;
$desc=~s:^.*?/\*(.*)\*/:$1:;
chomp $desc;
print "$name ($errnum): $desc", "\n";
}
}
close $file;
}
exit 0;
Thank you very much for providing this script to the mailing list.
However while this will give you the code description for a given
error code it's usually meaningless, as I pointed out.
In your case it is very meaningless since it obviosuly doesn't
apply to the tool that you are using ;)
Even if it is known where to find
these error codes, I concur that human parsing of this information to
grok semantics of what this error means is probabilistically
impossible at first glance.
It's not just that, it's like when you go to the doctor and you
say "doc it hurts me to do this" and he tell's you
"then don't do that".
Seriously.
The value of an error on the Mac has never been as relevant as
the fact that you got the error. It's indicative of something you're
doing wrong most of the time. As it was in your case.
Ugh! So then my next set of questions (hopefully these are the "right" questions to
ask) are:
Was it my misuse of the diskutil command-line tool? Was it that I shouldn't have been using diskutil in the first place to manage RAID volumes? Or was it several steps before using diskutil (e.g., I probably really shouldn't have used Disk Utility app to create the partition maps to begin with and should have used a tool such as pdisk)?
If a budding Mac OS X Server admin wants to manipulate physical discs such that they can
be logically partitioned to include one but no more than one RAID mirror (using Apple's software RAID
version 2 which is included in Mac OS X Server 10.4.9 -- on an Xserve computer, not an Apple fiber channel-based Xserve RAID storage machine), what tool(s) should be used for RAID mirror
manipulation and management and what tools should be avoided?
And you are doing this with what tool(s)?
DiskUtility (I have the feeling I will be
in big trouble for using the convenience of the Disk Utility GUI-based
application rather than using diskutil on the command line
(ducking)).
Remember "GUIs are good for making simple things simple and
complex things impossible."
Good adage to be reminded of, thanks. I haven't been using Disk Utility for any type of RAID creation, manipulation or destruction actions ... I have only used the command line. However, following Josh's article on
AFP548.com about Apple RAID, the article doesn't state that the Disk Utility GUI-based app should be avoided at all costs and in all contextes with respect to RAID sys admin:
http://www.afp548.com/article.php?story=AppleRAID2-in-Depth&query=raid
On Mac OS X there are two main interfaces for dealing with disks, Disk Utility and its command line counterpart diskutil. As was the case on Mac OS X 10.3, the diskutil
tool can perform a few more functions than Disk Utility. The gap has
narrowed though, and for many tasks it is far simpler to use Disk
Utility's GUI. For the examples in this article we will use both tools
where appropriate. A safe rule of thumb when dealing with the
differences between the two tools though is that the non-destructive
creation and removal tools for dealing with raid sets and members exist only in diskutil. Additionally, there are some cases where Disk Utility will become confused and out of sync with the status of
raid sets. In those instances you can typically clear things up by restarting Disk Utility.
However, the article does say this about the -9998 error (the same one which I received when attempting to perform a diskutil command with the enableRAID verb):
Really the only two situations in which I have seen the enableraid command fail is when the disk is slap full of data or if the Mac O9 drivers are installed. In these cases you will get errors like the following:
josh$ sudo diskutil enableraid mirror disk2s10
Changing filesystem size on disk 'disk2s10'...
Attempting to change filesystem size from 18232721408 to 18234343424 bytes
Filesystem grow failed, 1
Disk Management could not shrink the filesystem to fit the new raid headers
Error enabling disk to raid Invalid request (-9998)
In the case of my non-RAID partition which I had recently restored using asr from a compressed and checksum verified disc image snapshot, while I don't know what Josh meant semantically and quantitatively as "slap full of data", in my case the percentage of data use on the volume relative to its total capacity was on the order of 4% (very small relatively speaking) so I don't think this would qualify as "slap full of data". Furthermore, Disk Utility in Mac OS X Server
10.4.9 does not allow one to create new partition members whose volumes residing on those partitions include the optional "Mac OS 9 drivers" (unlike Disk Utility on Mac OS X 10.4.9).
The error would seem self explanatory here. You don't have
room in the partition map for the necessary RAID headers.
What would cause my partition map to (unintentionally)
change,
Nothing's causing it to change, it's just it's not adequate for
what you're trying to do.
Are there any reliable books or on-line Wikis / PDF documents (besides merely man pages) that cover the appropriate tools that should be used for both setting up partition maps on physical discs which discs will included one and only one partition to be included in a RAID mirror, and the tools to use for manipulating those RAID volumes? Is it a simply a matter of using pdisk rather than Disk Utility to initialize a partition map correctly (and then afterwards diskutil is fine to use with its RAID-related verbs)? I do have Amit Singh's Mac OS X Essentials but his main coverage of Apple RAID on page 344 is in the context of setting up a RAID device configured for booting. In my particular case, I don't need my RAID mirror to be bootable (but I understand that everyone's cases are different).
particularly after successfully
performing an asr restore at the device level to this dedicated target
non-RAID partition from a compressed and checksum verified disc image
snapshot (using hdiutil) which was originally made of the same
partition after it had been split off from the RAID mirror
successfully before destroying the mirror with the diskutil
destroyRAID verb?
Again, nothing. It's just that the partition map doesn't have the
room necessary to promote the disk to one that supports RAID.
So logically the partition map needs to be initialized in the first place to have extra slack such that it can
promote non-RAID partitions to RAID members (e.g., taking the case of a mirror member). Would this extra slack be in the form of unused "free space" in the partition map and if so, what is the recommended quantity of unused slack that should be set aside for Apple RAID software version 2 in a partition map for RAID mirror membership inclusion? Is there a recommended formula or algorithm for deterministically calculating the number of bytes to set aside?
Does the
demotion (from RAID to non-RAID once a RAID mirror is destroyed such as using the diskutil destroyRAID verb) require any additional slack in the partition map?
Is this quantity of "slack" that can be set aside in the partition map finite and linear such that no
matter how many times a sole, dedicated partition on a physical drive is cycled (demoted state to promoted state to demoted state), assuming a fixed maximum partition size which the data on volume residing on the partition would not exceed, the partition map will always be capable of withstanding such cyclic man-made waves without having to change this "slack" quantity?
As an aside but related, Josh gives us the warning that enableRAID modifies the partition map (I had forgotten about this since it was a while ago that I had read this article), but is enableRAID really all that dangerous? Who originally said (was it Apple?) that "Enabling raid is an inherently dangerous operation"?
1. MAKE A BACKUP! You are about to live edit the partition table of a volume. To borrow a phrase from diskutil, "Enabling raid is an inherently dangerous operation.".
2. Boot from something else. An external HD with the latest version of Mac OS X is probably your best bet.
3. Identify the disk slice or volume mount point that you want to enable the raid on. Let's say that the disk I want to enable is mounted at /Volumes/BootDisk
4. Continuing with our example, fire off, 'sudo diskutil enableraid mirror /Volumes/BootDisk'. The volume will unmount and the re-appear a few moments later.
Does the destroyRAID verb cause the
partition map to morph?
Yes. All the RAID verbs do.
I'd suggest you start looking at the partition maps more
closely and all should be revealed.
Thank you, great advice. Should I expect
that partition maps morph throughout the life and usage of disks which
have multiple partitions which included one (but only one) partition
which is a member of an Apple RAID mirror?
No they don't normally change at all but to enable RAID on a
volume the disk's partition map must be munged to make it a disk that
supports RAID.
That seems logical and reasonable to expect. The Mac OS X Server sys admin art therefore seems to lie in intuiting what Apple's Software RAID does under the hood and then figuring out how to plan for these morphing actions when originally setting up a partition map for a physical disc that will have multiple partitions and one but only one of which will participate in a RAID superset.
Thanks much,
Serg