← 返回命令列表

Linux command

grub-install 命令

安全

权限或系统影响较大,执行前请核对目标。

常用示例

Example

sudo grub-install [/dev/device]

Example

sudo grub-install --target i386-pc [/dev/device]

Example

sudo grub-install --efi-directory [/path/to/efi]

Example

sudo grub-install --target x86_64-efi --efi-directory [/path/to/efi] --bootloader-id GRUB

Example

sudo grub-install --target x86_64-efi --efi-directory [/path/to/efi] --modules "part_gpt part_msdos"

Example

grub-install --help

说明

grub-install installs the GRUB bootloader to a disk device or EFI System Partition. The installation method differs between BIOS/legacy and UEFI systems. For BIOS systems, GRUB is installed to the Master Boot Record (MBR) or a BIOS Boot Partition on GPT disks. For UEFI systems, GRUB is installed to the EFI System Partition (ESP), and the --bootloader-id option sets the name shown in the UEFI boot menu. After installation, run grub-mkconfig to generate the configuration file.

参数

--target _PLATFORM_
Installation target: i386-pc (BIOS), x86_64-efi, i386-efi, arm-efi
--efi-directory _DIR_
EFI System Partition mount point
--bootloader-id _ID_
Boot manager identifier in EFI menu
--boot-directory _DIR_
Directory containing boot files (default: /boot)
--modules _MODULES_
Pre-load specified GRUB modules
--recheck
Delete device map and regenerate
--removable
Install to removable media path
--force
Install even if problems detected

FAQ

What is the grub-install command used for?

grub-install installs the GRUB bootloader to a disk device or EFI System Partition. The installation method differs between BIOS/legacy and UEFI systems. For BIOS systems, GRUB is installed to the Master Boot Record (MBR) or a BIOS Boot Partition on GPT disks. For UEFI systems, GRUB is installed to the EFI System Partition (ESP), and the --bootloader-id option sets the name shown in the UEFI boot menu. After installation, run grub-mkconfig to generate the configuration file.

How do I run a basic grub-install example?

Run `sudo grub-install [/dev/device]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --target _PLATFORM_ do in grub-install?

Installation target: i386-pc (BIOS), x86_64-efi, i386-efi, arm-efi