使我的 GRUB 不依赖于我的外部磁盘

使我的 GRUB 不依赖于我的外部磁盘

我买了一个外置驱动器,将 Ubuntu 放入其中。我将在多台计算机上使用它来工作。

问题是,当我安装它时,它用另一个 grub 替换了我最初的 grub,结果是如果弹出外部磁盘,grub 将无法启动。

这是我的所有积木:

lsblk                                                                                                                                                                          Thu 20 Sep 2018 02:37:30 PM CEST
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 489.1G  0 disk 
├─sda1   8:1    0    16M  0 part 
├─sda2   8:2    0 488.2G  0 part 
└─sda3   8:3    0   843M  0 part 
sdb      8:16   0 931.5G  0 disk 
├─sdb1   8:17   0   450M  0 part 
├─sdb2   8:18   0    99M  0 part /boot/efi
├─sdb3   8:19   0    16M  0 part 
├─sdb4   8:20   0 686.8G  0 part 
├─sdb5   8:21   0 236.3G  0 part /
└─sdb6   8:22   0   7.9G  0 part [SWAP]
sdc      8:32   0 223.6G  0 disk 
├─sdc1   8:33   0  23.3G  0 part 
├─sdc2   8:34   0   7.9G  0 part 
└─sdc3   8:35   0 192.3G  0 part 
sr0     11:0    1  1024M  0 rom 

我的分区列表:

Disk /dev/ram0: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram1: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram2: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram3: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram4: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram5: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram6: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram7: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram8: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram9: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram10: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram11: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram12: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram13: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram14: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/ram15: 64 MiB, 67108864 bytes, 131072 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/sda: 489.1 GiB, 525112713216 bytes, 1025610768 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
Disklabel type: gpt
Disk identifier: D4080E08-6C49-4D5D-AFAC-8E0ED13DE19C

Device          Start        End    Sectors   Size Type
/dev/sda1        2048      34815      32768    16M Microsoft reserved
/dev/sda2       34816 1023879907 1023845092 488.2G Microsoft basic data
/dev/sda3  1023881216 1025607679    1726464   843M Windows recovery environment




Disk /dev/sdb: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 1EE8F2AF-A6B3-477E-B1C8-79858BA104CD

Device          Start        End    Sectors   Size Type
/dev/sdb1        2048     923647     921600   450M Windows recovery environment
/dev/sdb2      923648    1126399     202752    99M EFI System
/dev/sdb3     1126400    1159167      32768    16M Microsoft reserved
/dev/sdb4     1159168 1441523711 1440364544 686.8G Microsoft basic data
/dev/sdb5  1441523712 1937000447  495476736 236.3G Linux filesystem
/dev/sdb6  1937000448 1953523711   16523264   7.9G Linux swap


Disk /dev/sdc: 223.6 GiB, 240057409536 bytes, 468862128 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
Disklabel type: gpt
Disk identifier: 02086807-3D19-4BE7-BEFE-13021ABC9846

Device        Start       End   Sectors   Size Type
/dev/sdc1      2048  48939547  48937500  23.3G Linux filesystem
/dev/sdc2  48941056  65540095  16599040   7.9G Linux swap
/dev/sdc3  65540096 468860927 403320832 192.3G Linux filesystem

问题是,你知道我需要做什么才能恢复我的初始 grub,而无需外部磁盘吗?如果我插入磁盘,该磁盘上的 Ubuntu 是否会添加到 grub 列表中?如果不可能,是否可以在该驱动器上安装一个 grup,所以我只需要切换启动时启动的磁盘?

答案1

在 Ubuntu 安装过程中,有一个步骤会询问您要将 Grub 安装在哪里。在此步骤中,您必须指示程序将安装在哪个驱动器上。

要想做你想做的事,你必须:

  • 配置 BIOS 启动顺序,先放 USB 驱动器,然后再放内置 HDD。
  • 在内置硬盘上安装 Grub在您的外部驱动器中。您无法在 Grub 中动态添加或删除条目。

这样,每次你没有驱动器启动时,它都会在你的内置硬盘上获取 grub。但如果你插入外置驱动器,它应该会显示 grub。顺便说一句,如果你遇到 Grub 问题,请查看此工具。您可以使用它来恢复驱动器上的 Grub。

希望这有帮助,祝你好运。

相关内容