Dualboot Related FAQ

From OSx86
Jump to: navigation, search


OSx86 Dual-Boot Related FAQ

Updated: Mon Aug 15 01:37:49 2005

NOTICE: if you blindly follow these instructions without paying attention, you could mess up your disk badly. Even if you are careful, accidents happen. You have been warned. Also, I have not personally done this, this is a FAQ that tries to clarify certain points and should not be considered a step-by-step guide.

A quick note about dd

This program is used to very flexibly copy data over devices and files. Care must be taken, because one could accidentally overwrite his entire disk with zeroes or random data if misinformation is issued to it. Also, as dd is a UNIX tool, it follows the tradition of not reporting of its progress unless error occurs. Dd'ing many gigabytes over devices may take a while, depending on the hardware, and if dd is not saying anything, it means it's just busy doing its job. dd will finish when it's done (maybe minutes to tens of minutes) and then the prompt will be displayed again. Be patient! Note: you can tell dd to display its progress by issuing a SIGUSR1. To do this, run killall -USR1 dd and you will see something like 100+0 records in 100+0 records out.

[edit] I can't extract the archive containing the image! What gives?

This is off topic, but I thought I'd answer it here because it's a frequently asked question. The reason is that you're using fat32 on the partition you're trying to extract the image to, and that will not work, because fat32 has a maximum filesize of 4GB and the image is bigger than that.

[edit] Can I have dual-boot with OSx86 and Windows/Linux/Whatever?

Yes you can.

[edit] What do I need for that?

You need a partition/drive for OS X, and grub (GRand Unified Boot Loader) or equivalent. You may also find this guide useful.

[edit] What is grub?

GNU GRUB is a very powerful boot loader. It will give you a menu to select the OS to boot when you start your computer. If you use Windows, there is WINGRUB which has a GUI.

[edit] Why do I need grub?

Because if you want to dual-boot, you must have some way to select which OS you want to boot. Actually, grub is not required if you use the Darwin boot loader by setting the OS X partition active after it is copied, but I can't say if there are any restrictions in it when compared to grub. br0adband has a guide utilizing this here. Update: also, you could install Smart Boot Manager which is a no-hassle boot loader solution. To install it, run the binary (check more detailed instructions at question #11). Alternatively, Boot Magic (comes with Partition Magic) works. Configuration is much easier than GRUB.

[edit] I have a VMWare virtual computer running Tiger, how can I transfer it onto the partition for native boot?

You need to be able to access the partition inside the virtual disk image, and transfer that on to the partition on the physical drive. The partition will be visible inside the virtual machine. For transferring the image one would use the program 'dd'.

[edit] Huh? Can I just use 'dd' to copy the tiger-x86-flat.img onto the partition?

The stuff under this line may be incorrect. Checkout Install_On_A_Partition_Simple_And_Accurate for a guide.

NO, YOU CAN'T. Well actually, you can, but that is not what you're supposed to do. The VMWare disk image contains more than just one partition, it's a *disk* image, so it represents the entire drive and not a single partition. You must 'dd' the partition that is *within* the .img-file. However, see Q9. Updated: you can dd the partition inside the .img, without using VMWare, by issuing dd the 'skip' parameter so dd starts copying from the beginning of the first partition. To do this, boot your real PC with linux and mount the volume that contains the OSx86 image, then:

# dd if=tiger-x86-flat.img of=/dev/hda2 bs=512 skip=63

Why do we use bs=512? The copying would be faster if we used bs=1M, but if we did that, the skip parameter would tell dd to skip 63 one megabyte blocks (63*1MB), and it would not work.

Note that I have not tested these values myself, it depends entirely on the partition layout of the image in question. Also, this assumes that the image has only one partition, since it copies the entire disk but skips the first 32256 bytes (63 sectors) to the beginning of the first partition. 'qwerty' posted a slightly different approach using losetup and loop device to skip the bytes at UNEASYsilence OS X discussion. Going the losetup way might be faster since you can use a bigger block size. You might not have the same image he does though, so it's best to boot first into the VM and confirm the actual offset. This can be done with

# fdisk -lu

inside the virtual machine. Look at the "Start" column for the OS X partition, this is the offset of the partition in 512B sectors. Update: This means that you will have to multiply the value hdparm gives by 512 to get the offset in bytes. For example, if hdparm says the partition begins at 63, then the skip value would be 63*512 = 32256, which is the same value as above. <-- This was an error, there is no need to multiply anything since dd expects a skip value in sectors. If this sounds confusing, try reading more about it.

Here's the explanation that explain how I computed that the first partition (yes theres is only one in the image) start at sector 63:

in the image the first partition start at CHS 0/1/1 (from the partition table in last 66 bytes of the first 512 bytes of the image, aka the MBR)

The equation to convert from CHS to LBA follows:

LBA = ( ( CYL * HPC + HEAD ) * SPT ) + SECT - 1


LBA: linear base address of the block

CYL: value of the cylinder CHS coordinate

HPC: number of heads per cylinder for the disk

HEAD: value of the head CHS coordinate

SPT: number of sectors per track for the disk

SECT: value of the sector CHS coordinate

