Grub influenzato da mtab

Se capita di dover migrare l'intero sistema operativo linux da una macchina ad un altra usando il solito trucchetto del rsync e del chroot, bisogna prestare attenzione a quanto è scritto nell'mtab.

Grub infatti è influenzato dai dati che mtab contiene.
Es.
la nuova macchina ha come root /dev/sda1. La vecchia macchina aveva /dev/hda1. Entro nell'ambiente chroot aggiorno /boot/grub/menu.lst con in nuovi dati e lancio

/boot/grub# grub-install /dev/sda
/dev/hda1: Not found or not a block device. 

??? certo che non lo trovi! ora la tua root è /dev/sda1! allora mi domando da dove arrivi questo hda1. Lo scovo in /etc/mtab:

/dev/hda1 / reiserfs rw,notail 0 0 

Bingo! modifico hda1 in sda1

grub-install /dev/sda
Searching for GRUB installation directory ... found:
/boot/grub Installation finished.
No error reported.
This is the contents of the device map /boot/grub/device.map. Check if this is correct or not.
If any of the lines is incorrect, fix it and re-run the script `grub-install'.
(hd0)  /dev/sda

Perfetto funziona.

Ci sono altre situazioni in cui grub fa i capricci durante la fase di installazione:
Es.

grub-install -recheck /dev/sda

può ritornare questo errore:

"The file /boot/grub/stage2 not read correctly"

Allora accedo alla console di grub e procedo in questo modo:

grub 
grub> root (hd0,0) 
grub> setup (hd0) 
grub> quit

ora rilanciando il comando

grub-install -recheck /dev/sda

il messaggio d'errore dovrebbe scomparire

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
6 + 7 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.