How can i backup and install GRUB
I am fairly new to Linux. Im currently taking classes for Linux and have searched for this and cant find it.
I have XP installed on /dev/hdc1 and Fedora 6 on /dev/sda1. I installed grub to the XP partition, but my XP is acting up so i want to reinstall it. Problem is that grub is installed on this drive and i know that reinstalling windows would override the bootloader to get into Linux. I want to know step by step how to backup and reinstall grub to /dev/hdc1 after i have reinstalled XP. The instructions and answers im looking for are prolly right under my nose, but my nose cant see anything at the moment. Im sorry if this has been answered somewhere else, but i cant find it. Any help would be appreciated. Jesse |
To save the MBR, which is what I think you want, you do the following:
Code:
dd if=/dev/hdc of=MBR.image bs=446 count=1 Code:
dd if=MBR.image of=/dev/hdc bs=446 count=1 |
Thank you for your quick reply. Will this also work if XP and Fedora are installed on the same drive on my laptop and i want to do the same, just insert the correct partitions?
And can i just use a regular fc6 install disk or do i need to download a fc6 live cd? Thank you again. |
Quote:
Don't understand the question about the Fedora disk...You can do the dd thing from any Linux--eg what is already installed, live CD, etc. Final nit: When you are talking about the mbr, there are no partitions involved. |
Quakeboy02 and pixellany, thank you very much for your help.
|
If you want to put it in a specific place, like your home directory, the command should include that directory:
dd if=/dev/hdc of=/home/<user>/MBR.img bs=512 count=1 |
You might want to read the Wikipedia article on the MBR:
http://en.wikipedia.org/wiki/Master_boot_record Notice that Quakeboy02 used the first 446 bytes. Some howto's use 512 bytes. The first 446 bytes contain just the bootstrap loader code. So you would be backing up part of the MBR and not the entire MBR. If XP uses the NTFS filesystem and you don't have NTFS write support in Linux, then you may want to copy the MBR backup image to a usb device instead and copy it to C:/ (/dev/hdc) when using XP before reinstalling. |
jschiwal,
I'm glad you made me look that up. I had though that the first 446 bytes contained only the boot code. But, apparently, it's even more complicated than that. But, if you backup the whole sector (512 bytes) be aware that that MBR is not transferable to any other disk, as it contains the partition table. For more info: http://en.wikipedia.org/wiki/Partition_table |
The thread starter did not mention using another disc, only backup the MBR to put it back after re-building Windows.
|
I do welcome any "constructive criticism" here, but if I remember correctly, there are some "reserved" bytes in the MBR, which is probably why Awesome uses 446 excluding the reserved bytes, which contain nothing.
|
The partition table starts above 466. The entire MBR is 512 bytes long. The Wikipedia article has a table showing this.
If you really want to feel nerdy: dd if=/dev/hdc of=MBR.image bs=446 count=1 objdump -D -b binary -mi386 -Maddr16,data16 MBR.image |
A quick look at that spells "fat 16 floppy"
|
Windows XP "assumes" it is the only operating system in existence in the Galaxy and can wipe your dual boot mbr.
I have found "Smart Boot Manager" to be useful to have around (Google for it). If Windows XP wipes your mbr on /dev/hdc1 the "Smart Boot Manager" should let you boot to Fedora 6 on /dev/sda1. Once booted, you should be able to reinstall grub as a dual boot system with: Code:
grub-install /dev/sda Code:
1. Boot from the Windows XP cdrom. |
Ok, just so im understanding right. If i reinstall windows on /dev/hdc, i can install "smart boot manager" and then boot to Fedora 6 on /dev/sda1. From there i install grub to /dev/sda, and if i wanted, instead install grub to /dev/hdc since i want it to boot from the first hard drive. I dont mean to be a PITA, i just got alot of conflicting info and want to get it right.
|
Quote:
|
All times are GMT -5. The time now is 04:10 PM. |