LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 2118|回复: 7

卸掉一块硬 盘,,,LINUX所在分区从HD1,8变成HD0,8就不能启动了,,如何解决?

[复制链接]
发表于 2010-4-4 03:16:42 | 显示全部楼层 |阅读模式
开始我电脑有两个硬盘,,一直用hdb1引导启动,,,,,,,,hda仅仅是数据仓库

装的linux 系统也是在hdb上面
由于中毒,现在把hda取走了,  hdb的xp系统也重装了,,,
从GRUB4DOS可以进一点点
就报错
WARING bootdevice may be renamed
Gave up waiting for root device common problems:
-Boot args (cat /proc/cmdline)
     -check rootdelay=(did the system wait long enough?)
     -check root=(did the system wait for the right device?)
-Missing modules (cat /proc/modules ;ls /dev)
ALERT! /dev/hda8 doest not exist.Dropping to a shell!
BusyBox V1.13.3(UBUNTU 1:1.13.3-1ubuntu 7) built-in shell (ash)ed DEVICE part
Enter 'HELP' for a list of built-in commands.
(initramfs)-




卸掉一块硬 盘,,,LINUX所在分区从HD1,8变成HD0,8就不能启动了,,如何解决?
发表于 2010-4-4 11:05:22 | 显示全部楼层
用LiveCD把/etc/fstab改过来~~~
回复 支持 反对

使用道具 举报

 楼主| 发表于 2010-4-4 13:21:12 | 显示全部楼层
从GRUB4DOS可以进一点点
GRUB>root(hd0,7)
GRUB>kernel    /boot/vmlinuz-2.6.31-14-generic root=/dev/sda8 ro  quiet splash
GRUB>initrd    /boot/initrd.img-2.6.31-14-generic
GRUB>boot


就报错
WARING bootdevice may be renamed
Gave up waiting for root device common problems:ime exits
-Boot args (cat /proc/cmdline)
     -check rootdelay=(did the system wait long enough?)
     -check root=(did the system wait for the right device?)
-Missing modules (cat /proc/modules ;ls /dev)
ALERT! /dev/hda8 doest not exist.Dropping to a shell!
BusyBox V1.13.3(UBUNTU 1:1.13.3-1ubuntu 7) built-in shell (ash)ed DEVICE part
Enter 'HELP' for a list of built-in commands.
(initramfs)-


用以下方法可以进入桌面
GRUB> FIND --SET-ROOT /BOOT/GRUB/CORE.IMG
GRUB>KERNEL /BOOT/GRUB/CORE.IMG
GRUB>BOOT
进入一个选择菜单,有以前两个硬盘时的共8条选项,进入recovery mode,
选grub update grub bootloader修复了GRUB菜单,现在只有5项
可以启动进入桌面,但用第一种方法还是不行。不知道要在哪里再改



机子没有光驱,,,,进不了LIVE CD
我先试试第二种方法进去能不能照楼上的方法修复。
楼上能说得更明白吗,难道是改个名字吗?
回复 支持 反对

使用道具 举报

 楼主| 发表于 2010-4-4 13:33:17 | 显示全部楼层
# /etc/fstab: static file system information.
#
# Use 'blkid -o value -s UUID' to print the universally unique identifier
# for a device; this may be used with UUID= as a more robust way to name
# devices that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    defaults        0       0
# / was on /dev/sdb8 during installation
UUID=4f110e74-8a80-4d9a-bf6c-7c3e6c0f1883 /               ext4    errors=remount-ro 0       1
# swap was on /dev/sda9 during installation
UUID=deb75775-6d8a-49f3-9f98-d7286ab045ff none            swap    sw              0       0




我把它改成下面的了,,不知道行不行
# /etc/fstab: static file system information.
#
# Use 'blkid -o value -s UUID' to print the universally unique identifier
# for a device; this may be used with UUID= as a more robust way to name
# devices that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    defaults        0       0
# / was on /dev/sda8 during installation
UUID=4f110e74-8a80-4d9a-bf6c-7c3e6c0f1883 /               ext4    errors=remount-ro 0       1
# swap was on /dev/sda9 during installation
UUID=4f110e74-8a80-4d9a-bf6c-7c3e6c0f1883 none            swap    sw              0       0

试过了,,还不行,,可能是没有正确的sda9的UUID
如何能找到?
回复 支持 反对

使用道具 举报

 楼主| 发表于 2010-4-4 13:35:47 | 显示全部楼层
############GRUB.CFG

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by /usr/sbin/grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
if [ -s /boot/grub/grubenv ]; then
  have_grubenv=true
  load_env
fi
set default="0"
if [ ${prev_saved_entry} ]; then
  saved_entry=${prev_saved_entry}
  save_env saved_entry
  prev_saved_entry=
  save_env prev_saved_entry
fi
insmod ext2
set root=(hd0,8)
search --no-floppy --fs-uuid --set 4f110e74-8a80-4d9a-bf6c-7c3e6c0f1883
if loadfont /usr/share/grub/unicode.pf2 ; then
  set gfxmode=640x480
  insmod gfxterm
  insmod vbe
  if terminal_output gfxterm ; then true ; else
    # For backward compatibility with versions of terminal.mod that don't
    # understand terminal_output
    terminal gfxterm
  fi
