小编shi*_* xu的帖子

如何更改 /boot/grub/grub.cfg 中的 UUID

我问如何更改uuid/boot/grub/grub.cfg以便 grub 可以加载指定分区上的操作系统。

我有两个磁盘:

  • SSD /dev/sda1 与 uuid d7f0cf11-3edf-4859-b65a-3b5bc60ea7b9
  • 硬盘 /dev/sdb1 的 uuid 为 47d9205b-00a8-40e5-88d6-e8b9571799a7

两个磁盘包含相同的内容(Ubuntu 根目录),但分区 uuid 不同,因为 的内容是从以下sda1克隆的sdb1clonezilla

问题是/boot/grub/grub.cfg自动生成的包含:

           if [ x$feature_platform_search_hint = xy ]; then
              search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos1 --hint-efi=hd1,msdos1 --hint-baremetal=ahci1,msdos1  47d9205b-00a8-40e5-88d6-e8b9571799a7
            else
              search --no-floppy --fs-uuid --set=root 47d9205b-00a8-40e5-88d6-e8b9571799a7
            fi
            echo    'Loading Linux 4.4.0-146-generic ...'
            linux   /boot/vmlinuz-4.4.0-146-generic root=UUID=47d9205b-00a8-40e5-88d6-e8b9571799a7 ro  quiet splash $vt_handoff
Run Code Online (Sandbox Code Playgroud)

表明 grub 选择 Ubuntu root 而sdb1不是sda1,而我希望它选择sda1

我尝试直接替换所有47d9205b-00a8-40e5-88d6-e8b9571799a7, …

partitioning boot grub2 mount uuid

9
推荐指数
1
解决办法
4万
查看次数

标签 统计

boot ×1

grub2 ×1

mount ×1

partitioning ×1

uuid ×1