无法用grub2引导逻辑分区上的windows 7

启动讨论 grub/grub2/syslinux/grub4dos/Lilo
头像
sddzcuigc
帖子: 55
注册时间: 2009-03-08 12:24

Re: 无法用grub2引导逻辑分区上的windows 7

#46

帖子 sddzcuigc » 2011-03-23 19:54

代码: 全选

Boot Info Script 0.55    dated February 15th, 2010                    

============================= Boot Info Summary: ==============================

 => Grub 2 is installed in the MBR of /dev/sda and looks on the same drive in 
    partition #5 for /boot/grub.

sda1: _________________________________________________________________________

    File system:       ntfs
    Boot sector type:  Windows Vista/7
    Boot sector info:  No errors found in the Boot Parameter Block.
    Operating System:  Windows XP
    Boot files/dirs:   /ntldr /NTDETECT.COM

sda2: _________________________________________________________________________

    File system:       ntfs
    Boot sector type:  Windows XP
    Boot sector info:  According to the info in the boot sector, sda2 starts 
                       at sector 63. But according to the info from fdisk, 
                       sda2 starts at sector 10490508.
    Operating System:  Windows 7
    Boot files/dirs:   /bootmgr /Boot/BCD /Windows/System32/winload.exe 
                       /ntldr /NTDETECT.COM

sda3: _________________________________________________________________________

    File system:       Extended Partition
    Boot sector type:  -
    Boot sector info:  

sda5: _________________________________________________________________________

    File system:       ext4
    Boot sector type:  Grub
    Boot sector info:  Grub 0.97 is installed in the boot sector of sda5 and 
                       looks at sector 36781360 of the same hard drive for 
                       the stage2 file. A stage2 file is at this location on 
                       /dev/sda. Stage2 looks on partition #6 for 
                       /boot/grub/menu.lst.
    Operating System:  Ubuntu 10.04.1 LTS
    Boot files/dirs:   /boot/grub/menu.lst /boot/grub/grub.cfg /etc/fstab 
                       /boot/grub/core.img

sda6: _________________________________________________________________________

    File system:       swap
    Boot sector type:  -
    Boot sector info:  

=========================== Drive/Partition Info: =============================

Drive: sda ___________________ _____________________________________________________

Disk /dev/sda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders, total 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes

Partition  Boot         Start           End          Size  Id System

/dev/sda1    *             63    10,490,444    10,490,382   7 HPFS/NTFS
/dev/sda2          10,490,508    27,541,209    17,050,702   7 HPFS/NTFS
/dev/sda3          27,541,210    41,940,991    14,399,782   5 Extended
/dev/sda5          27,541,504    41,218,047    13,676,544  83 Linux
/dev/sda6          41,220,096    41,940,991       720,896  82 Linux swap / Solaris


blkid -c /dev/null: ____________________________________________________________

Device           UUID                                   TYPE       LABEL                         

/dev/sda1        622868EF2868C39F                       ntfs                                     
/dev/sda2        8218A2FA9499D62D                       ntfs                                     
/dev/sda3: PTTYPE="dos" 
/dev/sda5        ea0922d5-ced5-42d2-9b12-a0df10257b4e   ext4                                     
/dev/sda6        f0f18abb-72de-44a5-ac04-6c6f44257c10   swap                                     
/dev/sda: PTTYPE="dos" 

============================ "mount | grep ^/dev  output: ===========================

Device           Mount_Point              Type       Options

/dev/sda5        /                        ext4       (rw,errors=remount-ro)
/dev/sr0         /media/WINDOWS PE TOOLKIT iso9660    (ro,nosuid,nodev,uhelper=udisks,uid=1000,gid=1000,iocharset=utf8,mode=0400,dmode=0500)


=========================== sda5/boot/grub/menu.lst: ===========================

# menu.lst - See: grub(8), info grub, update-grub(8)
#            grub-install(8), grub-floppy(8),
#            grub-md5-crypt, /usr/share/doc/grub
#            and /usr/share/doc/grub-legacy-doc/.

## default num
# Set the default entry to the entry number NUM. Numbering starts from 0, and
# the entry number 0 is the default if the command is not used.
#
# You can specify 'saved' instead of a number. In this case, the default entry
# is the entry saved with the command 'savedefault'.
# WARNING: If you are using dmraid do not use 'savedefault' or your
# array will desync and will not let you boot your system.
default        0

