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

硬盘改变位置之后重新安装GRUB以及修改相应文件的方法(转)[@more@]

摘要

修改GRUB(2003-09-22 09:50:49)

By seraphim

Author:Seraphim(张乐奕)

Mail:seraphim@itpub.net

Date:2003-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

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/8225414/viewspace-945153/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/8225414/viewspace-945153/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值