简体   繁体   English

Linux下如何判断BIOS将使用哪个磁盘启动?

[英]How to tell under Linux which disk will be used by BIOS to boot?

How to print from CMOS which device will be used as boot device after reboot?如何从 CMOS 打印重启后将用作引导设备的设备?

Computer has several sata disk drives and several bootable USB-devices attached.计算机有几个 sata 磁盘驱动器和几个可启动的 USB 设备。

The layout of CMOS memory is defined by version of BIOS used. CMOS 内存的布局由所使用的 BIOS 版本定义。 I know that there are several different versions and manufacturers of BIOSes.我知道 BIOS 有几个不同的版本和制造商。 I think it is possible to determine which one is used by examining BIOS memory.我认为可以通过检查 BIOS 内存来确定使用的是哪一个。 Somehow like in this question - How to check the BIOS version or name in Linux through a command prompt?有点像这个问题 - 如何通过命令提示符检查 Linux 中的 BIOS 版本或名称?

My computer gives我的电脑给

$ sudo dmidecode -t bios -q
BIOS Information
    Vendor: Award Software International, Inc.
    Version: F4
    ...
Characteristics:
    Boot from CD is supported
    Selectable boot is supported
    USB legacy is supported
    BIOS boot specification is supported
    ...

I don't have the possibility to reboot comuter and just look to the BIOS settings.我无法重新启动 comuter,只能查看 BIOS 设置。 This is why I need to know them without rebooting.这就是为什么我需要在不重新启动的情况下了解它们。

# dmidecode --type 32 --dump

Handle 0x0025, DMI type 32, 11 bytes
System Boot Information
Status: No errors detected
Header and Data:
    20 0B 25 00 00 00 00 00 00 00 00
Strings:
    20 00
    " "

Found some docs,找到了一些文档,
http://www.scs.stanford.edu/05au-cs240c/lab/specsbbs101.pdf http://www.scs.stanford.edu/05au-cs240c/lab/specsbbs101.pdf
http://www.dmtf.org/standards/smbios http://www.dmtf.org/standards/smbios
http://www.dmtf.org/sites/default/files/standards/documents/DSP0134_2.8.0.pdf http://www.dmtf.org/sites/default/files/standards/documents/DSP0134_2.8.0.pdf
but they are not enough for me.但它们对我来说还不够。

Ideally, I need some command line tool (or information on how to write it) which will help me to understood which device (/dev/sd?) will be booted.理想情况下,我需要一些命令行工具(或有关如何编写它的信息)来帮助我了解将启动哪个设备(/dev/sd?)。

There is similar question about windows, but also without definitive answer - How to tell which disk Windows Used to Boot有关于 Windows 的类似问题,但也没有明确的答案 - 如何判断 Windows 用于启动哪个磁盘

如果是 UEFI,则定义了保存引导顺序的变量和可以帮助您访问它们的工具“efibootmgr”: https ://linux.die.net/man/8/efibootmgr

If this is really a BIOS based system, rather than UEFI, then there is no universally available and reliable way to determine what disk will be booted from.如果这确实是基于 BIOS 的系统,而不是 UEFI,那么没有普遍可用且可靠的方法来确定将从哪个磁盘启动。 For many BIOS versions, the disk booted by default may even change seemingly randomly from one boot to the next as devices are enumerated in different orders.对于许多 BIOS 版本,由于设备以不同的顺序枚举,默认启动的磁盘甚至可能从一次启动到下一次启动看似随机地改变。

If you want to reliably boot GNU/Linux on a BIOS based machine, the standard solution is to make sure that grub's boot sector gets installed to the MBR of any drive which the BIOS might decide to boot from.如果你想在基于 BIOS 的机器上可靠地引导 GNU/Linux,标准的解决方案是确保 grub 的引导扇区被安装到 BIOS 可能决定从中引导的任何驱动器的 MBR。 If your distribution automatically re-installs grub when grub packages get updated (which it should, and most do) then you should make sure that your distribution is configured to re-install grub's boot sector to all drives as well.如果您的发行版在 grub 软件包更新时自动重新安装 grub(它应该并且大多数都这样做),那么您应该确保您的发行版配置为也将 grub 的引导扇区重新安装到所有驱动器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM