Ubuntu – Hard drive dying – Reinstall Windows after Ubuntu

bootdual-bootgrub2hard drivepartitioning

I realize that this is not a 100% Ubuntu question as Microsoft Windows is also part of the problem, but I hope that this is still the right address.

I also want to mention that I read this similar question: How can I install Windows after I've installed Ubuntu?.

The situation is as follows: I have a notebook with two hard drives. One 1TB HDD (/dev/sda) and one 120GB SSD (/dev/sdb). Windows 8 is installed on the HDD (sda) and Ubuntu 14.04 was installed afterwards on the SSD (sdb).

Now my HDD is dying: gnome-disk-utility tells me that there are issues and a Seagate tool verifies this. Hence, I made a backup of my data from the HDD and I am about to buy a new 1 TB HDD to replace the old one.

My plan is to replace the defective hard drive with the new one and install Windows 10 on it. I have got a Windows 10 key and a iso file from which I intend to create a bootable USB drive.

My question is now, how the installation is done in detail. I always read that it is not recommended to install Windows after Ubuntu, because the MBR gets overwritten and so on.

I am not sure, where grub is currently installed (from gnome-disk-utility I see that /dev/sda2 (type EFI-System) is mounted in /boot/efi, does that mean that grub is installed on sda (=defective HDD)?). I also do not know what will happen if I remove the HDD. Will it still be possible to boot into Ubuntu?

So my schedule would be as follows:

  1. Backup all data from /dev/sda (=old HDD)
  2. Create Ubuntu bootable USB flash drive
  3. Create Windows 10 bootable USB flash drive (different USB stick)
  4. Remove old HDD from notebook and plug in new one
  5. Check if I can still boot into Ubuntu (I guess no?)
  6. Boot from Windows 10 USB flash drive and install Windows 10 on new HDD
  7. Boot from Ubuntu USB stick and create Grub menu (this point needs clarification!)
  8. Done. Dualboot with Windows 10 on new hdd and Ubuntu on "old" SSD

Is this a reasonable plan? Where might there be problems? What about this whole (U)EFI business – do I have to keep something in mind here?


Remarks after the installation

Everything worked out without any problems. After removing the old HDD and plugging in the new one, I was not able to boot into Ubuntu again (just as expected). With the Live USB I booted Ubuntu and formatted the new HDD to NTFS. Then I booted with the Windows 10 USB drive and started the installation. However, Windows did not like the ntfs (or whatever) and so it refused to install. Deleting the partition and letting Windows do it stuff resolved this. After the installation of Windows 10, I booted again into Ubuntu with the Live USB, ran boot-repair with the recommended settings and now I got my parallel boot back. Everything works just fine!

Best Answer

Your plan sounds good to me. If your MBR is installed on sda then you are right in assuming that you won't be able to boot into Ubuntu easily.

Point 7 will be the one that you will want to look at boot repair.

Your other option could also be to clone your dying drive. If you can temporarily replace your SSD with your new hard drive (or use a USB to SATA connector), you could use dd to copy over the information from your old hard drive. This would save you the reinstallation of Windows, your programs, your data and your MBR.

  1. You can do that by having both your old hard drive and your new hard drive connected to your computer.
  2. Then you start up the computer with a Live CD (or USB).
  3. Use dd to copy your old drive: sudo dd if=/dev/sdX of=/dev/sdY bs=16M

You will need to replace /dev/sdX with the drive letter of your old drive, and /dev/sdY with your new drive.

You can find out the drive letters with sudo fdisk -l . Your new drive will be the disk with no partition information.

It will take a couple hours to copy it, and you won't see any progress updates during that time. If you want a more verbose solution that will even try to copy bad blocks of data, you can use the excellent 'ddrescue' program as well.

To use ddrescue, you will need to enable all repositories in the LiveCD, do a apt-get update and then install it (sudo apt-get install gddrescue). The command is a bit different too: sudo ddrescue /dev/sdX /dev/sdY

Hope this helps. Let me know if you need more information.

Related Question