免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3824 | 回复: 7
打印 上一主题 下一主题

重装windows后如何找回我的ubuntu? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-12-11 23:17 |只看该作者 |倒序浏览
我的电脑里装的是双系统,默认启动是ubuntu,因为病毒的原因,重新安装了windows,结果grub没了,如果不重新安装ubuntu,如何把它找回来?

论坛徽章:
0
2 [报告]
发表于 2007-12-12 09:07 |只看该作者
如果Linux分区还在的话,用安装光盘启动进入rescue模式,chroot到硬盘上的“/”分区,然后运行grub-install重新安装grub

论坛徽章:
0
3 [报告]
发表于 2007-12-17 21:43 |只看该作者
谢谢 ,回去试试

论坛徽章:
0
4 [报告]
发表于 2007-12-17 21:52 |只看该作者
非常好用,谢谢!

论坛徽章:
0
5 [报告]
发表于 2007-12-29 11:40 |只看该作者

回复 #2 sakulagi 的帖子

是啊, 就是这么来一次。

论坛徽章:
0
6 [报告]
发表于 2008-01-19 20:34 |只看该作者
用 GRUB FOR DOS

论坛徽章:
0
7 [报告]
发表于 2008-01-21 11:42 |只看该作者

回复 #2 sakulagi 的帖子

只能那样了,用启动盘,分区不在的话,只好重装Linux

论坛徽章:
0
8 [报告]
发表于 2008-01-25 17:48 |只看该作者
看看下边这个GUIDE,从UBUNTU WIKI找来的.千万注意最后一条命令不要写错.

用LiveCD覆盖Windows启动设置


从LiveCD启动并打开一个终端(terminal).你需要运行几条命令,比如sudo -i,来获得root权限.小心任何一个输入错误,这在root下可能带来不可挽回的结果.

我们需要找到安装Ubuntu的分区.用fdisk -l命令得到分区信息,例如:

$ sudo fdisk -l

Disk /dev/hda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/hda1               1           8       64228+  83  Linux
/dev/hda2               9        1224     9767520   83  Linux
/dev/hda3   *        1225        2440     9767520   a5  FreeBSD
/dev/hda4            2441       14593    97618972+   5  Extended
/dev/hda5           14532       14593      498015   82  Linux swap / Solaris
/dev/hda6            2441       14530    97112862   83  Linux

Partition table entries are not in disk order

Here I have three Linux partitions. /dev/hda2 is my root partition, /dev/hda1 is my /boot partition and /dev/hda6 is my /home partitoins. If you only have one, obviously this is the one your Ubuntu system is installed on. If you have more than one and you don't know which one your Ubuntu is installed on, we'll look for it later. First, create a mountpoint for your partition, for example :


$ mkdir /mnt/root


Then mount your partition in it. If you don't know which one it is, then mount any of them, we'll se if it's the correct one.


$ mount -t ext3 /dev/hda2 /mnt/root


Of course, replace /dev/hda2 with the correct name of your partition. You can check if it's the correct one by running ls /mnt/root, which should output something like this :

bin    dev      home        lib    mnt   root     srv  usr
boot   etc      initrd      lib64  opt   sbin     sys  var
cdrom  initrd.img  media  proc  selinux  tmp  vmlinuz

If what you have looks not at all like this, you didn't mount the correct partition. Do umount /mnt/root to unmount it and try another one. You also need to mount your /boot partition if you made one, like this :


$ mount -t ext3 /dev/hda1 /mnt/root/boot


To make sure it was the correct one, run ls /mnt/root/boot, which sould output something like this :

config-2.6.18-3-686      initrd.img-2.6.18-3-686.bak  System.map-2.6.18-3-686
grub                     lost+found                   vmlinuz-2.6.18-3-686
initrd.img-2.6.18-3-686  memtest86+.bin

Once again, if what you have doesn't fit, unmount it and try another partition.

Now that everything is mounted, we just need to reinstall GRUB :


$ grub-install --root-directory=/mnt/root /dev/hda


If you got BIOS warnings try:


$ grub-install --root-directory=/mnt/root /dev/hda --recheck


Of course, replace /dev/hda with the location you want to install GRUB on. If all went well, you should see something like this :


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'.


(hd0) /dev/hda

Now you can reboot and the GRUB menu should appear. If you see a warning message regarding XFS filesystem, you can ignore it.

[ 本帖最后由 Mart1n 于 2008-1-25 17:50 编辑 ]
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP