支持 efi 的主板 双系统安装 ubuntu - 学习 EFI 和 gpt

这次 在有两块硬盘的 机器上 双系统安装 ubuntu, 遇到了一些 以前没有的情况

了解到 两个以前没听过的名词

EFI  vs  BIOS

gpt  vs  mbr   两种分区表

参考链接 二里 还提到了  快速启动  安全启动过

详细介绍了 MBR+ BIOS 启动  以及 GPTF分区的格式

http://www.iruanmi.com/what-is-gpt-and-what-is-uefi/

http://tieba.baidu.com/p/3754146793

这篇文章介绍了 uefi 的启动方法 和启动顺序调整

http://blog.sina.com.cn/s/blog_53918a450102uzi6.html

UEFI的两种启动模式

https://help.ubuntu.com/community/Installation/FromUSBStick

UEFI 模式安装 ubuntu 的流程  官方 文档

https://help.ubuntu.com/community/UEFI

Installing Ubuntu in UEFI mode

The following sections describe how to install Ubuntu in UEFI mode, either because you‘re single-booting and want to try this boot mode or because you‘re dual-booting with another OS that‘s already installed in this mode.

Case when Ubuntu must be installed in UEFI mode

Having a PC with UEFI firmware does not mean that you need to install Ubuntu in UEFI mode. What is important is below:

  • if the other systems (Windows Vista/7/8, GNU/Linux...) of your computer are installed in UEFI mode, then you must install Ubuntu in UEFI mode too.
  • if the other systems (Windows, GNU/Linux...) of your computer are installed in Legacy (not-UEFI) mode, then you must install Ubuntu in Legacy mode too. Eg if your computer is old (<2010), is 32bits, or was
    sold with a pre-installed Windows XP.
  • if Ubuntu is the only operating system on your computer, then it does not matter whether you install Ubuntu in UEFI mode or not.

我的机器上之前的windows 应该是 legacy mode 的,但是自动安装的 ubuntu却是 UEFI的

情况应该是  像这样

https://help.ubuntu.com/community/Installation/FromUSBStick#Ubuntu_single_boot_in_UEFI_mode

Ubuntu single boot in UEFI mode

Single boot Ubuntu systems are still often installed in BIOS/CSM mode. Normally you install in UEFI mode because Windows is installed
in UEFI mode and you want to dual boot. But it is possible to install Ubuntu (and the flavours Kubuntu Lubuntu, Xubuntu) as a single boot system in UEFI mode too, which can
be useful for two purposes

  • to keep the systems separated,
    Ubuntu in one drive and Windows in another drive (so it will actually be a dual boot system, but not during the installation).
    Probably stable when installed in an internal drive.
     ----》  比较符合我的安装情况
  • to make a portable installed Ubuntu USB pendrive for UEFI mode (portable alias works
    in many computers). Not stable when installed in an external drive (USB stick).

所以系统安装时 相当于是 single mode 的方式,但为什么 没有给我默认安装成 legacy 方式呢。看来是 这个 live disk 系统启动的时候就是 通过 uefi 的方式启动的

https://help.ubuntu.com/community/Installation/FromUSBStick#Test_if_running_in_UEFI_mode

https://help.ubuntu.com/community/UEFI#Identifying_if_the_computer_boots_the_Ubuntu_DVD_in_UEFI_mode  ----》》》 我的 usb 的系统根据这个判断,是 通过 efi模式启动的

General principles