## timeout sec
# Set a timeout, in SEC seconds, before automatically booting the default entry
# (normally the first entry defined).
timeout        3

## hiddenmenu
# Hides the menu by default (press ESC to see the menu)
hiddenmenu

# Pretty colours
#color cyan/blue white/blue

## password ['--md5'] passwd
# If used in the first section of a menu file, disable all interactive editing
# control (menu entry editor and command-line)  and entries protected by the
# command 'lock'
# e.g. password topsecret
#      password --md5 $1$gLhU0/$aW78kHK1QfV3P2b2znUoe/
# password topsecret

#
# examples
#
# title        Windows 95/98/NT/2000
# root        (hd0,0)
# makeactive
# chainloader    +1
#
# title        Linux
# root        (hd0,1)
# kernel    /vmlinuz root=/dev/hda2 ro
#

#
# Put static boot stanzas before and/or after AUTOMAGIC KERNEL LIST

### BEGIN AUTOMAGIC KERNELS LIST
## lines between the AUTOMAGIC KERNELS LIST markers will be modified
## by the debian update-grub script except for the default options below

## DO NOT UNCOMMENT THEM, Just edit them to your needs

## ## Start Default Options ##
## default kernel options
## default kernel options for automagic boot options
## If you want special options for specific kernels use kopt_x_y_z
## where x.y.z is kernel version. Minor versions can be omitted.
## e.g. kopt=root=/dev/hda1 ro
##      kopt_2_6_8=root=/dev/hdc1 ro
##      kopt_2_6_8_2_686=root=/dev/hdc2 ro
# kopt=root=UUID=ea0922d5-ced5-42d2-9b12-a0df10257b4e ro

## default grub root device
## e.g. groot=(hd0,0)
# groot=ea0922d5-ced5-42d2-9b12-a0df10257b4e

## should update-grub create alternative automagic boot options
## e.g. alternative=true
##      alternative=false
# alternative=true

## should update-grub lock alternative automagic boot options
## e.g. lockalternative=true
##      lockalternative=false
# lockalternative=false

## additional options to use with the default boot option, but not with the
## alternatives
## e.g. defoptions=vga=791 resume=/dev/hda5
# defoptions=quiet splash

## should update-grub lock old automagic boot options
## e.g. lockold=false
##      lockold=true
# lockold=false

## Xen hypervisor options to use with the default Xen boot option
# xenhopt=

## Xen Linux kernel options to use with the default Xen boot option
# xenkopt=console=tty0

## altoption boot targets option
## multiple altoptions lines are allowed
## e.g. altoptions=(extra menu suffix) extra boot options
##      altoptions=(recovery) single
# altoptions=(recovery mode) single

## controls how many kernels should be put into the menu.lst
## only counts the first occurence of a kernel, not the
## alternative kernel options
## e.g. howmany=all
##      howmany=7
# howmany=all

## specify if running in Xen domU or have grub detect automatically
## update-grub will ignore non-xen kernels when running in domU and vice versa
## e.g. indomU=detect
##      indomU=true
##      indomU=false
# indomU=detect

## should update-grub create memtest86 boot option
## e.g. memtest86=true
##      memtest86=false
# memtest86=true

## should update-grub adjust the value of the default booted system
## can be true or false
# updatedefaultentry=false

## should update-grub add savedefault to the default options
## can be true or false
# savedefault=false

## ## End Default Options ##

title        Ubuntu 10.04.1 LTS, kernel 2.6.32-24-generic
uuid        ea0922d5-ced5-42d2-9b12-a0df10257b4e
kernel        /boot/vmlinuz-2.6.32-24-generic root=UUID=ea0922d5-ced5-42d2-9b12-a0df10257b4e ro quiet splash 
initrd        /boot/initrd.img-2.6.32-24-generic
quiet

title        Ubuntu 10.04.1 LTS, kernel 2.6.32-24-generic (recovery mode)
uuid        ea0922d5-ced5-42d2-9b12-a0df10257b4e
kernel        /boot/vmlinuz-2.6.32-24-generic root=UUID=ea0922d5-ced5-42d2-9b12-a0df10257b4e ro  single
initrd        /boot/initrd.img-2.6.32-24-generic

title        Chainload into GRUB 2
root        ea0922d5-ced5-42d2-9b12-a0df10257b4e
kernel        /boot/grub/core.img

title        Ubuntu 10.04.1 LTS, memtest86+
uuid        ea0922d5-ced5-42d2-9b12-a0df10257b4e
kernel        /boot/memtest86+.bin
quiet

