0

I'm home user of Centos 7. I've install Centos 8 additionaly. I will install Centos 9 over Centos 7 in the future. So I have and will have old copy and new os on the same hard disk.

[root@Prestigio vidas]# blkid
/dev/sda1: LABEL="SWAP" UUID="8d5cadcb-349e-44e0-9c04-dfc39cda9ffe" TYPE="swap"
/dev/sda2: LABEL="CENTOS 7" UUID="432333ab-9311-4cfd-aded-c3d50f4c79a8" TYPE="ext4"
/dev/sda3: LABEL="CENTOS 8" UUID="164e700e-4f52-4e52-aacb-574512303461" TYPE="ext4"
/dev/sda4: LABEL="HOME" UUID="47356a98-6ab5-46a8-afa1-91c22ce880a6" TYPE="ext4"

I switch oses with repair disk.

chroot /mnt/sysimage
grub2-install /dev/sda

It is inconvient. Can I select os via putty and then reboot and how?

1 Answers1

0

If you have a 2nd (non-headless) machine nearby, and an available serial port on each of your machines, and a null-modem (serial console) cable, you can tell grub (and optionally the kernel) to output to serial console. And then use your 2nd machine to select which OS you want to boot from the grub menu. Even though it's not specifically for CentOS, the Arch Wiki has a good page on serial console: https://wiki.archlinux.org/index.php/working_with_the_serial_console

Otherwise, you can configure grub to store your OS choice to grubenv, and then retrieve it from grubenv on your next boot. This question has some tips for doing this for different distros: How can I tell GRUB I want to reboot into Windows—before I reboot? The link @doneal24 just posted is also a good one.

GRUB2 ref: https://www.gnu.org/software/grub/manual/grub/grub.html#Multi_002dboot-manual-config

fmyhr
  • 171