fi
if [ ${recordfail} = 1 ]; then
  set timeout=-1
else
  set timeout=10
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=white/black
set menu_color_highlight=black/white
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
menuentry "Ubuntu, Linux 2.6.31-14-generic" {
        recordfail=1
        if [ -n ${have_grubenv} ]; then save_env recordfail; fi
        set quiet=1
        insmod ext2
        set root=(hd0,8)
        search --no-floppy --fs-uuid --set 4f110e74-8a80-4d9a-bf6c-7c3e6c0f1883
        linux        /boot/vmlinuz-2.6.31-14-generic root=UUID=4f110e74-8a80-4d9a-bf6c-7c3e6c0f1883 ro   quiet splash
        initrd        /boot/initrd.img-2.6.31-14-generic
}
menuentry "Ubuntu, Linux 2.6.31-14-generic (recovery mode)" {
        recordfail=1
        if [ -n ${have_grubenv} ]; then save_env recordfail; fi
        insmod ext2
        set root=(hd0,8)
        search --no-floppy --fs-uuid --set 4f110e74-8a80-4d9a-bf6c-7c3e6c0f1883
        linux        /boot/vmlinuz-2.6.31-14-generic root=UUID=4f110e74-8a80-4d9a-bf6c-7c3e6c0f1883 ro single
        initrd        /boot/initrd.img-2.6.31-14-generic
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry "Memory test (memtest86+)" {
        linux16        /boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
        linux16        /boot/memtest86+.bin console=ttyS0,115200n8
}
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry "Microsoft Windows XP Professional (on /dev/sda1)" {
        insmod fat
        set root=(hd0,1)
        search --no-floppy --fs-uuid --set f8d6-1a97
        drivemap -s (hd0) ${root}
        chainloader +1
}
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###



没搞懂为什么能进的GRUB的配置是(HD0,8)
回复 支持 反对

使用道具 举报

 楼主| 发表于 2010-4-4 16:07:10 | 显示全部楼层
那么,我们如何知道一个分区的 UUID 呢?

有 3 种方法:

1. 通过浏览 /dev/disk/by-uuid/ 下的设备文件信息。

# ls -l /dev/disk/by-uuid/

------

lrwxrwxrwx 1 root root 10 10-13 09:14 0909-090B -> ../../sdb5

lrwxrwxrwx 1 root root 10 10-13 09:13 7c627a81-7a6b-4806-987b-b5a8a0a93645 -> ../../sda4

.....

2. 通过 vol_id 命令。

# vol_id /dev/sdb5

ID_FS_USAGE=filesystem

ID_FS_TYPE=vfat

ID_FS_VERSION=FAT32

ID_FS_UUID=0909-090B

ID_FS_UUID_ENC=0909-090B

ID_FS_LABEL=SWAP

ID_FS_LABEL_ENC=SWAP

ID_FS_LABEL_SAFE=SWAP

3. 通过 blkid 命令

# blkid /dev/sdb5

/dev/sdb5: LABEL="SWAP" UUID="0909-090B" TYPE="vfat"

通过这三种方法都可以获得分区的 UUID,UUID 依据分区不同,长度和格式都不相同。




我自己的

administrator@ubuntu:~$ ls -l /dev/disk/by-uuid/
总计 0
lrwxrwxrwx 1 root root 10 2010-04-05 00:47 4f110e74-8a80-4d9a-bf6c-7c3e6c0f1883 -> ../../sda8
lrwxrwxrwx 1 root root 10 2010-04-05 00:47 8236-DBD6 -> ../../sda5
lrwxrwxrwx 1 root root 10 2010-04-05 00:47 C313-13EE -> ../../sda7
lrwxrwxrwx 1 root root 10 2010-04-05 00:47 C352-49C7 -> ../../sda6
lrwxrwxrwx 1 root root 10 2010-04-05 00:47 e74b14e0-adb4-4522-8864-15f1b176f530 -> ../../sda9
lrwxrwxrwx 1 root root 10 2010-04-05 00:47 F8D6-1A97 -> ../../sda1
administrator@ubuntu:~$
回复 支持 反对

使用道具 举报

 楼主| 发表于 2010-4-4 17:02:28 | 显示全部楼层
直接搞了个menu.lst放到C:\

root=(hd0,8)
kernel /boot/vmlinuz-2.6.31-14-generic root=UUID=4f110e74-8a80-4d9a-bf6c-7c3e6c0f1883 ro quiet splash
initrd /boot/initrd.img-2.6.31-14-generic
boot

这样就能进来了
有点没搞懂
是不是和改四楼fstab有关?
那个明显是改错了的嘛。。。。。。

我想如果不用UUID,,,而用SDA8的话,,应该还是不行,,
如果要要想用SDA8又该如何修改呢,,

还有现在进了系统用的交换分区是不是SDA9呢?要不要人工在哪里修改指定?
回复 支持 反对

使用道具 举报

发表于 2010-4-25 09:15:10 | 显示全部楼层
这个。。。UBUNTU不是用UUID来指定分区的么?
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表