更多: zhilu jiaocheng

在CentOS7中设置Windows 引导项步骤

启动centos 7 系统

查看分区情况

# fdisk -l

Disk /dev/sda: 320.1 GB, 320072933376 bytes, 625142448 sectors
 Units = sectors of 1 * 512 = 512 bytes
 Sector size (logical/physical): 512 bytes / 512 bytes
 I/O size (minimum/optimal): 512 bytes / 512 bytes
 Disk label type: dos
 Disk identifier: 0xcd8b1219

    Device Boot      Start         End      Blocks   Id  System
 /dev/sda1   *        2048     4194303     2096128    7  HPFS/NTFS/exFAT
 /dev/sda2         4194304   360402758   178104227+   7  HPFS/NTFS/exFAT
 /dev/sda3       360402942   625141759   132369409    5  Extended
 /dev/sda5       612595712   625141759     6273024   82  Linux swap / Solaris
 /dev/sda6       360407040   361431039      512000   83  Linux
 /dev/sda7       361433088   612589567   125578240   8e  Linux LVM

转到grub目录,修改配置文件

cd  /etc/grub.d/
sudo nano 40_custom

修改为:

#!/bin/sh
 exec tail -n +3 
grub2-mkconfig --output=/boot/grub2/grub.cfg
# 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. menuentry "Windows 7" { set root=(hd0,1) chainloader +1 }

Centos7 重新编译 grub

GRUB_DEFAULT="Windows 7"

Centos7和windows双引导启动,设置windows为默认启动项

/etc/default/grub中修改双系统的默认引导项:

##代码##
配置 Grub 2 实现CentOS7 和 Windows 7双引导启动

假设我们先安装的是Windows ,然后安装CentOS 7后,发现无法启动Windows。

我们需要在CentOS7上 修改Grub 2 引导加载程序。

本文是在CentOS7上操作,如果你的是6或者之前的版本,grub的配置文件不同。需要编辑/boot/grub/grub.conf。

日期:2020-09-17 00:15:30 来源:oir作者:oir