Next: , Previous: Basic usage, Up: Invoking the grub shell


15.2 How to install GRUB via grub

The installation procedure is the same as under the native Stage 2. See Installation, for more information. The command grub-specific information is described here.

What you should be careful about is buffer cache. grub makes use of raw devices instead of filesystems that your operating systems serve, so there exists a potential problem that some cache inconsistency may corrupt your filesystems. What we recommend is:

In addition, enter the command quit when you finish the installation. That is very important because quit makes the buffer cache consistent. Do not push <C-c>.

If you want to install GRUB non-interactively, specify `--batch' option in the command-line. This is a simple example:

     #!/bin/sh
     
     # Use /usr/sbin/grub if you are on an older system.
     /sbin/grub --batch <<EOT 1>/dev/null 2>/dev/null
     root (hd0,0)
     setup (hd0)
     quit
     EOT