[GUFSC] recuperando o grub após reinstalação do Windows

Robinson Pizzio rpizzio em gmail.com
Terça Maio 22 19:35:59 BRT 2007


Pessoal,

esta semana tive que reinstalar o windows no meu computador e obviamente
acabei
perdendo o MBR (Master Boot Record). Sendo assim, não conseguia mais bootar
meu linux.
Em muitas outras situações eu acabei reinstalando todo o linux. Agora
descobri uma forma
muito fácil de restaurar o grub sem a necessidade de um disquete de
recuperação.

Talvez esta dica não servi para todos, de qualquer forma, acho que pode
ajudar alguns da lista.
A internet está cheia de "formas e maneiras" de se restaurar o grub, o
problema é que a maioria
não funciona ou não é de fácil entendimento.

No site
http://johnny.chadda.se/2007/02/17/restore-grub-in-ubuntu-after-installing-windows/
tem uma descrição bem simples e fácil de se fazer esta recuperação. Segue a
dica:

8-<  8-<  8-<  8-<  8-<  8-<  8-<  8-< 8-< 8-< 8-< 8-< 8-< 8-< 8-< 8-< 8-<
8-< 8-< 8-<

When you install some operating systems such as Windows or Mac OS X, they
will overwrite your master boot record. If you have Linux installed you will
be unable to access it, until you restore Grub on the MBR.

The easiest way is to find your Ubuntu or other Linux
rescue/live/installation CD and boot it. Pop open a terminal and first find
which partition is your root using fdisk.

$ sudo fdisk -l
Device Boot Start End Blocks Id System
/dev/hda1 * 1 2550 20482843+ af Unknown
/dev/hda2 2551 3825 10241437+ 83 Linux
/dev/hda3 3826 3890 522112+ 82 Linux swap / Solaris
/dev/hda4 3891 12161 66436807+ 7 HPFS/NTFS

Here we see that /dev/hda2 is our Linux partition, so we will want to mount
it in order to read the Grub configuration.

sudo mount /dev/hda2 /mnt

If your don't get any errors now your root partition should be mounted under
/mnt. You can check for the grub configuration by listing the contents of
the directory /mnt/boot/grub.

Now to restore the configuration just write the following.

$ sudo grub-install --root-directory=/mnt /dev/hda

This will install Grub to MBR and use the configuration files in
/mnt/boot/grub. Now just reboot your computer and you will hopefully be
greeted with the ever friendly Grub menu once again.

-- 
Robinson Pizzio
Ph.D. Candidate
LPDS - Digital Signal Processing Research Lab
Department of Electrical Engineering
Federal University of Santa Catarina - Florianópolis - BRAZIL
E-mail: rpizzio em ieee.org
URL: http://eel.ufsc.br/~lpds/students/robinson.html
-------------- Próxima Parte ----------
Um anexo em HTML foi limpo...
URL: http://www.softwarelivre.ufsc.br/pipermail/gufsc/attachments/20070522/24d1f561/attachment.html 


Mais detalhes sobre a lista de discussão GUFSC