Corrupted/Erased HardDrive Boot Blocks

Pyrogasm

There are some who would use any excuse to ban me.
Reaction score
134
So... I was changing harddrive partitions to setup a new partition to run (and learn how to use) Ubuntu linux... and then I did the retarded thing of actually using the Ubuntu partitioner to set up my partitions!

I resized my OS X partition just fine, but then it asked for a format for the partition. Well, me being the ignorant idiot, I called up my friend who I figured would know what format I should use. The problem then being that he gave me the wrong format (I think the drive is "XFS" now, or something like that).

A few minutes later, he hurridely called me back to inform me that he'd given me false information and that I needed to go back and change the format. So I clicked the "reset partitions to previous settings" button and figured I would just head to bed for the night. So, I cancelled the setup and shut down my computer. (Note: no personal data on the drive had been erased at this point)

The next morning, lo and behold, the computer does not recognize my HD as a bootable drive (mind you, this is after I thought I reset the partitions without any adverse effects), and when I ran the Ubuntu partitioner again, it said that my HD's format was what I accidentally set it to the previous night and that information about the drive's space was "unknown".

The next thing I tried was to insert my OS X install CDs and run "Disk Utility" to try to repair the disk. No luck; I got a generic error message that said that the disk could neither be verified nor repaired. At this point, I went to my friend's dad (who works at a Macintosh data recovery shop) for suggestions as to what I might have done to my HDD. He determined that I have corrupted or erased my drive's boot blocks.

I've been researching this, and that does seem to be the case... but nothing I've tried works. I've attempted to zap the PRAM and bless the System Folder (which I couldn't figure out how to do; instructions I've found say to use the startup disks to boot to a working desktop; my startup disks don't go to a demo desktop, but rather to an install window).

None of the data on the disk has actually been lost... it's just inaccessible. I also have an external with a somewhat recent backup, but because of my current internet status (dialup) I'd rather not resort to wiping my HD, doing a fresh install, and having to update everything. So I'm asking here... who knows how to repair f-'d up boot blocks on a previously-OS X formatted HDD?

Or what are my other options?
 

enouwee

Non ex transverso sed deorsum
Reaction score
240
So I clicked the "reset partitions to previous settings" button and figured I would just head to bed for the night. So, I cancelled the setup and shut down my computer. (Note: no personal data on the drive had been erased at this point)

[...]

None of the data on the disk has actually been lost... it's just inaccessible. I also have an external with a somewhat recent backup, but because of my current internet status (dialup) I'd rather not resort to wiping my HD, doing a fresh install, and having to update everything. So I'm asking here... who knows how to repair f-'d up boot blocks on a previously-OS X formatted HDD?

Or what are my other options?

Are your MacOS partitions still present in the partition table or have they been erased (is it a DOS-type partition table or Mac)? Judging by your description, they've been overwritten. Are you 100% sure that you didn't create a partition that spans the whole disk?