To install Ubuntu in UEFI mode:

  • Use a 64bit disk of Ubuntu. (Ubuntu32bit
    cannot be easily installed in UEFI mode
    . This is a problem if 32-bit UEFI is the only way your computer can boot, e.g. if you have a modern Intel Atom based laptop. In this case, you will need a
    complicated work-around
    .)
  • In your firmware, disable
    QuickBoot/FastBoot
     and Intel
    Smart Response Technology
     (SRT). If you have Windows 8, also disable
    Fast Startup
    .
  • You might want to use an EFI-only
    image
     to avoid troubles with mistakenly booting the image and installing Ubuntu in BIOS mode.
  • Use a supported version of Ubuntu. Support for UEFI appeared in 11.10, but has become more reliable in next versions. Support for UEFISecureBoot appeared
    in 12.10 and 12.04.2.
  • Set up your firmware (BIOS) to boot the disk in UEFI mode (see the "Identifying
    if the computer boots the HDD in UEFI mode
    " paragraph below)
  • Then:
    • nothing special is required if you use the automatic installer of Ubuntu ("Install Ubuntu alongside others" or "Erase the disk and install Ubuntu"). Important: if you have a pre-installed Windows and you want to keep it, do
      not choose "Erase the disk and install Ubuntu". ---》 我选的是 erase,不过是另外一块盘
    • if you use the manual partitioning ("Something else"), the difference is that you will have to set the /boot/efi mount point to the UEFI partition.
      And if there was not any UEFI partition on your HDD, you first will have to create it (see the "Creating
      an UEFI partition
      " paragraph below).

Set up the firmware in UEFI or BIOS/CSM/Legacy mode

Some recent computers (>2011) allow you to set up the computer to boot either in UEFI mode or in BIOS/CSM/Legacy (not-EFI) mode. The way to adjust this setting depends on the computers, but generally this setting is located in the "Boot order" tab of the BIOS
(to access the BIOS screens, it is generally necessary to press a key during the PC startup). It can also often be set on a per-boot basis by hitting a function key (F8 and F10 are common choices) soon after you power on the computer.

Note: Some UEFIs (e.g. American Megatrends‘ "Aptio", found on the Asus vivobook series) call Legacy mode "Compatibility Support Module" or simply "CSM".

Remark: Some UEFIs enable one to set up the boot mode for the optical drive separately from the boot mode for the HDD.

For example, below:

  • the "UEFI Hitachi" line allows to boot the HDD in UEFI mode,
  • the "P1: Hitachi" line allows to boot the HDD in Legacy (not-UEFI) mode,
  • the "P3: DVD" line allows to boot the Ubuntu CD in Legacy mode
  • the "UEFI: USB" line allows to boot the Ubuntu liveUSB in UEFI mode.

Here is a 2nd example of UEFI boot mode setting, where the "Boot Mode" parameter enables one to choose the boot mode ("UEFI" or "Legacy") for all media (hard disk, CD, USB...) at the same time.

Some other UEFIs propose an "UEFI/Legacy Boot:" option with the following choices: [Legacy only], [UEFI only] and [Both]. This last one boots in UEFI mode when possible, then in Legacy mode if no UEFI files are detected.

!!!!!!!!

Note that in a UEFI-mode installation, Ubuntu
will not ask
you where to install the boot loader
. If it does, or if it complains about
the lack of a BIOS
Boot Partition,
 you‘ve probably accidentally booted in BIOS/CSM/legacy mode.

关于 ubuntu 的分区模式

NONE-GPT & GPT 分区

https://help.ubuntu.com/community/DiskSpace

Required partitions

Overview

The easiest partitioning scheme, on a non-GPT disk, is simply a root partition and a swap partition.


Name


Size


swap


size of RAM


/


the rest of the disk

If the disk is GPT type (this can be checked via the "sudo parted -l" command), you must also add a BIOS-Boot or an EFI
partition depending on the boot mode of your BIOS.


Name


Size


BIOS-boot or EFI


see below


swap


size of RAM


/


the rest of the disk

On some computers, a separate /boot partition may also be required.

See paragraphs below.

Root partition (always required)

  • Mount point: /
  • Type: Linux type (generally EXT4)
  • Description: the root partition contains by default all your system files, program settings and documents.
  • Size: minimum is 8 GB. It is recommended to make it at least 15 GB. Warning: your system will be blocked if the root partition is full.

Swap (very recommended)

  • Mount point: none
  • Type: SWAP
  • Description: see SwapFaq.
  • Size: size of your RAM.

BIOS-Boot or EFI partition (required on GPT disks)

If you want to install Ubuntu on a GPT disk (you can check it via the ‘sudo parted -l‘ command), you will need either an
EFI partition (if your BIOS is set up in EFI mode) or a BIOS-Boot partition (if your BIOS is set up in Legacy mode).

BIOS-Boot partition:

  • Mount point: none
  • Type: no filesystem
  • Description: the BIOS-boot partition contains GRUB 2‘s core. It is necessary if you install Ubuntu on a GPT disk, and
    if the firmware (BIOS) is set up in Legacy (not EFI) mode.
    It must be located at the start of a GPT disk, and have a "bios_grub" flag.
  • Size: 1MB.

EFI partition:

  • Mount point: /boot/efi (no need to set up this mount point as the installer will do it automatically)
  • Type: FAT (generally FAT32)
  • Description: the EFI partition (also called ESP) contains some boot files.
    It is necessary if the firmware (BIOS) is set up to boot the HDD in EFI mode
    (which is default on more and more modern, > year 2011 computers).
    It must be located at the start of a GPT disk, and have a "boot" flag.
  • Size: 100~250MB

https://wiki.archlinux.org/index.php/Unified_Extensible_Firmware_Interface

https://en.wikipedia.org/wiki/Unified_Extensible_Firmware_Interface#UEFI_booting

https://en.wikipedia.org/wiki/EFI_system_partition

The EFI System partition needs to be formatted with a file system whose specification is maintained as part of
the UEFI specification; the file system itself is based on the FAT file
system but is independent from the original FAT specification.[1] The globally
unique identifier
 (GUID) for the EFI System partition in the GUID
Partition Table
 (GPT) scheme is C12A7328-F81F-11D2-BA4B-00A0C93EC93B,
while its ID in the MBR
partition table
 scheme is 0xEF.Both
GPT- and MBR-partitioned disks can contain an EFI System partition, as UEFI firmware is required to support both partitioning schemes.
Also, El
Torito
 bootable format for CD-ROMs and DVDs is
supported.[3]

UEFI provides backward compatibility with legacy systems by
reserving the first block (sector) of the partition for compatibility code, effectively creating a legacy boot
sector
. On legacy BIOS-based systems, the first sector of a partition is loaded into memory
and execution is transferred to this code. UEFI firmware does not execute the code in the Master
Boot Record
 (MBR), except when booting in legacy BIOS mode through the Compatibility
Support Module
 (CSM).[3]

The UEFI specification requires MBR partition tables to be fully supported.[3] However,
some UEFI implementations immediately switch to the BIOS-based CSM booting upon detecting certain types of partition table on the boot disk, effectively preventing UEFI booting to be performed from EFI System partitions contained on MBR-partitioned disks.[4]

UEFI firmware supports booting from removable storage devices such as USB flash
drives
. For that purpose, a removable device needs to be formatted with a FAT12FAT16 or FAT32 file
system, while a boot loader needs to be stored according to the standard ESP file hierarchy, or by providing a complete path of a boot loader to the system‘s boot manager.[3]

https://wiki.archlinux.org/index.php/Boot_loaders

Both BIOS and UEFI boot loaders

GRUB

GRUB is more feature-rich and supports more complex scenarios.
Its configuration file(s) is more similar to ‘sh‘ scripting language, and can be automatically generated.

Syslinux

Syslinux is (currently) limited to loading only
files from the partition where it was installed. An example configuration can be found in Syslinux#Examples.

UEFI-only boot loaders

Linux Kernel EFISTUB

The Linux kernel can be booted directly using the built-in EFI stub loader. See EFISTUB.

systemd-boot

systemd includes an EFI bootloader which provides a text menu for booting EFISTUB kernels. See systemd-boot.

rEFInd

rEFInd is a UEFI Boot Manager which provides a graphical menu for booting EFISTUB kernels. See rEFInd.

Clover

Clover is a UEFI Boot Manager which provides native resolution GUI for booting EFISTUB kernels. See Clover.

ELILO

Warning: ELILO upstream has clarified that it is no longer in active development, meaning no new features will be added and only bug-fixes are released. Seehttps://sourceforge.net/mailarchive/message.php?msg_id=31524008 for
more information. ELILO is not officially supported by Arch developers.

ELILO is the UEFI version of the BIOS-only LILO. Its config
file elilo.conf is similar to LILO‘s
config file. Upstream provided compiled binaries are available athttp://sourceforge.net/projects/elilo/ and
an AUR package at elilo-efiAUR.

BIOS-only boot loaders

Warning: None of the options presented here are officialy supported in Arch Linux.

GRUB Legacy

GRUB Legacy (also known as grub-0.97), is the legacy, BIOS-only branch of GRUB.
See GRUB Legacy.

LILO

See LILO.

https://wiki.archlinux.org/index.php/GUID_Partition_Table#Bootloader_Support

Bootloader Support

UEFI systems

All UEFI Bootloaders support GPT disks since GPT is a part of UEFI Specification and thus mandatory for UEFI boot. See Boot
loaders
 for more information.

BIOS systems

While GPT support on BIOS systems is theoretically possible it sometimes isn‘t practical and other times there are complete incompatibilities. Technically the BIOS is only supposed to execute the code on the MBR, therefore leaving the possibility of differing
partitioning schemes... However a BIOS may do additional checks including: checking a MBR‘s integrity, and possibly even for a MBR partition table (though usually only the first partition). If this is a case, a number of workarounds exist that may be able
to repair the problem (listed below).

Warning: For Windows, there is no support for booting from a BIOS/GPT partitioning scheme. If you have already installed Windows with a BIOS/MBR partitioning scheme do not convert the drive to GPT! Windows
will fail to boot if this is done - irrespective of the bootloader used to chainload Windows. One can either install Windows in UEFI mode and use an UEFI
bootloader
 (which uses GPT), or possibly restore/install Windows on a BIOS/GPT hybrid MBR (see partitioning examples).

Bootloaders that support GPT/BIOS partitioning scheme bootloading:

Not suported: GRUB Legacy and LILO.

Workarounds

A few workarounds may help boot a BIOS/GPT partitioning scheme; however, before trying these, try booting a BIOS/GPT partitioning scheme with the bootloaders standard procedure. If it doesn‘t work, these may help boot them (read
this
 for full reference):

  • Set the boot flag on the protective MBR partition (type 0xEE) . This can be done with parted /dev/sdX and disk_toggle
    pmbr_boot
     or using sgdisk /dev/sdX --attributes=1:set:2.
  • Be sure there is no EFI system partition
  • Create a hybrid MBR. This will be needed for a BIOS that looks for a valid MBR partition (see example below).
  • Recompute CHS (Cylinder/Head/Sector) values in the protective MBR. GPT does not use these values but the protective MBR may need to be calibrated to them to work for those BIOS that test them.
  • A second disk that has a valid MBR table may signify to the BIOS that it is alright to execute the code on the protective MBR.
  • Many computers since 2011 may have support for an EFI booting if wanting from a BIOS option.

我的安装情况

第一块硬盘安装了 windows

第二块盘 准备用来装 linux

创建了 可启动的 ubuntu  usb livecd    用的镜像是ubuntu-14.04.4-desktop-amd64.iso

开机

以前 如果需要从 usb 引导 来安装系统,需要进入bios修改 系统启动介质的顺序,但是这次很奇怪。插上u盘重启后 直接 进入 u盘的  系统里面了

如果选 ERASE+ LVM  然后硬盘 选择 sdb - > install now,  进入界面

--

如果 installation type 不选择 lvm 的话

都会默认生成一个  EFIBOOT 盘

-----------------------------

如果

installation type  选something else  则会进入 分区详情

按照以前装双系统的经验是,会在  sdb 创建 root分区  /   ext4  以及  swap 分区

然后 boot loader device,  如果  选 sda, 那么 就会把 grub 装到 磁盘一, 然后启动时,可以从启动菜单选择 进入linux(默认)或者windows

如果boot loader device 选 sdb 的话, 那么默认 linux 就启动不了, 需要在 bios 把 磁盘二 的启动顺序调到 前面 ,才可以 启动linux,启动菜单里也没有windows。此时  windows 和 linux 的启动 是完全独立的

=====

但是 因为这个机器的主板好像是 支持 efi 的,我选择 了 默认的 非 lvm 安装方式后,系统就开始 自己安装,

按照自动安装模式下上图系统提示的 sdb 分区信息可以看出,自动都建立了一个 EFIboot 分区,这个就是 EFI 模式下bootloader 安装的地方???所以上文

https://help.ubuntu.com/community/UEFI#Performing_the_Installation  里面说,在 EFI模式安装 是 不会问在哪里装bootloader 的,因为只能安装在 EFI 分区里?

安装完成后,我就重启机器,很奇怪,开机画面之后 系统马上就进入 ubuntu 了,试图用 fdisk 查看分区表, 结过 sdb 的分区 看不了?  说是用了 gpt分区,只能用 parted 工具 来 查看,这才知道 这次的分区 格式 竟然也和以前不一样了。

--- 那么怎么进入 windows呢?

我现在使用的办法是, 一闪而过的 开机节目 里 最下排 有提示

DEL  bios setup

f9 system  information

f12  boot menu

我按住 f12  然后会出现硬盘的列表,选择装了windows 的 盘一 ,就会顺利进入 windows

问题是 :

为什么 默认 会  进入 ubuntu 而不是 windows 呢, 这跟 efi 又有什么关系呢

好像 这个 efi 也可以配置成  enabled  或者 是  使用 legacy ?

下面就开始 到处搜索  关于 EFI  还有 GPT 的相关知识

===============

似乎 windows 8 以后 的windows 才会  出现 用 efi 引导的方式 来安装 ?

http://blog.163.com/[email protected]/blog/static/3571595020146192136557/

这个 是  单硬盘 win 7  安装 双系统 ubuntu

但是需要 将  uefi 设置成 legacy only, 那样的话 就变成  跟传统 用 MBR 分区表建立分区 然后通过 bios 启动的 过程是一样的了

否则 安装的时候  ubuntu 就识别不出  windows下已经 通过 mbr 建立的分区 ???  奇怪 我安装的时候倒是可以 看到 windows 的分区的。

不过没有尝试  如果  不建立 EFIBOOT 分区 的话 能不能安成功

参考

http://os.51cto.com/art/201405/439158.htm

给了一个 详细的例子 不过是 一块硬盘  而且是 windows 8  + ubuntu 14

安装完后 还需要 在 ubuntu 和 windows 都进行 启动修复  才可以出现 多选项的启动菜单 否则直接进入 windows

时间: 2024-10-19 01:40:12

支持 efi 的主板 双系统安装 ubuntu - 学习 EFI 和 gpt的相关文章

双系统安装Ubuntu

双系统安装Ubuntu 准备磁盘空间 情况: 本人win10系统,128G固态+1TB机械硬盘,并且只有两个盘. win + x选择磁盘管理,在机械硬盘那个盘,我的是D盘,选择压缩盘,然后在输入压缩空间量(MB) 输入自己想要分配的空间, 我这里分配了300G, 也就是300*1024=307200MB,点压缩, 会出现如下图所示 制作U盘启动盘 需要一个USB,由于制作启动盘会格式化,所以请先备份U盘数据 ubuntu下载地址: https://ubuntu.com/download 直接用U

win7 64 + Ubuntu 14.04.1 64双系统安装,详解UEFI ~ GPT和legacy ~ MBR区别

win7 64 + Ubuntu 14.04.1 64双系统安装 背景:我的笔记本之前的系统是window 7 64 + Ubuntu 14.04.1,用UEFI引导系统.安装过程是先装的win7,再装Ubuntu.本来挺和谐的搭配,但是因为装Win7 的时候格式化硬盘为GPT(Globally Unique Identifier Partition Table)分区表格式(在PE系统里用Diskgenius格的),并且勾选了MSR分区(Microsoft Reserve,微软保留),所以最后装

win7双系统安装ubuntu并配置常用软件

首先在win7下磁盘清理出来空间具体方法找度娘就行了. 下面开始准备安装: 1.下载easyBCD 2.打开:添加新条目--NeoGub--安装 3.点击配置  修改menu.lst title Install Ubuntu root (hd0,0) kernel (hd0,0)/vmlinuz.efi boot=casper iso-scan/filename=/ubuntukylin-14.04.2-desktop-i386.iso locale=zh_CN.UTF-8 initrd (hd

[转]win7+ubuntu 13.04双系统安装方法

win7+ubuntu 13.04双系统安装方法 http://jingyan.baidu.com/article/60ccbceb18624464cab197ea.html 当需要频繁使用ubuntu时,vmware虚拟机下运行ubuntu,就不是个好的选择了.为了让以后更好的学习linux,笔者今天下午琢磨了整整一下午,终于成功的在win7下安装了ubuntu13.04. 虽然网上已经有一些相关文章了,笔者也参考了很多,但很多文章对于第一次进行这些操作的人来说,一段话需要理解半天才能下手.

U盘双系统安装 WIN7 和 ubuntu

<---------------->U盘双系统安装 WIN7 和 ubuntu:1.大致思路: 先安装WIN7 并且把 ubuntu 的空间给 留出来. 然后在WIN 7 下 u盘安装 ubuntu 2.参考资料:1) ubuntu12.04LTS版本操作系统: http://releases.ubuntu.com/12.04/           ubuntu-12.04.5-desktop-i386.iso  (是32位的) 2)win7 和 ubuntu  双系统 U盘安装过程参考(非常

解决window10 和 ubuntu 双系统安装没有启动选项问题

win10 和Ubuntu 双系统安装在网上已经有很多例子了,这里就不在赘述了. 今天新买的笔记本,想安装双系统.正常安装完ubuntu 重启后没有选项. 解决方法一 下载和解压以后,按照以下的步骤安装rEFInd. 返回桌面 右击开始按钮,选择管理员命令行 输入 mountvol g: /s (这将你的EFI目录结构映射到G盘) 进入解压的rEFInd目录.例如: cd c:\users\gary\downloads\refind-bin-0.8.4\refind-bin-0.8.4 . 当你

win8和ubuntu双系统安装

做了一个windows和Ubuntu双系统,参考了一些文章.网上资料不少,我就不重复了. 参考的部分文章如下: Ubuntu 14.04 和 Windows 8.1 双系统安装步骤:http://os.51cto.com/art/201405/439158.htm UEFI模式安装win8和ubuntu双系统:http://www.enjoydiy.com/1961.html 关于Windows8 UEFI安全启动协议解读的完整版:http://article.pchome.net/conten

Ubuntu学习笔记-win7&Ubuntu双系统简单搭建系统指南

win7&Ubuntu双系统简单搭建系统指南 本文是自己老本子折腾Ubuntu的一些记录,主要是搭建了一个能够足够娱乐(不玩游戏)专注练习自己编程能力的内容.只是简单的写了关于系统的安装和一些配置环境的简单搭建.并没有深入探讨系统地各项内容.希望可以给香简单使用的同学参考. 一.准备工作 打开UltraISO ,依次点击"文件"--"打开"--选择Ubuntu14.04系统镜像文件,确认打开后就能在软件界面内看到整个镜像的全部文件信息. 接下来开始制作系统安

part1:Python 语言特点和安装,Ubuntu 19.04 Server系统安装,Windows 7 + RHEL7双系统安装

Python是一门优秀的编程语言,特点是简洁.易用,功能强大.可用于开发桌面.网络编程.开发Web应用等.还可用于大数据和人工智能领域. 一. Python简介 1.1. Python的历史1989年,Guido van Rossum 开发出Python语言,Python语言基于ABC语言,ABC语言很强大,是为非专业程序员设计的.ABC语言没有得到广泛应用,因为它不是开放的. Python上手简单,非常像自然语言.非软件专业人员,选择Python成本低,因此在各个领域的从业人员,都有在用Pyt