Chinaunix首页 | 论坛 | 博客
  • 博客访问: 191009
  • 博文数量: 28
  • 博客积分: 1490
  • 博客等级: 上尉
  • 技术积分: 310
  • 用 户 组: 普通用户
  • 注册时间: 2006-10-17 10:01
文章分类
文章存档

2012年(3)

2011年(2)

2008年(2)

2007年(7)

2006年(14)

我的朋友

分类: LINUX

2006-12-18 14:03:25

本帖来源于互联网(链接),摘录部分在此以备用。

Restore GRUB

1.Mount the Gentoo Partitions
# mount /dev/hda6 /mnt/gentoo
# mount /dev/hda2 /mnt/gentoo/boot

2.Mount the /proc filesystem on /mnt/gentoo/proc to allow the installation to use the kernel-provided information within the chrooted environment,
and then mount-bind the /dev filesystem.
# mount -t proc none /mnt/gentoo/proc
# mount -o bind /dev /mnt/gentoo/dev

3.This chrooting is done in three steps.
First we will change the root from / (on the installation medium) to /mnt/gentoo (on your partitions) using chroot.
Then we will create a new environment using env-update, which essentially creates environment variables.
Finally, we load those variables into memory using source.
# chroot /mnt/gentoo /bin/bash
# env-update
>> Regenerating /etc/ld.so.cache...
# source /etc/profile
# export PS1="(chroot) $PS1"

4.To install GRUB you will need to issue the grub-install command. However, grub-install won't work off-the-shelf since we are inside a chrooted environment. We need to create /etc/mtab which lists all mounted filesystems. Fortunately, there is an easy way to accomplish this - just copy over /proc/mounts to /etc/mtab, excluding the rootfs line if you haven't created a separate boot partition. The following command will work in both cases:
# grep -v rootfs /proc/mounts > /etc/mtab

5.Now we can install GRUB using grub-install:
# grub-install /dev/hda

6. Exit
# exit
# umount /mnt/gentoo/boot
# umount /mnt/gentoo
# reboot
阅读(1317) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~