硬盘改变位置之后重新安装GRUB以及修改相应文件的方法

AuthorKamus(张乐奕)

Mailkamus@itpub.net

Date2003-08

 

问题描述:

原来系统是装在计算机第二个IDE口上(hdc)mount了另外一块hda/u01下面。
现在想把这两块硬盘的位置对调一下,hda->hdc,原来的hdc->hda,请问我该如何修改GRUB的配置?

当前硬盘配置和GRUB配置如下所示:

linux:/home/zhangleyi # fdisk -l

Disk /dev/hdc: 10.2 GB, 10262568960 bytes
16 heads, 63 sectors/track, 19885 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes

Device Boot Start End Blocks Id System
/dev/hdc1 * 1 25 12568+ 83 Linux
/dev/hdc2 26 2522 1258488 82 Linux swap
/dev/hdc3 2523 19885 8750952 83 Linux

Disk /dev/hda: 20.5 GB, 20576747520 bytes
255 heads, 63 sectors/track, 2501 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 2501 20089251 83 Linux

linux:/home/zhangleyi # more /etc/grub.conf
root (hd0,0)
install --stage2=/boot/grub/stage2 /grub/stage1 d (hd0) /grub/stage2 0x8000 (hd0,0)/grub/menu.lst
quit


linux:/home/zhangleyi # more /boot/grub/menu.lst
# Modified by YaST2. Last modification on Sat Aug 2 09:56:00 2003


gfxmenu (hd1,0)/message
color white/blue black/light-gray
default 0
timeout 8

title linux
kernel (hd1,0)/vmlinuz root=/dev/hdc3 vga=791 splash=silent
initrd (hd1,0)/initrd

title floppy
root (fd0)
chainloader +1

title failsafe
kernel (hd1,0)/vmlinuz.shipped root=/dev/hdc3 ide=nodma apm=off acpi=off vga=normal nosmp maxcpus=0 disableapic 3
initrd (hd1,0)/initrd.shipped

linux:/home/zhangleyi #

 

首先感谢 www.linuxsir.com beyond_2000 斑竹的耐心解释,才有了这篇东西的诞生。
其次,对于 GRUB 的详细解释,可以用 info grub 得到。

目的:
本来系统安装在 hdc ( 也就是第二个 IDE 接口的 primary 位置上 ) GRUB 装在另一块硬盘 hda 上,现在想把这两块硬盘位置对调一下。

方法:
首先 more /etc/fstab ,确认当前有几个独立的文件系统,我的机器情况如下:
/dev/hdc3
/ /dev/hdc1 /boot /dev/hdc2 swap

1.
关机,把硬盘的连线从 hdc 改成 hda

2.
SuSE 安装盘的 CD1 启动计算机

3.
在启动菜单中选择 rescue

4.
输入 root ,不需要密码,进入 rescue 命令行

5. pwd
,可以看到当前目录为 /root ,退回到 /

5.
键入 grub ,进入 grub 命令状态

6. find /boot/grub/stage1
,该命令用于确认包含 boot 所需文件的目录,显示 hd0,0

7. root (hd0,0)

8. setup (hd0)
显示成功安装 GRUB

9. quit
,退出 grub 命令行状态

10. mount /dev/hda1 /tmp (
备注:没有该硬盘连线之前是 hdc ,现在是 hda 了,该命令将 mount 原先的 /boot 分区 )

11. mount /dev/hda3 /usr (
备注:该命令将 mount 原先的 / 分区 )

12. vi /tmp/grub/menu.lst
,将所有的 hd1 改为 hd0 hdc 改成 hda ,存盘退出

13. vi /usr/etc/fstab
将所有的 hdc 改成 hda,hda 改成 hdc ,存盘退出

14.
重启计算机, OK
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值