GRUB2 Migration/pt-br

O objetivo deste guia é fornecer aos leitores uma migração suave do GRUB Legacy para o GRUB2.

O que é GRUB?
GRUB é um dos inicializadores em uso mais comumente encontrados em máquinas Linux não embarcadas. O papel do GRUB é facilitar o kernel Linux a ser carregado do disco para a memória e iniciar a execução do kernel Linux.

Por que migrar?
Em primeiro lugar, o GRUB Legacy não é mais mantido e, como tal, não recebe mais atualizações. O GRUB Legacy foi criado num momento em que os desenvolvedores se sentiam seguros em fazer diversas suposições que já não são mais verdade hoje. Por exemplo, o GRUB Legacy é incapaz de inicializar a partir de discos maiores que 2 TB e assume que os novos sistemas de arquivos não viriam para substituir o.

O GRUB2 pretende ser mais robusto, mais portável, mais poderoso e é mantido com uma base de código mais limpa. GRUB2 suporta mais configurações de hardware, mais sistemas de arquivos e mais layouts de unidades do que seu predecessor.

Migration to GRUB2
Migration to GRUB2 is fairly straightforward: it will be pulled in as part of the regular upgrade process by the package manager. If it is not pulled in automatically, it can always be merged via the  package atom:

Boot drive
The first important part is to understand which drive is bootable. For those who followed the Gentoo Handbook it should be. For those who are uncertain, the easiest way to find out is to look at the existing GRUB Legacy configuration. Viewing the file is the main place to check.

The will look something like this:

Based on the above file it is possible to know that  is the boot drive but we must map this to a real device. To know this, look at the file. An example one is provided below.

Based on the above file we know that is the boot drive.

Installing and configuring GRUB2
The next step is to install and configure GRUB2 for the partition without removing GRUB Legacy from the drive's MBR. The example below uses - replace it with the correct boot drive path. The first step installs the necessary GRUB2 files to, while the second step scans the available kernels and generates a suitable config file to. Skip the second step when using a Manual Configuration.

Chainloading GRUB2 from GRUB Legacy to test the setup
Because a broken GRUB configuration could mean an unbootable system, we want to test our GRUB2 configuration before making it permanent. To do this we will chainload GRUB2 from GRUB Legacy. This is done by adding a new section into. An example is shown below.

At this point the machine should be rebooted, and  selected from the GRUB menu when the machine begins to boot. Another GRUB menu will be presented which should advertise itself as GRUB 2.0.0 or higher at the top and show the available kernel(s) to boot. Should this not work, simply reboot the system and pick the normal boot option instead of.

Replacing and removing GRUB Legacy
At this point, if everything worked successfully, replace GRUB Legacy and remove it from the system.

At this point use the package manager to remove.

The migration is now complete.

Maintaining GRUB2
Whenever a new kernel is installed, perform the next step so that the GRUB2 configuration recognizes the new kernel (except when using a manual configuration).