How to setup RHEL7 dual boot in azure VM

Latest response

I would like to setup an azure VM with two disks (e.g. sda and sdb) like this:
In sda we install rhel7 with one configuration.
In sdb we install rhel7 with another configuration.

This azure vm can boot in either of two configurations by selecting in GRUB boot menu.

We have done this in a physical machine. But don't know whether it can be done in a azure rhel7 vm. And if it can be done in azure, would you please share your experience or links to do so.

Thanks very much.

Responses

Can I ask what you're hoping to gain by this? I am not able to understand the use case for why this would be useful.

Different configurations for different purposes, this setup let you isolate different configurations and put all configurations in one vm.

Instead doing this, i guess you want to virtualize the OS. Can have alook on docker instead.

Thanks for all responses. Finally I make it work. I select VM generation V1 (I firstly tried v2, but failed) and install a fresh rhel7 in disk 1. Then I attached another disk 2 to this new vm. Then I copy a entire server to disk 2. The use dracut to create a new .img file and re-generate grub.cfg file:

mount /dev/sdb1 /mnt/sdb1 mount -o bind /sys /mnt/sda1/sys mount -o bind /proc /mnt/sda1/proc mount -o bind /dev /mnt/sda1/dev chroot /mnt/sdb1 dracut -f initramfs-3.10.0-1160.49.1.el7.x86_64.img 3.10.0-1160.49.1.el7.x86_64 grub2-mkconfig -o /boot/grub2/grub.cfg exit

After above. Copy all /mnt/sdb1/boot/3.10.0-1160.49.1.el7.x86_64 to /boot/. And copy the menuentry of 3.10.0-1160.49.1.el7.x86_64 from /mnt/sdb1/boot/grub2/grub.cfg into /boot/grub2/grub.cfg. Then reboot vm.