/dev/vda1, /dev/vdb1 and so forth) to identify disk partitions. However, these device names may change due to the change in the actual operating environment after an image is imported. To guarantee the correct booting of the system even when the device name changes, you can modify the disk identification method in the GRUB file to the Universally Unique Identifier (UUID). /boot/grub/menu.lst or /boot/grub/grub.conf./boot/grub/grub.cfg or /boot/grub2/grub.cfg.menu.lst or grub.conf file in the /boot/grub directory, you are probably using GRUB (GRUB Legacy). If you find the grub.cfg file in the /boot/grub or /boot/grub2 directory, you are probably using GRUB2.blkid command can be used. Running the blkid command will display the detailed information of all the available partitions, including the UUIDs. Run the following command in the terminal: sudo blkid
/dev/vda1 is c0b9ecd8-f922-4e5d-bccb-83fbc94ad23b. /dev/vda1: UUID="c0b9ecd8-f922-4e5d-bccb-83fbc94ad23b" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="bcfcb5cb-01"
/boot/grub/grub.cfg directory is made. If you are using GRUB, or if the GRUB2 configuration file for distribution is located in the /boot/grub2/grub.cfg directory, you can adjust the configuration according to the actual situation. /boot/grub/grub.cfg file to the /home directory.sudo cp /boot/grub/grub.cfg /home
/boot/grub/grub.cfg file and confirm the root partition marked in the configuration file. In this case, the root partition is located on the /dev/vda1 device. sudo vi /boot/grub/grub.cfg
# /boot/grub/grub.cfg...echo 'Loading Linux 6.1.0-13-amd64 ...'linux /boot/vmlinuz-6.1.0-13-amd64 root=/dev/vda1 roecho 'Loading initial ramdisk ...'...
grub.cfg file, and change the root=/dev/vda1 device name to the root=UUID=xxx format. The content after root=UUID= is the UUID value corresponding to the device returned by running the blkid command. This configuration may appear for multiple times in the grub.cfg file. The modifcation is required for each configuration. # Before modification...echo 'Loading Linux 6.1.0-13-amd64 ...'linux /boot/vmlinuz-6.1.0-13-amd64 root=/dev/vda1 roecho 'Loading initial ramdisk ...'...# After modification...echo 'Loading Linux 6.1.0-13-amd64 ...'linux /boot/vmlinuz-6.1.0-13-amd64 root=UUID=c0b9ecd8-f922-4e5d-bccb-83fbc94ad23b roecho 'Loading initial ramdisk ...'...
sudo cat /boot/grub/grub.cfg
...linux /boot/vmlinuz-6.1.0-13-amd64 root=UUID=c0b9ecd8-f922-4e5d-bccb-83fbc94ad23b ro...
grub.cfg backup file in the /home directory.Feedback