Jump to content

[HowTo] Clone/Restore partitions that BOOT & fixing booting issues


30 posts in this topic

Recommended Posts

This is my first guide. It is about cloning/restoring OSx86 partitions, and mainly the focus is on getting the restored partitions to boot. Using part of the steps, you can also fix non booting partitions that got ruined for some external reason (MBR corrupted, playing around with bootloaders, etc).

 

Things you need first

 

This guide is designed for people wworking from TWO OSx86 hard drives/partitions. It requires that you have acces to two drives/partitions to copy stuff around. Even if your ultimate plan is to only have ONE drive, for the whole clone/restore, as well as recovery from a non booting install, it is better to temporarily use two drives to solve all the problems (do a minimal install on that drive from the DVD).

 

Get startupfiletool (attached at the end of this message) and put it in your /usr/sbin directory. Remember to change executable bit in Terminal (use chmod +x startupfiletool) and owner/group to root:wheel (use chown root:wheel startupfiletool). You are going to need it there in the executable path (/usr/sbin is in the path).

 

From JaS Install DVDs, cp /usr/standalone/i386 to a bootfiles directory in your home (for easy access):

 

mkdir ~/bootfiles
cp /usr/standalone/i386/* ~/bootfiles

 

Also cp boot0 in particular to your own systems /usr/standalone/i386 so fdisk can use it to rebuild MBR for booting (with boot0) (in case you are using complete drives for OSx86 and not just a partition)

 

Starting up

 

Open Disk Utility

Partition target hard drive (choose the DRIVE not the partition)

Options > MBR (not GUID or Apple)

MacOS Extended (journaled)

Keep Disk Util open, it will come in handy to mount and unmount the volume you are working on easily

 

Restore from image, use Carbon Copy Cloner (I deactivated the make bootable tag

in Preferences just in casE), Super Duper, etc. Whatever method you use to restore/close your partition.

 

Setting the correct parameters so your new partition will ever boot

 

Launch Terminal

 

diskutil list

 

(From now on we will assume you are in the bootfiles dir you created previously, @ is your DISK number, # is your PARTITION number)

 

sudo fdisk -e /dev/rdisk@

 

 

Dunno if this next step (fdisk) is absolutely necessary, I included it specially for those of you who damaged their MBRs at some point, as a way to restore it. If you have a dual/triple booting system, and are not using the hardrive exclusively for OSx86, you should skip this step. Rebuilding the MBR is ONLY for those using a full harddrive for OSx86.

 

Once in the fdisk prompt, just for hecks type help and see the commands, then type print just so you take a peek at your partition table and you know where the hell that HFS+ you need to work on is (the number). Next type:

 

reinit
update

 

Take note you need boot0 as specified at the beginning of this post. It is probably not needed to do both (reinit, update), I just didn't know which one actually rewrote the MBR from scratch, so I do both just in case, and it won't hurt your drive EVEN if it is already partitioned and with a working MBR (as if you just run FIXBOOT, but the information is still available in your drive, it just won't boot). Following this commands is NOT DANGEROUS even in a perfectly working drive is what I want you to know.

 

Now we will flag the partition bootable (active) (we are back wether you are using a full drive or a partition)

 

f #

 

This flags the partition bootable, VERY important. You will notice an asterisk besides the partition number if you do a p (print partition table).

 

(Unmount with Disk Utility before the next steps)

 

w
e

 

This is shorthand for write and exit (you can use only the first letter of many commands in fdisk)

 

Still fixing booting, but getting confused

 

In your Terminal window, again assuming you are inside that bootfiles dir we created

 

sudo dd if=boot1h of=/dev/rdisk@s# bs=512 count=1

 

Now unmount the new volume is it is mounted for the next step. What is this next step?

 

sudo startupfiletool /dev/rdisk@s# boot

 

You should get a message that goes somethingn like:

HFS+ filesystem detected

Looking for 1 words free

reading 4096,4096

etc

 

Blessing ... goddamit

 

I could never bless from another booted system (dunno, got "Could not find IODeviceTree" message), so next step is to reboot with JaS DVD in the drive and start with F8 and -s in the prompt that appears (single user mode).

 

Once booted we need to identify our disks so we don't get confused. Don't trust OSX, it assigns numbers however it pleases, so first in the BIOS is not always rdisk0. diskutil list seems to not work or take FOREVER to do it's thing. An easy way to check is to use fdisk:

 

fdisk /dev/rdisk0

 

Check values returned, compared against rdisk1, etc, to identify the HD you want to work on, the target. Of course this only works if the sizes are different or partitioning is distinctive.

 

Once determined, use the bless command (it takes EONS to do it, but be patient, watch the DVD drive light blink, it is happening)

 

bless -device /dev/disk@s# -setBoot

 

(Take note it doesn't use RAW disk, just disk)

 

Once this is finished, remember to set your HD to boot first in your BIOS, remove DVD, and off you go with a new bootable cloned system. Let me know if it works for you.

 

Some considerations

 

Using the last part of this mini tutorial will also get yoy back on track in case you really screw up your system with other bootloaders, partitioning utils, etc. This is why I actually ended up writing it. I couldn't find ANY concise info on how to go about this. The OSx86 forums are great, so is the Wiki, but unfortunately it was all bits and pieces (and many didn't specify for example disk@s# (disk and partition) which only caused the commands to fail without any understandable reason. I am a newbie on some things and not on others. I spent 3 days researching, trying, ruining my other "disk" over and over, until I got a full working method. If it can save you the time, then I am happy I could help. I must tell you, I had TWO SEPARATE DRIVES, all with only one partition, the HFS+ one. You might want to be really careful if you are going to work with disks that have multiple partitions. Particularily when working with FDISK and the MBR.

 

Also, please HELP ME UNDERSTAND many of the things in the boot process I do not understand. It is always better to correct me and let people learn how to fish instead of just handing them a snack :2cents:.

 

Now, after I ruined my OSx86/WinXP box (I even trashed the partition table on the 4 DRIVES!! by using an obscure command line MBR repair tool!), and recovered it (very long story), now I share some of the things I learned. I am still booting with the goddam BIOS selecting each drive (two physical units boot x86 a stable system and a sandbox for fooling with kexts, etc, a third drive boots Windows XP and a fourth drive is a D: in WinXP). I will now try CAREFULLY (disconnecting my OSx86 drives before playing with it), try to use a bootloader, menu and such. But my guess is I will fail like I did before. The good news is I now know how to fix my OSx86 if they stop booting or I need to go back to my last cloned image.

 

Cheers.

Link to comment
Share on other sites

This is my first guide. It is about cloning/restoring OSx86 partitions, and mainly the focus is on getting the restored partitions to boot. Using part of the steps, you can also fix non booting partitions that got ruined for some external reason (MBR corrupted, playing around with bootloaders, etc).

 

Things you need first

 

This guide is designed for people wworking from TWO OSx86 hard drives. It requires that you have acces to two drives to copy stuff around. Even if your ultimate plan is to only have ONE drive, for the whole clone/restore, as well as recovery from a non booting install, it is better to temporarily use two drives to solve all the problems (do a minimal install on that drive from the DVD).

 

Get startupfiletool (attached at the end of this message) and put it in your /usr/sbin directory. Remember to change executable bit in Terminal (use chmod +x startupfiletool) and owner/group to root:wheel. You are going to need it there in the executable path.

 

From JaS Install DVD, cp /usr/standalone/i386 to a bootfiles directory in your home (for easy access)

 

Also cp boot0 in particular to your own systems /usr/standalone/i386 so fdisk can use it to rebuild MBR for booting (with boot0)

 

Starting up

 

Open Disk Utility

Partition target hard drive (choose the DRIVE not the partition)

Options > MBR (not GUID or Apple)

MacOS Extended (journaled)

Keep Disk Util open, it will come in handy to mount and unmount the volume you are working on easily

 

Restore from image, use Carbon Copy Cloner (I deactivated the make bootable tag

in Preferences just in casE), Super Duper, etc. Whatever method you use to restore/close your partition.

 

Setting the correct parameters so your new partition will ever boot

 

Launch Terminal

 

diskutil list

 

(From now on we will assume you are in the bootfiles dir you created previously, @ is your DISK number, # is your PARTITION number)

 

Dunno if this next step (fdisk) is absolutely necessary, I included it specially for those of you who damaged their MBRs at some point, as a way to restore it

 

sudo fdisk -e /dev/rdisk@

 

Once in the fdisk prompt, just for hecks type help and see the commands, then type print just so you take a peek at your partition table and you know where the hell that HFS+ you need to work on is (the number). Next type:

 

reinit
update

 

This will rewrite the MASTER BOOT RECORD (MBR). I do not know if it is necessary or not to have boot0 available to fdisk for this, but I decided I wanted to have it, and it worked, so unless someone later proves me wrong (which I would love if they EXPLAIN WHY), do it if you can.

 

It is also probably not needed to do both (reinit, update), I just didn't know which one actually rewrote the MBR from scratch, so I do both just in case, and it won't hurt your drive EVEN if it is already partitioned and with a working MBR (as if you just run FIXBOOT, but the information is still available in your drive, it just won't boot). Following this commands is NOT DANGEROUS even in a perfectly working drive is what I want you to know.

 

f #

 

This flags the partition bootable, VERY important. You will notice an asterisk besides the partition number if you do a p (print partition table).

 

(Unmount with Disk Utility before the next steps)

 

w
e

 

This is shorthand for write and exit (you can use only the first letter of many commands in fdisk)

 

Still fixing booting, but getting confused

 

In your Terminal window, again assuming you are inside that bootfiles dir we created

 

sudo dd if=boot1h of=/dev/rdisk@s# bs=512 count=1

 

Now unmount the new volume is it is mounted for the next step. What is this next step?

 

sudo startupfiletool /dev/rdisk@s# boot

 

You should get a message that goes somethingn like:

HFS+ filesystem detected

Looking for 1 words free

reading 4096,4096

etc

 

Blessing ... goddamit

 

I could never bless from another booted system (dunno, got "Could not find IODeviceTree" message), so next step is to reboot with JaS DVD in the drive and start with F8 and -s in the prompt that appears (single user mode).

 

Once booted we need to identify our disks so we don't get confused. Don't trust OSX, it assigns numbers however it pleases, so first in the BIOS is not always rdisk0. diskutil list seems to not work or take FOREVER to do it's thing. An easy way to check is to use fdisk:

 

fdisk /dev/rdisk0

 

Check values returned, compared against rdisk1, etc, to identify the HD you want to work on, the target. Of course this only works if the sizes are different or partitioning is distinctive.

 

Once determined, use the bless command (it takes EONS to do it, but be patient, watch the DVD drive light blink, it is happening)

 

bless -device /dev/disk@s# -setBoot

 

(Take note it doesn't use RAW disk, just disk)

 

Once this is finished, remember to set your HD to boot first in your BIOS, remove DVD, and off you go with a new bootable cloned system. Let me know if it works for you.

 

Some considerations

 

Using the last part of this mini tutorial will also get yoy back on track in case you really screw up your system with other bootloaders, partitioning utils, etc. This is why I actually ended up writing it. I couldn't find ANY concise info on how to go about this. The OSx86 forums are great, so is the Wiki, but unfortunately it was all bits and pieces (and many didn't specify for example disk@s# (disk and partition) which only caused the commands to fail without any understandable reason. I am a newbie on some things and not on others. I spent 3 days researching, trying, ruining my other "disk" over and over, until I got a full working method. If it can save you the time, then I am happy I could help. I must tell you, I had TWO SEPARATE DRIVES, all with only one partition, the HFS+ one. You might want to be really careful if you are going to work with disks that have multiple partitions. Particularily when working with FDISK and the MBR.

 

Also, please HELP ME UNDERSTAND many of the things in the boot process I do not understand. It is always better to correct me and let people learn how to fish instead of just handing them a snack :thumbsdown_anim:.

 

Now, after I ruined my OSx86/WinXP box (I even trashed the partition table on the 4 DRIVES!! by using an obscure command line MBR repair tool!), and recovered it (very long story), now I share some of the things I learned. I am still booting with the goddam BIOS selecting each drive (two physical units boot x86 a stable system and a sandbox for fooling with kexts, etc, a third drive boots Windows XP and a fourth drive is a D: in WinXP). I will now try CAREFULLY (disconnecting my OSx86 drives before playing with it), try to use a bootloader, menu and such. But my guess is I will fail like I did before. The good news is I now know how to fix my OSx86 if they stop booting or I need to go back to my last cloned image.

 

Cheers.

I agree researching this was not easy. Here is what I have done so far. Maybe it will help you.

 

http://www.hackint0sh.org/forum/showthread.php?t=360

 

 

Be careful with the MBR commands. You can boot off a partition set up with boot1h and still have GRUB or XP in the MBR. Not that familiar with XP and chain0 but pointing GRUB to the partition set up like this works great.

root (hd?,?)

chainloader +1

boot

 

This launches darwin bootloader and off you go.

 

I had trouble with the bless command and it still works so I am not sure it is needed if you are dealing with a partition.

 

Don

Link to comment
Share on other sites

  • 2 weeks later...
This is my first guide. It is about cloning/restoring OSx86 partitions, and mainly the focus is on getting the restored partitions to boot.

 

Cheers.

 

 

I think you must have got this right. Either that or you scared off the ones who cant get it working. I am sure if it wasn't working for people they would be asking (demanding) you fix it for them.

 

Thanks

Link to comment
Share on other sites

This tute is EXCELLENT - thankyou. 1 point though - SuperDuper doesn't have an option to turn off 'make bootable' - and seems to screw up mbr's (maybe).

 

Oh and 1 question - is there any way to extend the bootloader timeout? - I don't have time to add boot options

[fixed] - you have to add a Timeout key to the boot plist. format is;

<key>Timeout</key>

<string>8</string>

Link to comment
Share on other sites

@gaucho:

Get startupfiletool (attached at the end of this message) and put it in your /usr/sbin directory. Remember to change executable bit in Terminal (use chmod +x startupfiletool) and owner/group to root:wheel (use chown root:wheel startupfiletool). You are going to need it there in the executable path (/usr/sbin is in the path).

 

I have read & slowly scanned your guide several times and, while my old eyes arn't what they used to be, I can't locate any link to the startupfiletool you mentioned. Could you point me to it?

Link to comment
Share on other sites

@gaucho:

I have read & slowly scanned your guide several times and, while my old eyes arn't what they used to be, I can't locate any link to the startupfiletool you mentioned. Could you point me to it?

 

 

Here is a link to were I found this info. Good to read all of this too.

 

http://forum.insanelymac.com/index.php?sho...mp;#entry166040

 

It was compiled with old kernel but I don't think it maters even if you are using the new kernel.

 

Don

Link to comment
Share on other sites

Here is a link to were I found this info. Good to read all of this too.

 

http://forum.insanelymac.com/index.php?sho...mp;#entry166040

 

It was compiled with old kernel but I don't think it maters even if you are using the new kernel.

 

Don

 

Thanks for the pointer. I'm still reading over the instructions and wondering if I can make it work without crashing the partition. Think I will create a set of partition disk images before I try - just in case. :(

Link to comment
Share on other sites

Well, my problem is solved.

 

I had been rebuilding my partitions to run 10.4.8 using the semthex kernels. To get a clean install, I erased the partition first. I found that if I erased using disk utility while booted from the jas-10.4.8-install dvd my multi boot manager would see the partition as a bootable partition. If I erased a partition using the disk utility from the new 10.4.8 partition the boot manager could not see the partition.

 

I knew the problem was not related to the partition being marked active because I had done that using a Linux live-cd and fdisk. It didn't help. What did help was your pointer to the install dvd /usr/standalone/i386 files and the "dd" command.

 

You said:

In your Terminal window, again assuming you are inside that bootfiles dir we created

 

CODE

sudo dd if=boot1h of=/dev/rdisk@s# bs=512 count=1

 

I changed it in this way:

sudo dd if=chain0 of=/dev/rdisk@s# bs=512 count=1

 

That put the chain loader where it was needed by my boot manager and the partition is now directly bootable.

 

One interesting fact; none of the disk partition /usr/standalone/i386 directories have the boot0 or chain0 files. They contain a file called boot.efi.

 

In any case, my problem is solved and I am grateful for the pointers.

Link to comment
Share on other sites

Well, my problem is solved.

 

You said:

I changed it in this way:

That put the chain loader where it was needed by my boot manager and the partition is now directly bootable.

 

 

Glad it worked. Do you have a reason for using chain0 instead of boot1h? Just curios. Boot1h worked fine with GRUB, does it not with your boot loader?

 

Don

Link to comment
Share on other sites

Glad it worked. Do you have a reason for using chain0 instead of boot1h? Just curios. Boot1h worked fine with GRUB, does it not with your boot loader?

 

Don

 

Well, yes, the reason I used chain0 is because when I used boot1h the partition never got to darwin. It just hung.

 

Understand, I didn't follow all the instructions. I just used the dd command to insert chain0 into the partition boot record position.

 

I tend to stop with a minimal solution when possible.

Link to comment
Share on other sites

Well, yes, the reason I used chain0 is because when I used boot1h the partition never got to darwin. It just hung.

 

Must be some magic going on behind the scene . Chain0 wont work on my system but boot1h does. What boot loader are you using?

 

Don

Link to comment
Share on other sites

Must be some magic going on behind the scene . Chain0 wont work on my system but boot1h does. What boot loader are you using?

 

Don

 

I use a program called Smart Boot Manager - free - fits in the MBR section of track 1 on the hard drive - no partition required. It scans your drive/partitions for bootable partitions - graphic interface - built in help - etc.. I have used it to boot Winxx & Linux, WinXX & OSX86, and multiple copies of OSX86

 

You can install it on a floppy for testing without changing your hard drive - then install it on your drive & save the floppy as backup in case the MBR gets trashed.

 

You can see it at http://sourceforge.net/projects/btmgr/ where it says:

 

Smart BootManager is an os independent BootManager which has easy to use interface and many other features. The main goals of SBM are to be absolutely OS independent, flexible and full-featured. It has all of the features needed to boot a variety of OS

 

 

Project Admins: suzhe

Operating System: All POSIX (Linux/BSD/UNIX-like OSes), Linux, MS-DOS

License: GNU General Public License (GPL)

Category: Boot, Systems Administration

Link to comment
Share on other sites

  • 4 months later...
Also, please HELP ME UNDERSTAND many of the things in the boot process I do not understand. It is always better to correct me and let people learn how to fish instead of just handing them a snack :thumbsup_anim:.

 

 

I know this post has been here for a while, but I was so glad I did dig it out.

A few thing I discovered

1. you don't need two harddrive or one compact osx, I only has one broken system, Jas DVD, plus one empty HFS patition (made from a USB key)

2. basiclly you first format the usb key into HFS, then copy Jas /usr/standalone/i386 over in the USBkey, as well as the startupfiletool in the same folder, fix chomod chown for startupfiletool

3. boot into JAS dvd, (no need to wait long for the graphic start, just directly boot into -s), then use fdisk /dev/rdisk0, or 1 or 2... to check whch is which

then use mount_HFS to mount the usb key (no need to mount the broken system drive ever)

4. do the dd if....... command (I first thnk I am using windows chai0 loader so I should select Chain0, but turn out to be I still need boot1h instead)

do the startupfiletool ..... command

5. now directly do the bless...... command

 

 

the whole process only takes 5 mins in total including the CD boot. and you don't need to do fdisk part to make it active, the bless part will do it (although I don;t want it change active and have to change back manuelly afterwards_

 

 

Ok, here is why I am end up doing all above, don;t waste time to read following part unless u are abosolute bored

 

 

 

 

 

 

 

 

 

 

 

 

 

OK, I warnned you, but if you still want to waste you time, read on

----------------------------------------

first I have a perfect working xp haddrive with a few partition, after the titan is finally out, I think its time to make my geforce 6800 work in osx,

so I bought a new 200G harddrive dedicate to osx. (its a samsung drive by the way, the so called quietest hard drive on earth)

 

then I soon discovered with 2 harddrive in my DEll 5100, there starts to have a annoying vibration noise, which drove me crazy.

 

so I decide to merge everything in the new samsung 200G and get rid of the original 160G with xp on it.

 

then everything start to turn out against me

 

first I want to partition the 200G into a few parttion with HFS NTFS and FAT32

 

I found apple diskutil is the dumest disk managment ever!

every time you want repartition, you need to erase whole disk, how stupid is this!

 

then I have to use the parongon partition manager to divided

 

then I start to use Norton ghost 9 to transfer file over the new partitoins, everything is fine and I made xp partition acive with chain0 loader

 

I found the chain0 doesn't work afterwards, I can't bootinto OSX anymore

 

then I said ok I will use windows instead, the apple video drive is not crystle clear as windows (i don't know if it is problem of titan or nvidia driver)

 

then I use macdrive to access all files in HFS, still ok until I am trying to open a foder while I am playing songs on the same HFS drive.

 

suddenly system reboot, and I can;t even get into xp safe mood

 

(later I confirmed, stupid macdrive cause bad sector on my 20days new harddrive---jus because of 2 threads acessing same file at same tim!!!!)'

 

then the drive start to die, even after chkdsk /r it crash indefinately.

 

since then I started to hate macdrive as well as samsung.

 

then I bought a 320G WD , which is as quieter as samsung and no problem so far.

 

 

In order to copy things oout of the damaged file, I use norton 9 again. later make me extremly long time to think how I can recover from those c2v format image, no one else read it and the norton recover utility is so stupid it can't restore the c2v image

 

 

I basiclly made my trick through, trying to mount the image with norton viewer then started copy fromt this mounted drive to mac drives with some disk clone

 

 

then I madea image achive for kids

 

but I still format the harddrive on it, after copy the tiger image over, it doesn't boot

 

 

so I have to go back to this post

 

wow, took me 4 days, 5 harddrives, 3 PCs, 1 Mac G5,

 

to fully recover those 2 system , each has a extra partition as HFS or NTFS, interleaved ,

 

and now is fouth day at 4AM, I am finally able to boot into both system and almost fall sleep now

 

ok, I will install macfuse now and go sleep.

 

-------------------

THE END

Link to comment
Share on other sites

  • 3 weeks later...

I have one 250GB hard drive with Vista installed in the first partition, I make a second partition for OSX, I tried with the Jas 10.4.8 DVD and after the install all I got is HFS partition error, so I try with the Jas 10.4.7 and I get the same error.

 

I did the dd if=boot1h, then startupfiletool, and the bless command but no change, the HFS partition error is still there.

 

Any suggentions?

 

 

Thanks

Link to comment
Share on other sites

Terminal won't let me bless the drive. I get one of two errors. Either it says that it can't determine if the disk is in a RAID, or it has a problem with the -setboot portion of the line. I have OSX installed on the first partition and XP installed on second partition. I've also been trying to run the startupfiletool without success. I don't know what to do anymore. I've been at this for three days straight. :(

Link to comment
Share on other sites

Great guide, gaucho..it worked for me, yeay!! :(

 

Transferring working osx86 partition to a faster hard drive using SuperDuper gave me

a blinking cursor and non-booting system.

I've tried different utilities and command lines but to no avail.

 

I've followed each step as precise as possible and, finally, I've got a bootable new drive.

I have used SuperDuper as a cloning tool again and this time it worked like a charm.

 

Thanks to your work, now I can sleep better! :D

Link to comment
Share on other sites

Hi.

 

I've read a lot of posts on cloning to a bootable drive and I'm having difficulty as I don't really know any unix commands and I get the impression that the instructions in the first post make assumptions that you know a bit, like assuming you're in a particular directory at various stages.

 

Could someone please post step by step instructions for someone who has no experience with the terminal? I'm trying to clone a working JaS 10.4.7 install before upgrading to 10.4.9.

 

Thanks in advance.

 

Bill.

Link to comment
Share on other sites

I'm confused as hell. And it's not because of the UNIX commands and whatnot, as I have experience there. What confuses me is the fact that my hard drive has two partitions, a very small FAT32 partition, followed by the main HFS+ partition where JaS OS X 10.4.8 is installed. The FAT32 partition is marked as bootable, the HFS+ one is not. Should the HFS+ partition be bootable and the FAT32 not? What is this FAT partition and how come no one else has mentioned it?

Link to comment
Share on other sites

  • 3 weeks later...
  • 2 weeks later...

When I tried to clone my working OS X partition to a bigger hard drive,

neither Clonetool nor Superduper was able to make the new hard drive bootable.

 

For me, gaucho's method described here is the only consistent way of making a working bootable partition. :(

Link to comment
Share on other sites

 Share

×
×
  • Create New...