LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Ubuntu (https://www.linuxquestions.org/questions/ubuntu-63/)
-   -   saving grub files to use in case (https://www.linuxquestions.org/questions/ubuntu-63/saving-grub-files-to-use-in-case-689503/)

IshanJ 12-10-2008 01:36 AM

saving grub files to use in case
 
I had installed both XP and Ubuntu 8.04 in my computer. One day my brother had tried to fix something in XP by running XP installation cd and ultimately I couldn't run my Ubuntu installation. But XP worked well. And when I checked it with the live cd, all the contents of /boot directory was gone. I tried several times to copy the contents of /boot in the live cd rom to my real installation and then boot up. But it didn't work! So I reinstalled Ubuntu. I want to know if there is a way to recover the Ubuntu installation in situations like these? And is there a way to save the contents of /boot directory to somewhere else and can I use this copied /boot directory at a later time to fix the system in a situation like this?

JosipBroz 12-10-2008 04:17 AM

The situation you're describing is highly atypical, so trying to safeguard yourself from it "reoccurring" would be quite overzealous. I'm completely baffled that the XP CD could actually ruin anything residing on a GNU/Linux partition -- Windows don't even know how to read those partitions at all (well, some read-only drivers do exist for Windows, but they are in no way present on a XP installation CD). A Windows CD could mess up your entire GNU/Linux partition, to be sure, but it could never nuke just selected directories on it! What it could do, however, and do it gladly, is overwrite your Grub bootblock code (or MBR, as they call it) with its own. Now, you'd be facing two possible situations:
1. Highly probable. Only your MBR has been overwritten. You simply overwrite it again (using a GNU/Linux live CD) with the command grub setup.
2. Almost impossible. Your /boot directory (or, far more likely, a separate /boot partition) has been deleted. You use a live GNU/Linux distro to run a fake "reinstallation", skipping all the steps until you get to the Grub installation phase and there reinstall Grub. I must admit I've never tried this solution myself, it's just something that's been circulating on the Internet for a long time. An alternate way to achieve the same (at least with some distros) would be running grub-install from a virtual terminal.

IshanJ 12-12-2008 12:21 PM

Thanks JozipBros for your reply. As you have mentioned in the second situation, I tried to reinstall only grub by skipping the other steps but the CD didn't allow me to do that. That's why I had to reinstall the entire system from the scratch. That was very cumbersome.

serafean 02-26-2009 03:11 PM

Hi, I know this is slightly outdated, but I feel the need to submit my hypothesis : the thing I see the most probable is that XP overwrote the MBR, thus GRUB had no way of starting. You booted Ubuntu LiveCD, and mounted your / partition. What you didn't do is mount your /boot partition. The mount point being a directory, when you looked inside it, you saw nothing, because all the data it should have contained was on another partition which you didn't mount. That's just my view of the situation, so it may not be what actually happened, but as I have never heard abot Windows writing do an ext partition, I think this might have happened.

btw:in this case Josip's situation number1 would have applied to you. And just reinsalling GRUB wouldn't reinstall the kernel image, so I don't think number 2 would work.


All times are GMT -5. The time now is 05:28 PM.