SysAdventures: The one about dual booting Windows and Linux

My laptop

My trusty old laptop

Today has a been a small adventure in trying to go from Ubuntu and Windows living on the same disk to them living on separate disks.

But let’s start from the top.

  1. I bought my hp g6-2131so laptop some years ago.
  2. X amount of time passed while I happily used my laptop for writing my master thesis.
  3. After finishing my master thesis I replaced the existing Windows installation with a Ubuntu (Linux) installation.
  4. More time passed. And then I got bored of not being able to play certain games on Ubuntu due to bad driver support (yes Linux has a lot of great driver support but the performance of my hybrid switchable graphics was lacking). So, I installed Windows alongside Linux (which was an adventure in itself concerning destroying and rebuilding partition tables). It would have been much easier to just wipe the hard drive, install Windows first and then Linux. I wanted to try out the avenue of keeping the Linux installation but just shrinking it. And it worked!
  5. Then even more time passed. And I figured that I would like to complement the 256gb ssd hard drive with a 1tb regular spinning disk hard drive. So, I bought an Icy Box optical drive caddy.

So about that current adventure

Icy box hard drive caddy

Replacing the optical drive with a second hard drive.

I replaced the optical drive with the hdd drive caddy. Afterwards I used DriveXml to move the preexisting windows installation to the new disk. That worked somewhat. The new disk would error on startup saying that it would have to run a checkdisk but then error yet again stating that it couldn’t complete it. The solution was then to create a windows 7 recovery disk which would let me fire up a command prompt on startup. From within the command prompt I ran 'chkdsk :d /f' and watched it complete successfully. “Great,” I thought.

So, then I had a working Windows 7 installation on the new disk. What remained was to remove Windows from the old disk containing Linux and let Linux claim the whole drive. That proved a little tricky. I was easily able to delete the windows partition I no longer needed, but when I ran 'df -h' to see how much space I was able to add to the Linux installation it didn’t show the additional free space. I then had to return to searching online for clues. It turned out that I had to update the file system telling it that it had more space to use. That resulted in a mix of fsck, pvextend and resize2fs commands before I was finally able to solve it. Despite my modest “command line fu” I managed to pull through by reading a little of the Linux manual pages and trusting that I had found some good online sources. The result was my Ubuntu installation receiving an extra 50gb of hard drive space to play with. Success!

Regretfully though when I went back to try and boot into Windows it failed quite hard. Supposedly the error was caused by the previous resizing commands causing the partitions to receive new unique ids thus confusing Windows. Alright. Sad face. I first tried to fix the issue but when I wasn’t successful at that I decided to just wipe new hard drive and do a clean Windows installation. Though that wasn’t that simple either.

In the end I had to remove the first (Linux) hdd entirely from the laptop before the Windows 7 installer would allow me to install Windows. To finish things off I had to remove a partition boot flag from the Windows disk and add it to the Linux disk instead so that Linux could enable the dual boot functionality. I also had to update the Linux boot configuration using grub-customizer (an excellent program by the way).

Sadly I had to reinstall windows. But I have a backups for laptop drivers and such so it’s not a big loss. All in all things went well. It just took a little time. :)