关于Centos使用grub无法引导Windows的解决办法
来源:互联网 发布:淘宝开店教程全集下载 编辑:程序博客网 时间:2024/05/16 15:37
关于Centos使用grub无法引导Windows的解决办法
今天在给小组同学装系统时,按惯例,都使用的是linux来引导windows的,因此就先将win 7安装了,后来,就来配置windowns的相关设置,配完后,就开始装Centos了,期间在分盘的时候,还失败了两次,显示的都是由于安装器出现bug了,这都是小插曲,最后还是装成功了,但是,使用命令grub2-mkconfig却无法找到win 7的引导,于是我就着急了,最后通过我的摸索,终于找到了解决方法,下面分享一下:
[root@localhost:~]$ grub2-mkconfig Generating grub configuration file ...## DO NOT EDIT THIS FILE## It is automatically generated by grub2-mkconfig using templates# from /etc/grub.d and settings from /etc/default/grub#### BEGIN /etc/grub.d/00_header ###set pager=1if [ -s $prefix/grubenv ]; then load_envfiif [ "${next_entry}" ] ; then set default="${next_entry}" set next_entry= save_env next_entry set boot_once=trueelse set default="${saved_entry}"fiif [ x"${feature_menuentry_id}" = xy ]; then menuentry_id_option="--id"else menuentry_id_option=""fiexport menuentry_id_optionif [ "${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=truefifunction savedefault { if [ -z "${boot_once}" ]; then saved_entry="${chosen}" save_env saved_entry fi}function load_video { if [ x$feature_all_video_module = xy ]; then insmod all_video else insmod efi_gop insmod efi_uga insmod ieee1275_fb insmod vbe insmod vga insmod video_bochs insmod video_cirrus fi}terminal_output consoleif [ x$feature_timeout_style = xy ] ; then set timeout_style=menu set timeout=5# Fallback normal timeout code in case the timeout_style feature is# unavailable.else set timeout=5fi### END /etc/grub.d/00_header ###### BEGIN /etc/grub.d/00_tuned ###set tuned_params=""### END /etc/grub.d/00_tuned ###### BEGIN /etc/grub.d/01_users ###if [ -f ${prefix}/user.cfg ]; then source ${prefix}/user.cfg if [ -n "${GRUB2_PASSWORD}" ]; then set superusers="root" export superusers password_pbkdf2 root ${GRUB2_PASSWORD} fifi### END /etc/grub.d/01_users ###### BEGIN /etc/grub.d/10_linux ###Found linux image: /boot/vmlinuz-3.10.0-327.10.1.el7.x86_64Found initrd image: /boot/initramfs-3.10.0-327.10.1.el7.x86_64.imgmenuentry 'CentOS Linux (3.10.0-327.10.1.el7.x86_64) 7 (Core)' --class rhel fedora --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-327.10.1.el7.x86_64-advanced-dfffd217-84d7-40cc-8ab9-83f43218c6a6' { load_video set gfxpayload=keep insmod gzio insmod part_msdos insmod xfs set root='hd0,msdos10' if [ x$feature_platform_search_hint = xy ]; then search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos10 --hint-efi=hd0,msdos10 --hint-baremetal=ahci0,msdos10 --hint='hd0,msdos10' f15778cb-939a-4179-beeb-62e5c3dc07db else search --no-floppy --fs-uuid --set=root f15778cb-939a-4179-beeb-62e5c3dc07db fi linux16 /vmlinuz-3.10.0-327.10.1.el7.x86_64 root=/dev/mapper/centos-root ro rd.lvm.lv=centos/root rd.lvm.lv=centos/swap crashkernel=auto rhgb quiet initrd16 /initramfs-3.10.0-327.10.1.el7.x86_64.img}Found linux image: /boot/vmlinuz-3.10.0-327.3.1.el7.x86_64Found initrd image: /boot/initramfs-3.10.0-327.3.1.el7.x86_64.imgmenuentry 'CentOS Linux (3.10.0-327.3.1.el7.x86_64) 7 (Core)' --class rhel fedora --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-327.3.1.el7.x86_64-advanced-dfffd217-84d7-40cc-8ab9-83f43218c6a6' { load_video set gfxpayload=keep insmod gzio insmod part_msdos insmod xfs set root='hd0,msdos10' if [ x$feature_platform_search_hint = xy ]; then search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos10 --hint-efi=hd0,msdos10 --hint-baremetal=ahci0,msdos10 --hint='hd0,msdos10' f15778cb-939a-4179-beeb-62e5c3dc07db else search --no-floppy --fs-uuid --set=root f15778cb-939a-4179-beeb-62e5c3dc07db fi linux16 /vmlinuz-3.10.0-327.3.1.el7.x86_64 root=/dev/mapper/centos-root ro rd.lvm.lv=centos/root rd.lvm.lv=centos/swap crashkernel=auto rhgb quiet initrd16 /initramfs-3.10.0-327.3.1.el7.x86_64.img}Found linux image: /boot/vmlinuz-3.10.0-229.20.1.el7.x86_64Found initrd image: /boot/initramfs-3.10.0-229.20.1.el7.x86_64.imgmenuentry 'CentOS Linux (3.10.0-229.20.1.el7.x86_64) 7 (Core)' --class rhel fedora --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-229.20.1.el7.x86_64-advanced-dfffd217-84d7-40cc-8ab9-83f43218c6a6' { load_video set gfxpayload=keep insmod gzio insmod part_msdos insmod xfs set root='hd0,msdos10' if [ x$feature_platform_search_hint = xy ]; then search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos10 --hint-efi=hd0,msdos10 --hint-baremetal=ahci0,msdos10 --hint='hd0,msdos10' f15778cb-939a-4179-beeb-62e5c3dc07db else search --no-floppy --fs-uuid --set=root f15778cb-939a-4179-beeb-62e5c3dc07db fi linux16 /vmlinuz-3.10.0-229.20.1.el7.x86_64 root=/dev/mapper/centos-root ro rd.lvm.lv=centos/root rd.lvm.lv=centos/swap crashkernel=auto rhgb quiet initrd16 /initramfs-3.10.0-229.20.1.el7.x86_64.img}Found linux image: /boot/vmlinuz-3.10.0-229.el7.x86_64menuentry 'CentOS Linux (3.10.0-229.el7.x86_64) 7 (Core)' --class rhel fedora --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-229.el7.x86_64-advanced-dfffd217-84d7-40cc-8ab9-83f43218c6a6' { load_video set gfxpayload=keep insmod gzio insmod part_msdos insmod xfs set root='hd0,msdos10' if [ x$feature_platform_search_hint = xy ]; then search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos10 --hint-efi=hd0,msdos10 --hint-baremetal=ahci0,msdos10 --hint='hd0,msdos10' f15778cb-939a-4179-beeb-62e5c3dc07db else search --no-floppy --fs-uuid --set=root f15778cb-939a-4179-beeb-62e5c3dc07db fi linux16 /vmlinuz-3.10.0-229.el7.x86_64 root=/dev/mapper/centos-root ro rd.lvm.lv=centos/root rd.lvm.lv=centos/swap crashkernel=auto rhgb quiet }Found linux image: /boot/vmlinuz-0-rescue-98a0f723fa374bccae65d892478a1677Found initrd image: /boot/initramfs-0-rescue-98a0f723fa374bccae65d892478a1677.imgmenuentry 'CentOS Linux (0-rescue-98a0f723fa374bccae65d892478a1677) 7 (Core)' --class rhel fedora --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-0-rescue-98a0f723fa374bccae65d892478a1677-advanced-dfffd217-84d7-40cc-8ab9-83f43218c6a6' { load_video insmod gzio insmod part_msdos insmod xfs set root='hd0,msdos10' if [ x$feature_platform_search_hint = xy ]; then search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos10 --hint-efi=hd0,msdos10 --hint-baremetal=ahci0,msdos10 --hint='hd0,msdos10' f15778cb-939a-4179-beeb-62e5c3dc07db else search --no-floppy --fs-uuid --set=root f15778cb-939a-4179-beeb-62e5c3dc07db fi linux16 /vmlinuz-0-rescue-98a0f723fa374bccae65d892478a1677 root=/dev/mapper/centos-root ro rd.lvm.lv=centos/root rd.lvm.lv=centos/swap crashkernel=auto rhgb quiet initrd16 /initramfs-0-rescue-98a0f723fa374bccae65d892478a1677.img}if [ "x$default" = 'CentOS Linux (3.10.0-327.10.1.el7.x86_64) 7 (Core)' ]; then default='Advanced options for CentOS Linux 7 (Core)>CentOS Linux (3.10.0-327.10.1.el7.x86_64) 7 (Core)'; fi;### END /etc/grub.d/10_linux ###### BEGIN /etc/grub.d/20_linux_xen ###### END /etc/grub.d/20_linux_xen ###### BEGIN /etc/grub.d/20_ppc_terminfo ###### END /etc/grub.d/20_ppc_terminfo ###### BEGIN /etc/grub.d/30_os-prober ###### 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 ###### BEGIN /etc/grub.d/41_custom ###if [ -f ${config_directory}/custom.cfg ]; then source ${config_directory}/custom.cfgelif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then source $prefix/custom.cfg;fi### END /etc/grub.d/41_custom ###done
仔细查看一下,并没有win 7的引导出现,我突然想到了,centos默认无法识别ntfs格式的磁盘,于是,就想着能不能将C盘挂载后不就可以找到了吗?也许吧。
网上查了一下,可以使用ntfs-3g来在centos下面挂载ntfs格式的磁盘,于是,就去百度ntfs的下在链接,注意,戳这里:ntfs-3g下载,然后:
[zhoupan@localhost:~]$ tar -zvx -f ntfs-3g-1.328.tgz -C .ntfs-3g-1.328/ntfs-3g-1.328/AUTHORSntfs-3g-1.328/CREDITSntfs-3g-1.328/Makefile.amntfs-3g-1.328/NEWSntfs-3g-1.328/READMEntfs-3g-1.328/autogen.sh.....信息较多,下面省略[zhoupan@localhost:~]$ cd ntfs-3g-1.328/[zhoupan@localhost:~/ntfs-3g-1.328]$ lsaclocal.m4 autogen.sh compile config.h.in configure COPYING depcomp INSTALL libntfs-3g Makefile.am missing READMEAUTHORS ChangeLog config.guess config.sub configure.ac CREDITS include install-sh ltmain.sh Makefile.in NEWS src
我去,原来是源码,许多人到这里估计就崩溃了,这要咋办呢?自己编译吧!
[zhoupan@localhost:~/ntfs-3g-1.328]$ ./configure prefix=PATH
PATH指的是你要安装的目录,默认安装在/usr/local/ 下面,可以随便改,输出的信息较多,这里就不贴代码啦,过程中可能出现错误,根据信息自己手动解决吧!
如果过程中没有出现错误信息,那就可以看见在当前目录下,有个Makefile文件,了解过make的同仁应该都知道,自己离成功只差两条命令的距离了!
[zhoupan@localhost:~/ntfs-3g-1.328]$ make
执行完这句命令之后,你将会拥有无比的成就感,因为输出的信息整个刷屏了,趁这个机会将周围的人叫来装一下B吧,立即,因为持续时间并不会很长。
[zhoupan@localhost:~/ntfs-3g-1.328]$ make install
然后,此输出的信息又刷屏了,心里暗喜,又可以装一波B了。顺利不出错误的话,你就已经将ntfs-3g安装到你的centos里面了,一切发生的就是那么快。
[zhoupan@localhost:~/ntfs-3g-1.328]$ ntfs-3g ntfs-3g: No device is specified.ntfs-3g 2014.2.15 integrated FUSE 27 - Third Generation NTFS Driver Configuration type 1, XATTRS are on, POSIX ACLS are offCopyright (C) 2005-2007 Yura PakhuchiyCopyright (C) 2006-2009 Szabolcs SzakacsitsCopyright (C) 2007-2012 Jean-Pierre AndreCopyright (C) 2009 Erik LarssonUsage: ntfs-3g [-o option[,...]] <device|image_file> <mount_point>Options: ro (read-only mount), windows_names, uid=, gid=, umask=, fmask=, dmask=, streams_interface=. Please see the details in the manual (type: man ntfs-3g).Example: ntfs-3g /dev/sda1 /mnt/windowsNews, support and information: http://tuxera.com
出现这些信息,就表明,你已成功将ntfs-3g安装成功了,下面进行挂载C盘操作:
[root@localhost:/home/zhoupan/ntfs-3g-1.328]$ fdisk /dev/sda The device presents a logical sector size that is smaller thanthe physical sector size. Aligning to a physical sector (or optimalI/O) size boundary is recommended, or performance may be impacted.Welcome to fdisk (util-linux 2.23.2).Changes will remain in memory only, until you decide to write them.Be careful before using the write command.Command (m for help): pDisk /dev/sda: 1000.2 GB, 1000204886016 bytes, 1953525168 sectorsUnits = sectors of 1 * 512 = 512 bytesSector size (logical/physical): 512 bytes / 4096 bytesI/O size (minimum/optimal): 4096 bytes / 4096 bytesDisk label type: dosDisk identifier: 0x6f292550 Device Boot Start End Blocks Id System/dev/sda1 * 63 167782859 83891398+ 7 HPFS/NTFS/exFATPartition 1 does not start on physical sector boundary./dev/sda2 167782921 1953520064 892868572 f W95 Ext'd (LBA)Partition 2 does not start on physical sector boundary./dev/sda3 1953521664 1953523711 1024 83 Linux/dev/sda5 167782923 251690354 41953716 7 HPFS/NTFS/exFATPartition 5 does not start on physical sector boundary./dev/sda6 587270207 1187074047 299901920+ 7 HPFS/NTFS/exFATPartition 6 does not start on physical sector boundary./dev/sda7 1187075043 1953520064 383222511 7 HPFS/NTFS/exFATPartition 7 does not start on physical sector boundary./dev/sda8 447940608 579256319 65657856 83 Linux/dev/sda9 407941120 447938559 19998720 83 Linux/dev/sda10 251693056 252667903 487424 83 Linux/dev/sda11 252669952 407937023 77633536 8e Linux LVMPartition table entries are not in disk orderCommand (m for help): q[root@localhost:/home/zhoupan/ntfs-3g-1.328]$
可以看到,我的磁盘全部信息都出现了,记着,fdisk只能是root适用哟,我的C盘是磁盘的第一个分区,大部分人的都是,所以,需要挂载的就是/dev/sda1,你的电脑就按实际情况推测吧,好了,下面就来挂载:
[root@localhost:/home/zhoupan/ntfs-3g-1.328]$ mkdir /media/sda1[root@localhost:/home/zhoupan/ntfs-3g-1.328]$ mount -t ntfs-3g /dev/sda1 /media/sda1/[root@localhost:/home/zhoupan/ntfs-3g-1.328]$
没有消息就是最好的消息,表明你的C盘已经挂载成功了,下面继续:
[root@localhost:/home/zhoupan/ntfs-3g-1.328]$ grub2-mkconfig > /boot/grub2/grub.cfg Generating grub configuration file ...Found linux image: /boot/vmlinuz-3.10.0-327.10.1.el7.x86_64Found initrd image: /boot/initramfs-3.10.0-327.10.1.el7.x86_64.imgFound linux image: /boot/vmlinuz-3.10.0-327.3.1.el7.x86_64Found initrd image: /boot/initramfs-3.10.0-327.3.1.el7.x86_64.imgFound linux image: /boot/vmlinuz-3.10.0-229.20.1.el7.x86_64Found initrd image: /boot/initramfs-3.10.0-229.20.1.el7.x86_64.imgFound linux image: /boot/vmlinuz-3.10.0-229.el7.x86_64Found linux image: /boot/vmlinuz-0-rescue-98a0f723fa374bccae65d892478a1677Found initrd image: /boot/initramfs-0-rescue-98a0f723fa374bccae65d892478a1677.imgFound Windows 7 (loader) on /dev/sda1done[root@localhost:/home/zhoupan/ntfs-3g-1.328]$
yes,win 7的引导已经找到了,免得你去纠结的自己动手去写了,还有就是部分人的配置文件在/boot/grub/下面,自己就去查看grub.cfg文件的路径吧,OK,谢谢。
- 关于Centos使用grub无法引导Windows的解决办法
- CentOS GRUB引导错误无法进入系统解决办法
- CentOS GRUB引导错误无法进入系统解决办法
- 使用 GRUB 引导 Windows
- ubuntu9.10--grub--引导windows的解决办法(双系统的引导)
- centos ubuntu 双系统引导的grub设置
- Linux 引导 windows 后 删除 Linux 分区,出现 Grub解决办法
- 重装windows后无法进入linux系统,修复grub引导
- Grub引导Linux + Windows
- grub引导Windows启动
- 开机出现grub rescue无法进入系统 恢复ubuntu系统下grub引导 windows xp和ubuntu9.10双系统引导程序的修复
- CentOS修改grub启动引导
- CentOS修改grub启动引导
- 【原】安装wingrub后,用grub引导安装RedHat失败,无法进入windows!!!&&又一次无法进入windows,在grub rescue模式寻找grub文件,重新引导进入ubuntu
- 使用GRUB引导FreeBSD
- Ubuntu Grub Rescue 解决Windows分区导致Ubuntu 12.10无法启动的问题以及设定双系统的优先引导顺序
- 如何在重装Windows后,使用Grub引导linux
- 出现GRUB界面无法引导系统的问题
- 【杭电oj】1896 - Stones(优先队列)
- Gray Code
- 求奇数的乘积
- 206. Reverse Linked List
- [刷题] Merge k Sorted Arrays
- 关于Centos使用grub无法引导Windows的解决办法
- 圆角之战-如何提高性能
- 彻底搞定C语言指针详解-完整版-时候初学者-必备
- sine之舞
- 102. Binary Tree Level Order Traversal
- simhash算法原理及实现
- hdu 1007 Quoit Design
- html5游戏开发1 骰子游戏
- 适配器模式(二)-----简单的实现一个适配器模式