You can recover lost partitions using various tools such as Partition Magic or Testdisk ( http://www.cgsecurity.org/wiki/TestDisk ). Known to work fine on DOS partition tables and could work for an EFI MacOS too, assuming you're able to get the system to boot from that CD.

Now, for restoring a MacOS MBR ... sorry, I have no idea. The that's the bootloader's job, like reinstalling LILO/GRUB on Linux or running "fdisk /mbr" on Windows.

EDIT:
I hope you're able to understand german, as the ma'am in this forum seems to have done exactly the same thing you did and there are plenty useful hints in there:
http://www.apfeltalk.de/forum/mbr-reparieren-t34188.html

Sorry, but after almost 11 hours at work, I'm not in a mood to translate :p
 

Pyrogasm

There are some who would use any excuse to ban me.
Reaction score
134
As far as I know, I did not erase all the previous partitions. I can, however, check to see what the Ubuntu Partitioner says.

I've found some terminal commands for blessing system folders/setting boot blocks, but I have determined that the HD is not mounted and refuses to mount, thus I have no directory for the HD! Here are the commands I uncovered:
Code:
bless

Set volume bootability and startup disk options.
bless is used to set volume bootability characteristics for PPC-based Macs. It can also modify Open Firmware to select a different boot device. 
bless has 3 modes of execution: Folder Mode, Device Mode, and Info Mode. 

SYNTAX

     bless -info [directory] [-getBoot] [-bootBlocks] [-plist]
	   [-quiet | -verbose] [-version]

     bless -device device [-format [fstype] [-fsargs args]
	   [-label name | -labelfile file]] [-bootBlockFile file]
	   [-mount directory] [-wrapper file] [-startupfile file]
	   [-system file] [-setBoot] [-quiet | -verbose]

     bless -folder directory [-folder9 directory] [-mount directory]
	   [-bootinfo file] [-bootBlocks | -bootBlockFile file] [-save9]
	   [-saveX] [-use9] [-system file] [-systemfile file]
	   [-label name | -labelfile file] [-openfolder directory] [-setBoot]
	   [-quiet | -verbose]
	   
     bless -help
	 
FOLDER MODE OPTIONS:

     -folder directory	    A blessed Mac OS X/Darwin system folder, containing
			    a BootX secondary loader for New World machines.

     -folder9 directory	    A Mac OS 9/Classic system folder. If both -folder
			    and -folder9 are given, preference can be given to
			    boot into Mac OS 9 by also using the -use9 flag.

     -mount directory	    In lieu of specifying folders to bless, -mount can
			    be given, and the pre-existing blessed folders are
			    used.
     -bootinfo file	    Create a BootX file in the Mac OS X/Darwin system
			    folder using file as a source.
     -bootBlocks	    Set the boot blocks on the volume. This is
			    required for booting Mac OS 9. Boot blocks can be
			    retrieved from the System file in the blessed Mac
			    OS 9 system folder, or can be specified more
			    directly using the -bootBlockFile or -system
			    flags.
     -bootBlockFile file    Extract boot blocks from file . The first 1024
			    bytes are read from the data fork of that file.
     -save9		    Used if no -folder9 flag was given, but if the
			    pre-existing Mac OS 9 system folder should be pre-
			    served.
     -saveX		    Used if no -folder flag was given, but if the
			    pre-existing Mac OS X/Darwin system folder should
			    be preserved.
     -use9		    Used if both -folder and -folder9 were given, but
			    Mac OS 9 should be the default for the volume.
     -system file	    Extract boot blocks from the file System file,
			    using the Carbon resource manager. This will fail
			    under Darwin, where Carbon is not present.
     -systemfile file	    Data fork System file to place in blessed System
			    Folder
     -label name	    Render a text label used in the OpenFirmware-based
			    OS picker
     -labelfile file	    Use a pre-rendered label used for the Open-
			    Firmware-based OS picker
     -openfolder directory  Specify a folder to be opened in the Finder when
			    the volume is attached
     -setBoot		    Set the system to boot off the specified parti-
			    tion. This is implemented in a platform-specific
			    manner. On Darwin PPC, the Open Firmware
			    boot-device variable is modified. On Darwin x86,
			    the MBR partition map is adjusted to mark the
			    specified partition as active
     -setOF		    Set the boot-device Open Firmware variable to boot
			    off the volume containing. This option is depre-
			    cated in favor of the more generic -setBoot
			    option.
     -quiet		    Do not print any output
     -verbose		    Print verbose output

DEVICE MODE OPTIONS:

     -device device	    Open the block device device . No volumes should
			    be mounted from device .
     -format [fstype]	    Format the device using the fstype filesystem, or
			    if it is not given, default to HFS+ with an HFS
			    wrapper.
     -fsargs arg	    Additional arguments to newfs for the given
			    filesystem
     -label name	    Give the filesystem the label while formatting, or
			    set an OF-cased OS picker label
     -labelfile file	    Use a pre-rendered label used for the Open-
			    Firmware-based OS picker name (in UTF-8 encoding)
     -bootBlockFile file    Extract boot blocks from file . The first 1024
			    bytes are read from the data fork of that file.
     -mount directory	    Use directory as a temporary mount point for the
			    HFS wrapper.
     -wrapper file	    Mount the wrapper on -mount and write file into
			    the wrapper as the default System file.
     -system file	    Override the file specifications for
			    -bootBlockFile and -wrapper and use this file
			    instead for both those functions.
     -xcoff file	    Add the file as the HFS+ StartupFile, and update
			    the partition map to reflect it's location on
			    disk. This is necessary for Old World booting.
			    This option is deprecated in favor of the more
			    generic -startupfile option
     -setBoot		    Set the system to boot off the specified parti-
			    tion. This is implemented in a platform-specific
			    manner. On Darwin PPC, the Open Firmware
			    boot-device variable is modified. On Darwin x86,
			    the MBR partition map is adjusted to mark the
			    specified partition as active
     -setOF		    Set the boot-device Open Firmware variable to boot
			    off the volume containing. This option is depre-
			    cated in favor of the more generic -setBoot

			    option.
     -startupfile file	    Add the file as the HFS+ StartupFile, and update
			    other information on disk as appropriate for the
			    startup file type.
     -quiet		    Do not print any output
     -verbose		    Print verbose output

INFO MODE OPTIONS:

     -info [directory]	    Print out the blessed system folder for directory
			    . If directory is not specified, print information
			    for the current boot-device (which may not neces-
			    sarily be `/' .
     -setBoot		    Print out which device will be used on next boot,
			    according to the boot-device Open Firmware vari-
			    able. This option will take into account that OF
			    might be pointing to an auxiliary booter parti-
			    tion, and will print out the corresponding root
			    partition for those cases.
     -bootBlocks	    Print out salient fields from the boot blocks of
			    the volume.
     -plist		    Output all information in Property List (.plist)
			    format, suitable for parsing by CoreFoundation.
			    This is most useful when bless is executed from
			    another program and its standard output must be
			    parsed.
     -quiet		    Do not print any output
     -verbose		    Print verbose output
     -version		    Print bless version and exit immediately

  Folder Mode allows you to select a folder on a mounted volume
  to act as the `blessed' system folder, and optionally update
  Open Firmware to boot from that volume.
  Device Mode is normally only used to format and setup a volume
  for the first time.
  Info Mode will print out the currently-blessed folder(s) of
  a volume, or if no mount-point is specified, the volume that
  OF is set to boot from.

 Files  /usr/standalone/ppc/bootx.bootinfo
  Secondary loader with XML headers, used with -bootinfo flag. Used for booting 
  New World PPC-based Macs /System/Library/CoreServices
  Typical blessed folder for Mac OS X and Darwin

 Examples - FOLDER MODE 
  To bless a volume with only Mac OS 9:
   bless -folder9 "/Volumes/Mac OS 9/System Folder" -bootBlockFile "/usr/share/misc/bootblockdata"
 
  To bless a volume with only Mac OS X or Darwin, and create the BootX file:
   bless -folder "/Volumes/Mac OS X/System/Library/CoreServices" 
   -bootinfo "/Volumes/Mac OS X/usr/standalone/ppc/bootx.bootinfo" 

  To set a volume containing either Mac OS 9 and Mac OS X to be the active volume:
   bless -mount "/Volumes/Mac OS" -setBoot 

 Examples - INFO MODE
  To gather information about the currently selected volume (as determined by Open Firmware), 
  suitable for piping to a program capable of parsing Property Lists:
  bless -info -plist -bootBlocks

I can also boot into open firmware mode, so if you've got any ideas for that...

I'll check out that link you gave me for the german site; thanks! If anybody wouldn't mind translating and paraphrasing the important bits, I very much appreciate it; Google Translate isn't the best translator in the world...

EDIT:
After running some disk partition commands, I've gotten the computer to display the partition map, in the hopes that this confirms that I didn't delete everything. It is as follows:
Code:
Partition map (with 512 byte blocks) on '/dev/rdisk0'
#:                type name                    length   base    ( size )
1:Apple_partition_map  Apple                       63 @ 1
2:          Apple_Free                         262144 @ 64      (128.0M)
3:          Apple_HFS  Apple_HFS_Untitled_1 312319584 @ 262208  (148.9G)
4:          Apple_Free                             16 @ 312581792
Device block size=512, Number of Blocks=312581808 (149.1G)
DeviceType=0x0, DeviceId=0x0
 

enouwee

Non ex transverso sed deorsum
Reaction score
240
After running some disk partition commands, I've gotten the computer to display the partition map, in the hopes that this confirms that I didn't delete everything. It is as follows:
Code:
Partition map (with 512 byte blocks) on '/dev/rdisk0'
#:                type name                    length   base    ( size )
1:Apple_partition_map  Apple                       63 @ 1
2:          Apple_Free                         262144 @ 64      (128.0M)
3:          Apple_HFS  Apple_HFS_Untitled_1 312319584 @ 262208  (148.9G)
4:          Apple_Free                             16 @ 312581792
Device block size=512, Number of Blocks=312581808 (149.1G)
DeviceType=0x0, DeviceId=0x0

That's a DOS partition table. You got an Intel Mac, right? If so, according to the guy from that other forum, the only solution is to reinstall the OS and restore the data:

The EFI loader used in Intel-Macs requires valid IDs for every partition (awfully long things like 550e8400-e29b-41d4-a716-446655440000). Without these, the TPM will refuse to boot the OS. Vendor lock-in is great, huh?

My own wild guess (from other UNIX systems): try to mount the root partition and take a look inside the /etc directory, assuming OSX has one. There might be a file named fstab, vfstab or something similar. It contains the mountpoints for the different partitions. On a VMWare ESX server, we were able to recover the UUIDs from that file. Even if you manage to locate the IDs, you'll still need some expert advice (or the right tool) to get them back into the partition table.

To sum up: sorry, looks like you're screwed. Don't mess with your Apple. If you want to run another OS, get a PC. Just as you need bootcamp to install Windows, you'll probably need some similar tool to install Linux. Or get a good step-by-step guide.

I'm not a fan of such shiny high-tech toys, as you have almost no control over the components and can't tweak/change them the way you want. They may look nice, but in the end, you're stuck with what you have.
 

Pyrogasm

There are some who would use any excuse to ban me.
Reaction score
134
I have a PPC iMac G5.


Screw it, I'm wiping the drive and doing things correctly next time. Thanks for your help!
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top