### END DEBIAN AUTOMAGIC KERNELS LIST

=========================== sda5/boot/grub/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 $prefix/grubenv ]; then
  load_env
fi
set default="0"
if [ ${prev_saved_entry} ]; then
  set saved_entry=${prev_saved_entry}
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z ${boot_once} ]; then
    saved_entry=${chosen}
    save_env saved_entry
  fi
}

function recordfail {
  set recordfail=1
  if [ -n ${have_grubenv} ]; then if [ -z ${boot_once} ]; then save_env recordfail; 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/light-gray
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Ubuntu, with Linux 2.6.32-24-generic' --class ubuntu --class gnu-linux --class gnu --class os {
    recordfail
    insmod ext2
    set root='(hd0,5)'
    search --no-floppy --fs-uuid --set ea0922d5-ced5-42d2-9b12-a0df10257b4e
    linux    /boot/vmlinuz-2.6.32-24-generic root=UUID=ea0922d5-ced5-42d2-9b12-a0df10257b4e ro   quiet splash
    initrd    /boot/initrd.img-2.6.32-24-generic
}
menuentry 'Ubuntu, with Linux 2.6.32-24-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os {
    recordfail
    insmod ext2
    set root='(hd0,5)'
    search --no-floppy --fs-uuid --set ea0922d5-ced5-42d2-9b12-a0df10257b4e
    echo    'Loading Linux 2.6.32-24-generic ...'
    linux    /boot/vmlinuz-2.6.32-24-generic root=UUID=ea0922d5-ced5-42d2-9b12-a0df10257b4e ro single 
    echo    'Loading initial ramdisk ...'
    initrd    /boot/initrd.img-2.6.32-24-generic
}
### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_memtest86+ ###
menuentry "Memory test (memtest86+)" {
    insmod ext2
    set root='(hd0,5)'
    search --no-floppy --fs-uuid --set ea0922d5-ced5-42d2-9b12-a0df10257b4e
    linux16    /boot/memtest86+.bin
}
menuentry "Memory test (memtest86+, serial console 115200)" {
    insmod ext2
    set root='(hd0,5)'
    search --no-floppy --fs-uuid --set ea0922d5-ced5-42d2-9b12-a0df10257b4e
    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 ntfs
    set root='(hd0,1)'
    search --no-floppy --fs-uuid --set 622868ef2868c39f
    drivemap -s (hd0) ${root}
    chainloader +1
}
menuentry "Windows 7 (loader) (on /dev/sda2)" {
    insmod ntfs
    set root='(hd0,2)'
    search --no-floppy --fs-uuid --set 8218a2fa9499d62d
    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 ###

=============================== sda5/etc/fstab: ===============================

# /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    nodev,noexec,nosuid 0       0
# / was on /dev/sda6 during installation
UUID=ea0922d5-ced5-42d2-9b12-a0df10257b4e /               ext4    errors=remount-ro 0       1
# swap was on /dev/sda7 during installation
UUID=f0f18abb-72de-44a5-ac04-6c6f44257c10 none            swap    sw              0       0

=================== sda5: Location of files loaded by Grub: ===================


  18.8GB: boot/grub/core.img
  18.8GB: boot/grub/grub.cfg
  18.8GB: boot/grub/menu.lst
  18.8GB: boot/grub/stage2
  19.2GB: boot/initrd.img-2.6.32-24-generic
  19.2GB: boot/vmlinuz-2.6.32-24-generic
  19.2GB: initrd.img
  19.2GB: vmlinuz
 

我的QQ是553052416花月痕,欢迎加我为好友,一起解决问题。或者一起打KOF。
头像
sddzcuigc
帖子: 55
注册时间: 2009-03-08 12:24

Re: 无法用grub2引导逻辑分区上的windows 7

#47

帖子 sddzcuigc » 2011-03-23 19:57

为啥D:Boot sector type: Windows XP
C:Boot sector type: Windows7
我的QQ是553052416花月痕,欢迎加我为好友,一起解决问题。或者一起打KOF。
头像
sddzcuigc
帖子: 55
注册时间: 2009-03-08 12:24

Re: 无法用grub2引导逻辑分区上的windows 7

#48

帖子 sddzcuigc » 2011-03-23 20:08

2011-03-23_200725.png
2011-03-23_200725.png (5.75 KiB) 查看 1636 次
附件
2011-03-23_200839.png
2011-03-23_200839.png (1.57 KiB) 查看 1636 次
我的QQ是553052416花月痕,欢迎加我为好友,一起解决问题。或者一起打KOF。
头像
smallapple
论坛版主
帖子: 7868
注册时间: 2009-03-28 15:12

Re: 无法用grub2引导逻辑分区上的windows 7

#49

帖子 smallapple » 2011-03-23 20:11

C:是原来的没有用bootsect写过吧,那个倒关系不太大,找不到bootmgr会自动改为找ntldr的。
D:看引导数据没写进去,我传个pttd,PE下先用pttd检查下分区有没有错误,如果提示D盘有错误的,修复一下,再用 bootice.exe,你用这个写下第二分区引导扇区,运行bootice.exe后,选“分区引导记录”,再在目标分区选第二分区(D和盘),选 bootmgr 再安装/配置
bootice.tar.gz
(2.02 MiB) 已下载 37 次
压缩包有pttd和bootice
头像
onshoestring
论坛版主
帖子: 4666
注册时间: 2009-09-06 5:53

Re: 无法用grub2引导逻辑分区上的windows 7

#50

帖子 onshoestring » 2011-03-23 20:23

sddzcuigc 写了:为啥D:Boot sector type: Windows XP
C:Boot sector type: Windows7
如果先装xp,后装win7,这个是对的:C:Boot sector type: Windows7。
就是d盘奇怪,你自己重写了?:D:Boot sector type: Windows XP
头像
sddzcuigc
帖子: 55
注册时间: 2009-03-08 12:24

Re: 无法用grub2引导逻辑分区上的windows 7

#51

帖子 sddzcuigc » 2011-03-23 20:27

smallapple 写了:C:是原来的没有用bootsect写过吧,那个倒关系不太大,找不到bootmgr会自动改为找ntldr的。
D:看引导数据没写进去,我传个pttd,PE下先用pttd检查下分区有没有错误,如果提示D盘有错误的,修复一下,再用 bootice.exe,你用这个写下第二分区引导扇区,运行bootice.exe后,选“分区引导记录”,再在目标分区选第二分区(D和盘),选 bootmgr 再安装/配置
bootice.tar.gz
压缩包有pttd和bootice
我直接用bootice重写了D盘的PBR,将boot sector由ntldr改为bootmgr了。现在可以成功引导。当初不知为何bootsect没写进去。

是不是easybcd也有重写某个盘的PBR的功能,我用过它的某个功能,可能误操作了。
我的QQ是553052416花月痕,欢迎加我为好友,一起解决问题。或者一起打KOF。
头像
sddzcuigc
帖子: 55
注册时间: 2009-03-08 12:24

Re: 无法用grub2引导逻辑分区上的windows 7

#52

帖子 sddzcuigc » 2011-03-23 20:32

bootsect不能重写扇区boot sector类型吗?命令不就是 bootsect /nt60 d:吗?
我的QQ是553052416花月痕,欢迎加我为好友,一起解决问题。或者一起打KOF。
头像
sddzcuigc
帖子: 55
注册时间: 2009-03-08 12:24

Re: 无法用grub2引导逻辑分区上的windows 7

#53

帖子 sddzcuigc » 2011-03-23 20:33

bootsect不能重写扇区boot sector类型吗?命令不就是 bootsect /nt60 d:吗?
我的QQ是553052416花月痕,欢迎加我为好友,一起解决问题。或者一起打KOF。
头像
sddzcuigc
帖子: 55
注册时间: 2009-03-08 12:24

Re: 无法用grub2引导逻辑分区上的windows 7

#54

帖子 sddzcuigc » 2011-03-23 20:46

多谢小苹果,折腾了一天这个问题了,但总算现在能引导了,就是因为PBR类型不对,纠结在bootsect命令上,依然不清楚当初是怎么把D盘的PBR弄成ntldr的。
我的QQ是553052416花月痕,欢迎加我为好友,一起解决问题。或者一起打KOF。
头像
smallapple
论坛版主
帖子: 7868
注册时间: 2009-03-28 15:12

Re: 无法用grub2引导逻辑分区上的windows 7

#55

帖子 smallapple » 2011-03-23 20:48

bootsect /nt60 d:
命令没错,不知道哪个地方出错了,引导没写进去。也有可能逻辑分区转为主分区时引导扇区位置错误引起的

你执行bootsect /nt60 d: 应该不是提示成功写入,而是有什么报错信息才对
头像
sddzcuigc
帖子: 55
注册时间: 2009-03-08 12:24

Re: 无法用grub2引导逻辑分区上的windows 7

#56

帖子 sddzcuigc » 2011-03-23 21:12

smallapple 写了:bootsect /nt60 d:
命令没错,不知道哪个地方出错了,引导没写进去。也有可能逻辑分区转为主分区时引导扇区位置错误引起的

你执行bootsect /nt60 d: 应该不是提示成功写入,而是有什么报错信息才对
我终于发现了,不提示成功却提示...

在PE下,我把bootsect放在D盘上是无法成功更新D盘的PBR的。仔细看了看提示,需要先卸载D盘,然后最后提示了一个,注意两者都有successfully的提示。汗 :em06,前者是成功,后者是假成功。
2011-03-23_210322.png
2011-03-23_210322.png (3.05 KiB) 查看 1610 次
2011-03-23_210956.png
2011-03-23_210956.png (3.46 KiB) 查看 1610 次
我的QQ是553052416花月痕,欢迎加我为好友,一起解决问题。或者一起打KOF。
头像
sddzcuigc
帖子: 55
注册时间: 2009-03-08 12:24

Re: 无法用grub2引导逻辑分区上的windows 7

#57

帖子 sddzcuigc » 2011-03-23 21:22

linux下那个查看引导信息的软件是谁写的呀,希望作者更新修改MBR、PBR的功能,类似于bootice就好了
我的QQ是553052416花月痕,欢迎加我为好友,一起解决问题。或者一起打KOF。
头像
stroller2008
帖子: 461
注册时间: 2010-12-22 20:28

Re: 无法用grub2引导逻辑分区上的windows 7

#58

帖子 stroller2008 » 2011-03-23 21:52

够费劲的!
如果当初你装完系统,GHOST个镜像就简单多了,提取到任意你想要的分区,然后引导用GRUB4DOS!
这样做的好处,是可以任意调整,安全可退回,可前进!模块化的,这样你GURB2那天不好了,又要麻烦。

我的c盘xp后,D的引导代码也会自动成52,后来要在D放个WIN7PE,就BOOTSECT一下引导代码类型让他找BOOTMGR就ok了
win7镜像是随意提取,考虑使用的情况,多数直接到c盘。

好用的很。
头像
sddzcuigc
帖子: 55
注册时间: 2009-03-08 12:24

Re: 无法用grub2引导逻辑分区上的windows 7

#59

帖子 sddzcuigc » 2011-03-23 22:06

借此贴再问几个问题吧:

1、grub2会识别Win7的nt60 loader以及XP的 ntldr,能否有办法直接让grub1识别而不是必须手动修改menu.lst呢?
2、卸载grub2,安装grub1,是否可以从逻辑分区启动Win7呢?
我的QQ是553052416花月痕,欢迎加我为好友,一起解决问题。或者一起打KOF。
头像
sddzcuigc
帖子: 55
注册时间: 2009-03-08 12:24

Re: 无法用grub2引导逻辑分区上的windows 7

#60

帖子 sddzcuigc » 2011-03-23 23:13

smallapple 写了:找到问题所在了。
grub2不能兼容用bootsect /nt60写入的代码,用chainloder +1 后只会寻找主活动分区,再引导 bootmgr,
如果分区是用经win7格过的,其引导代码可以由grub2用chainloader +1引导。也就是说如果安装win7时,在安装的逻辑分区选择格式化再安装的,直接把主分区上的 bootmgr 和 boot目录移动到安装win7的逻辑分区,就可以由grub2引导逻辑分区上的win7,由新版本的gparted 格出的 ntfs 格式也可以由grub2用chainloader +1引导bootmgr的。
如果是由其他第三方分区工具格式化的后安装的,再用bootsect /nt60 写入引导,就不能引导逻辑分区下的bootmgr。

bootrec /fixboot 也不能支持写入逻辑分区的引导代码。

我发现所有根源就是win7的分区pbr是nt50的,结果后来我尝试不转换Win7为主分区,只用bootice转换pbr,仍然可以引导,并未出现苹果大大所说的问题。也就是说,目前我的经验说明,逻辑分区中的Win7无论使用grub或grub2都是可以引导的。不知苹果大大是个别情况还是怎么了。
我的QQ是553052416花月痕,欢迎加我为好友,一起解决问题。或者一起打KOF。
回复