When you inserted two hard drives in your system, Windows reads them as multiple partitions (some partitions are of 1st hard drive and some are of 2nd)
One partition stores the information about the boot record. It happens sometimes that, when you install Windows on a different partition (say D), the boot information (the hidden boot folder, etc) still stays in previous partitions (say C).
When you are trying to install OS on your second hard drive partition, the system CAN install the OS on that but the boot record has to be maintained on the current boot partition (which is a partition in your primary drive). That's why it is causing an error, because if somehow you install the OS on secondary, you will not be able to boot it independently (without this primary hard drive) because the boot information is in the partition of primary hard drive.
How to fix this ?:
- You don't have to swap primary and secondary hard drives, you can just open your CPU panel and unplug the primary harddrive (from SATA cable).
- Then the secondary hard drive will boot as primary, now install the OS on secondary hard drive as normal.
- Then re-plug your primary hard drive.
Note: Still the primary harddrive boot partition is not aware of your secondary hard drive OS. (But you have created a boot record of its own, so that it could run independently when used in another system or in the current system without primary hard drive)
To create a boot entry for secondary hard drive in you primary hard drive boot menu, you can follow the process mentioned here https://superuser.com/a/1159368/677184