Decided it was time to move my site from on premise hosting to wordpress.com. Will see how this goes and if I’ll put anymore time into creating additional tech posts.
I had a dual-booting laptop with Ubuntu on the first two partitions of the disk and Windows 7 on the last 2 partitions of the same disk. The user only cared for the Windows OS and was running out of space on the Windows partition. Therefore I had to delete the Linux partitions, move and resize the Windows partitions and fix the bootloader from GRUB to Windows.
- Backup your files!!!
- Boot laptop using Ubuntu LiveCD.
- Startup GParted
- Delete first two Linux partitions
- Move Windows partitions to the beginning of the disk.
- Extent the Windows partitions to use the whole disk.
- Reboot system using Windows Install ISO
- Repair Windows Installation
- Reboot and done!
The first few bullets were pretty much straight forward. GParted makes deleting and moving partitions a breeze. The challenge came to fixing the bootloader. Once the OS partition was moved, trying to reboot the system without fixing the bootloader will only show you the grub rescue prompt. This is expected as the Linux OS managed the dual booting (GRUB specifically). We can no longer us GRUB to manage our Windows OS boot up process.
The infamous grub bootloader error:
error: unknown filesystem grub rescue >
There are some great articles out there that explains to you how to fix the MBR and BCD to get Windows working again.
Windows Install Disc and launching system recovery utilities: HowToGeek
Repairing or Rebuild BCD: NeoSmart
Many of the sites explained to use these commands in the Windows Repair command prompt:
bootrec /fixmbrbootrec /fixboot bootrec /rebuildbcd
I even went as far as creating a new BCD several times but with no luck. My previous partition table looked something like this (ignore the sectors/block):
Disk /dev/sda: 250.0 GB, 250059350016 bytes 255 heads, 63 sectors/track, 30401 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sda1 * 1 191 1534176 83 Linux /dev/sda2 192 2231 16386300 82 Linux swap / Solaris /dev/sda3 2232 3506 10241437+ 7 NTFS /dev/sda4 3507 30401 216034087+ 7 NTFS
Once I delete the Linux partitions and moved the Windows partitions, the partition table looked something like this (ignore the sectors/block):
Disk /dev/sda: 250.0 GB, 250059350016 bytes 255 heads, 63 sectors/track, 30401 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sda3 1 1274 10241437+ 7 NTFS /dev/sda4 1275 30401 216034087+ 7 NTFS
* Note: yes the partition table actually only showed sda3 and sda4. odd but still worked. I never did get to be bottom of why the partition tables did not re-index the partitions. That’s for another day to figure out why! 🙂
When booting up from the Windows Install CD and going into the repair disk option, I noticed that when the system recovery would scan for an existing OS it would only find the Windows Recovery Partition located on my first partition. In my Windows system setup, the first partition was the Windows Recovery Partition and the second partition actually was my Windows System Partition. I had a thought at first that the BCD needed to be rebuilt. So I followed the NeoSmart site guide to creating a new BCD and make sure that I pointed to the D drive (second partition) where my Windows System was located. Unfortunately that did not help and the end result was that my boot up screen would sit at a blinking cursor.
I searched around for an answer as to why my Windows System was not being recognized during a OS scan. I checked to see if I had a partition alignment issue but that wasn’t it either. When looking at the partition table, it finally hit me, the boot flag! When I deleted the Linux partitions, I failed to flag my Windows System partition as bootable. Please note that you need to flag the System Partition and NOT the Recovery Partition as bootable. Once I made the change using fdisk, I booted up the system using the Windows Install CD and went back into the repair options. I allowed the system to automatically repair my system. It scanned and found my Windows System installation and repaired the BCD. I did one final reboot and allowed the system to boot from the drive. Magic!
Disk /dev/sda: 250.0 GB, 250059350016 bytes 255 heads, 63 sectors/track, 30401 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sda3 * 1 1274 10241437+ 7 NTFS /dev/sda4 1275 30401 216034087+ 7 NTFS
System booted up with no issues and the system drive know had the extra space I needed.
Even though there were some great articles out there to step me through some tasks, most articles neglected to mention one very important item that needed to be changed when you remove your Linux OS: Make sure that the boot flag is enabled on your system partition. In this case, when I delete my Linux partitions, the sda1 was initially the partition that had the boot flag enable, I neglected to realize at first that with all the activities of deleting, moving and resizing my partition, I did not enable the boot flag for my Windows Installation.
I hope this article was helpful.
by Nick Springate