您的位置:首页 > 运维架构 > Linux

centos7 grub2 引导win7

2014-12-14 17:34 204 查看
win7 压缩卷,腾出部分空间安装centos7.安装后发现win7无法引导了。

#fdisk -l

Device Boot Start End Blocks Id System

/dev/sda1 * 1 1275 10241406 7 HPFS/NTFS

/dev/sda2 1276 9383 65127479 f W95 Ext'd (LBA)

/dev/sda5 1276 3267 16000708+ 7 HPFS/NTFS

/dev/sda6 3268 8367 40965718+ 7 HPFS/NTFS

/dev/sda7 8368 9259 7164958+ 83 Linux

/dev/sda8 9260 9383 995998+ 82 Linux swap / Solaris

# mv /boot/grub2/grub.cfg   /boot/grub2/grub.cfg.bak

#vi /boot/grub2/grub.cfg

#添加如下到/boot/grub2/grub.cfg 。

#添加在这个下边就可以,也就是最开始

### BEGIN /etc/grub.d/00_header ###

#try to add win7 to grub2

menuentry "Microsoft Windows 7l" {

set root=(hd0,1)

search --no-floppy --fs-uuid --set 76e49102e490c631

drivemap -s (hd0) $root

chainloader +1

}

后续:几天后win7被系统安排到后边去了,centos7在最上边了。

set default="${saved_entry}"

menuentry 'CentOS Linux (3.10.0-123.13.1.el7.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-123.el7.x86_64-advanced-faa1e53d-0532-4d2a-8047-c5858e6cd9a0' {

    load_video

    set gfxpayload=keep

    insmod gzio

    insmod part_msdos

    insmod xfs

    set root='hd0,msdos8'

    if [ x$feature_platform_search_hint = xy ]; then

      search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos8 --hint-efi=hd0,msdos8 --hint-baremetal=ahci0,msdos8 --hint='hd0,msdos8'  a16c3019-7668-4285-83ba-3de17032e10e

    else

      search --no-floppy --fs-uuid --set=root a16c3019-7668-4285-83ba-3de17032e10e

    fi

    linux16 /vmlinuz-3.10.0-123.13.1.el7.x86_64 root=/dev/mapper/cl-root ro rd.lvm.lv=cl/root vconsole.font=latarcyrheb-sun16  vconsole.keymap=us rd.lvm.lv=cl/swap rhgb quiet LANG=en_US.UTF-8

    initrd16 /initramfs-3.10.0-123.13.1.el7.x86_64.img

}
menuentry 'Windows 7 (loader) (on /dev/sda2)' {

insmod ntfs

set root=(hd0,1)

#search -no-floppy -fs-uuid -set fe24211f2420dc81

chainloader +1

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  grub2 win7