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:
If you can unmount drives to which GRUB may write any amount of data,
unmount them before running grub.
If a drive cannot be unmounted but can be mounted with the read-only
flag, mount it in read-only mode. That should be secure.
If a drive must be mounted with the read-write flag, make sure that no
activity is being done on it while the command grub is
running.
Reboot your operating system as soon as possible. This is probably not
required if you follow the rules above, but reboot is the most secure
way.
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
Published under the terms of the GNU General Public License