I have windows 7 and ubuntu 14.04 on my ASUS laptop. Now I want to replace windows 7 with windows 8.1. Will it effect ubuntu ? What is the right and safe way to do this?
Yes, Windows 8.1 will not respect GRUB signature in the MBR and will put its own Boot entry. The Windows 8.1 setup might not delete the Ubuntu partitions on its own (unless you tell it to) but your Ubuntu installation will need to be rescued after installation of Windows 8.1.
I suggest you first backup all your Ubuntu installations data and then proceed.
See the link: Installing Windows 8.1 after Ubuntu 14.04
Also check the link inside above link as well. That should help.