在一块新磁盘上安装grub,并将它作为启动磁盘的步骤:
1.如果该磁盘已经有安装过grub,先修改grub启动磁盘
/boot/grub/device.map中描述了grub安装的磁盘。
[root@localhost ~]# cat /boot/grub/device.map
# this device map was generated by anaconda
(hd0) /dev/sda
[root@localhost ~]#
修改为
(hd1) /dev/sdb
2.安装grub文件
# grub-install /dev/sdb
[root@www ~]# grub-install [--root-directory=DIR] INSTALL_DEVICE
选项与参数:
--root-directory=DIR 那个 DIR 为实际的目录,
使用 grub-install 默认会将 grub 所有的档案都复制到 /boot/grub/* ,
如果想要复制到其他目录不装置去, 就得要用这个参数。
INSTALL_DEVICE 安装的装置代号啦!
范例一:将 grub 安装在目前系统的 MBR 底下,我的系统为 /dev/hda:
[root@www ~]# grub-install /dev/hda
# 因为原本 /dev/hda 就是使用 grub ,所以似乎不会出现什么特别的讯息。
# 如果去查阅一下 /boot/grub 的内容,会发现所有的档案都更新了,因为我们重装了!
3.安装MBR
# grub
grub> root (hd1,0)
grub> setup (hd1)
如果在一块全新的硬盘上安装grub
1.先格式化一个分区,sdb1
2.将sdb1mount到/home下
3.安装grub文件
# grub-install --root-directory=/home /dev/sdb
在sdb1分区下就有了grub目录
4.安装MBR
# grub
grub> root (hd1,0)
grub> setup (hd1)
这样sdb1上的grub就生效了,修改sdb1/boot/grub.conf文件,将在其他磁盘上的vmlinux,initrd下面方式添加:
title Red Hat Enterprise Linux 6.5 (2.6.32-431.el6.x86_64)
root (hd0,1)
kernel /vmlinuz-2.6.32-431.el6.x86_64 ro root=UUID=1234166a-651d-4798-a2af-9c419bf90ccd nomodeset rd_NO_LUKS KEYBOARDTYPE=pc KEYTABLE=us LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_NO_LVM rd_NO_DM rhgb quiet
initrd /initramfs-2.6.32-431.el6.x86_64.img
注:
1.该系统的启动文件vmlinux和inirtd存放在在sda2上
2.该系统的系统文件存放在UUID为1234166a-651d-4798-a2af-9c419bf90ccd的分区。
1.如果该磁盘已经有安装过grub,先修改grub启动磁盘
/boot/grub/device.map中描述了grub安装的磁盘。
[root@localhost ~]# cat /boot/grub/device.map
# this device map was generated by anaconda
(hd0) /dev/sda
[root@localhost ~]#
修改为
(hd1) /dev/sdb
2.安装grub文件
# grub-install /dev/sdb
[root@www ~]# grub-install [--root-directory=DIR] INSTALL_DEVICE
选项与参数:
--root-directory=DIR 那个 DIR 为实际的目录,
使用 grub-install 默认会将 grub 所有的档案都复制到 /boot/grub/* ,
如果想要复制到其他目录不装置去, 就得要用这个参数。
INSTALL_DEVICE 安装的装置代号啦!
范例一:将 grub 安装在目前系统的 MBR 底下,我的系统为 /dev/hda:
[root@www ~]# grub-install /dev/hda
# 因为原本 /dev/hda 就是使用 grub ,所以似乎不会出现什么特别的讯息。
# 如果去查阅一下 /boot/grub 的内容,会发现所有的档案都更新了,因为我们重装了!
3.安装MBR
# grub
grub> root (hd1,0)
grub> setup (hd1)
如果在一块全新的硬盘上安装grub
1.先格式化一个分区,sdb1
2.将sdb1mount到/home下
3.安装grub文件
# grub-install --root-directory=/home /dev/sdb
在sdb1分区下就有了grub目录
4.安装MBR
# grub
grub> root (hd1,0)
grub> setup (hd1)
这样sdb1上的grub就生效了,修改sdb1/boot/grub.conf文件,将在其他磁盘上的vmlinux,initrd下面方式添加:
title Red Hat Enterprise Linux 6.5 (2.6.32-431.el6.x86_64)
root (hd0,1)
kernel /vmlinuz-2.6.32-431.el6.x86_64 ro root=UUID=1234166a-651d-4798-a2af-9c419bf90ccd nomodeset rd_NO_LUKS KEYBOARDTYPE=pc KEYTABLE=us LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_NO_LVM rd_NO_DM rhgb quiet
initrd /initramfs-2.6.32-431.el6.x86_64.img
注:
1.该系统的启动文件vmlinux和inirtd存放在在sda2上
2.该系统的系统文件存放在UUID为1234166a-651d-4798-a2af-9c419bf90ccd的分区。