with (from file tiger-x86.vmdk)

ddb.geometry.sectors = "63"

ddb.geometry.heads = "16"

ddb.geometry.cylinders = "9825"

LBA = (0 + 1) * 63 + (1 - 1) = 63

that is sector 63

[edit] So how do I copy the partition instead of the whole disk then?

The safest way, in my opinion, would be to insert a linux live cd into the virtual CD-ROM of the Tiger Virtual Machine. This means that you have to download the live cd and set your Tiger in VMWare to boot it. I'd recommend Gentoo's minimal install cd, it likely has all you need. If you need more hardware support you could try Knoppix instead.

Then you must give VMWare access to the physical drive or partition you want to use for OS X. I will refer to it as destination partition. These steps will give you access to linux tools for manipulating the hard drives, and access to both the Tiger partition and the destination partition.

[edit] You didn't tell me HOW??!

So, after you have booted the live cd, you must know which device file your destination partition is. In linux you can see the detected partitions with `cat /proc/partitions`. In linux, the drives are named accordingly (IDE):

Primary Master 		hda
Primary Slave 		hdb
Secondary Master 	hdc
Secondary Slave 	hdd

Individual partitions can be referenced by appending the partition number after the device name. For example 'hda1' would be the first partition on the Primary Master disk, and 'hdb3' would be the third partition on Primary Slave disk. Note that grub uses a slightly different syntax, and partition numbers start from 0 instead of 1. The device files are in the /dev-directory.

Now, let's say you have one 30GB hard drive, divided into two partitions, a 20GB one, where Windows resides, and a 10GB one where you want to install OS X. You have added your destination partition (the 10GB) in the Tiger VM as a new hard drive at Primary Slave (IDE 0:1). In linux, you would type:

# cat /proc/partitions
major minor  #blocks  name

   3     0    6290928 hda
   3     1    6290896 hda1
   3     0   10485760 hdb

This shows you the Tiger VM virtual hard disk 'hda' and its first partition 'hda1' where Tiger resides, and the destination partition 'hdb' (which shows here as a drive since it has no partitions in itself). Note that your 20GB Windows partition is not shown, because you only gave VMWare access to the 10GB partition and not the entire disk. If you had mapped the entire disk, its structure would show in the listing and you need to be more careful to pick the right partition.

Now, in this example case you want to copy 'hda1' onto 'hdb' (UNLESS you mapped the whole drive for VMWare, in which case DO NOT DD ONTO HDB, that would mean your hard drive's partition table would be overwritten, and you would end up with an OS X installation and everything else would be lost.) To accomplish this, you would type:

# dd if=/dev/hda1 of=/dev/hdb bs=1M

This means 'copy data, using hda1 as input file, and hdb as output file, 1MB at a time'. After dd has finished - and it will take some time so don't be alarmed if nothing seems to happen - hdb will contain everything in hda1. The partition is copied.

[edit] But I have a spare disk to use for OS X alone, why do I need VMWare?

In that case, you don't. You can write the .img file onto the destination hard disk by booting your PC with linux, mounting the volume that contains the image and issuing

# dd if=tiger-x86-flat.img of=/dev/hdb bs=1M

This will copy the image containing the bootsector and partition onto Primary Slave (IDE 0:1). It should also be possible to use 'dd' for Windows, but I have never tried it. HoZy wrote a tutorial for using Win DD, it's here. Thanks for that. Assuming you have the spare disc set to primary slave in VMWare, you can also do the same thing from within the virtual machine with

# dd if=/dev/hda of=/dev/hdb bs=1M

[edit] Hooray! But now what?

While it's good that you now have the partitions copied, you still need a way to boot it, that means installing GRUB (or some other boot loader if you will, I don't know enough about boot.ini to say if it can do this) or using the Darwin boot loader like in br0adband's guide. You can find instructions for installing grub in Windows here. (you might not want to rely on this entirely, since you'll also need to have your Windows partition on the menu.lst)

If you wish to use Smart Boot Manager, you're just one step away. After you have the partition set up, download and run the binary and tell it to install on the disk you wish to boot from. In linux:

# wget http://btmgr.sourceforge.net/3.7/sbminst
# chmod +x sbminst
# ./sbminst -t us -d /dev/hda

would install Smart Boot Manager the MBR of /dev/hda and when you boot off it, you will have a menu driven interface where you can boot OS X or configure the boot loader.

If you have more than one drive, press CTRL-H to rescan for partitions and they will appear on the list if they are bootable. This should find your other operating systems. After that you can save the settings.

[edit] This failed! Who's to blame?!!

You were warned at the start of the guide.

You've got nothing to pin the blame on but your own /dev/hands.  :p (nerdy)

Thanks to people at #osx86 for comments & info.
Corrections are welcome.

Originally Created by joga and copied with permission and converted to Wikiformat by Shuddertrix

This page was last modified on 24 November 2010, at 03:22.
This page has been accessed 47,771 times.
Powered by MediaWiki © 2021 OSx86 Project  |   InsanelyMac  |   Forum  |   OSx86 Wiki   |   Privacy policy   |   About OSx86   |   Disclaimers