三、在Linux中,GRUB的配置中的安装和写入硬盘的MBR;
1、在Linux中,GRUB配置过程中的安装grub-install;
grub-install 命令有何用呢?其实就是把我们前面已经安装的软件包中的一些文件复制到 /boot/grub中;对于新安装GRUB软件包后,也是一个必经的过程;我们前面所说的GRUB软件包的安装;而现在我们说的是GRUB配置的过程中的安装;虽然在洋文中都是install ,但表达的意思是不一样的;
我们首先要运行 fdisk -l 来确认到底是硬盘的标识;
这个过程主要是确认硬盘的标识是哪个调备,到底是/dev/hda还是/dev/hdb 还是其它的;
[root@localhost ~]# fdisk -l
Disk /dev/hda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/hda1 * 1 970 7791493+ 7 HPFS/NTFS
/dev/hda2 971 9729 70356667+ 5 Extended
/dev/hda5 971 2915 15623181 b W95 FAT32
/dev/hda6 2916 4131 9767488+ 83 Linux
/dev/hda7 4132 5590 11719386 83 Linux
/dev/hda8 5591 6806 9767488+ 83 Linux
/dev/hda9 6807 9657 22900626 83 Linux
/dev/hda10 9658 9729 578308+ 82 Linux swap / Solaris
如果通过fdisk -l 出现有/dev/hda字样的,我们就要用下面的命令来安装;
[root@localhost ~]# grub-install /dev/hda
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'.
(fd0) /dev/fd0
(hd0) /dev/hda
如果是您fdisk -l 出现的有/dev/hdb呢,那就如下运行;
[root@localhost ~]# grub-install /dev/hdb
如果既有/dev/hda和/dev/hdb 就安装到/dev/hda中;
[root@localhost ~]# grub-install /dev/hda
值得注意的是如果您有一个/boot分区,应该用如下的办法来安装;
[root@localhost ~]#grub-install --root-directory=/boot /dev/hda
[root@localhost ~]#grub-install --root-directory=/boot /dev/hdb
注解:具体是/dev/hda还是/dev/hdb,请以fdisk -l 为准;如果两个都有,就看您把/boot分区是放在第一块硬盘还是第二块硬盘上了,以实际情况为准;