Using Ghost to Image a Windows and Linux Dual-Boot

So recently I ran into an issue while trying to get Ghost to image a system with both Windows and Linux installed. Below is a breakdown of the setup.

GRUB installed in MBR

/dev/sda1 (XP)
/dev/sda2 (Linux)
/dev/sda3 (Swap)

A quick google search revealed this to be quite a common problem. Creating the image was not an issue, the problem came after dumping the image in a Multicast enviroment to approx. 12 machines. After deployment only about 20% would boot properly and of that 20% only an hanful of those would boot consistently. It seemed that the MBR (master boot record) was not being copied correctly. After trying Ghost using the ia switch and the iaL switch with no success I began looking for alternative solutions.

The 12 machines that need to setup are used for a training worshop every few weeks and need to be reimaged between workshops, while the remainder of their days are spent as additional processing power for a cluster. I toyed with the idea of using VMWare as an alternative option but decided this would effectivly reduce the effectiveness of the cluster.

The solution was simple. I decided to use the native XP bootloader (NTLDR) in conjunction with GRUB. Basically I would be using NTLDR to load GRUB from the Windows partition. I started with loading XP on half of the drive and Linux on the remainder, same setup as above. At this point GRUB is installed in the MBR. I needed to replicate the GRUB bootsector from the MBR to a file so from a linux terminal I issued the following command.

dd if=/dev/sda of=grub.bin bs=512 count=1

(above explained)

The if=/dev/sda is the current location of the installed bootloader we want to copy. The of=grub.bin is what we are naming the file. The bs=512 is the first 512 bytes of the drive. The output should look something like this:

1+0 records in
1+0 records out
512 bytes (512 B) copied, 0.000105181 s, 4.9 MB/s

We now need to move the file we just copied, “grub.bin”, to the root of the windows partition “C:” (this may vary depending on your setup). After this is done we need to edit the boot.ini file in Windows, also located in the root of the windows partition (note that this is a hidden file). Adding an entry to the boot.ini file is simple because all you are doing is adding a line on the bottom that will look like this:

C:grub.bin=”Linux”

The “Linux” can be named whatever you like. The last step is to reinstall NTLDR in the MBR. This can be done by booting from the Windows XP disk and giong into the recovery console. Once in the recovery console you can issue the command:

fixmbr

At this point you sould be able to reboot and see the NTLDR boot menu giving you the choice to boot from XP or Linux. If you choose Windows you will boot directly into Windows. If you choose Linux you will be greeted with the GRUB bootloader allowing you to select from a list of installed OS’s based on your GRUB configuration. I chose to remove Windows and any other entries from the boot selection in GRUB.

Finally you are ready to image the drive using Ghost. Make sure you chose sector by sector image also known as the ia switch. Deployment at this point should be a breeze.

0
  Related Posts
  • No related posts found.

You must be logged in to post a comment.