Converting Duel Boot Windows 7 Partition to a VM

I recently got a new replacement work laptop with Windows 7 installed. Despite the great desire to shrink it and put a more mature and stable OS on to use, I decided to give Win 7 a shot – that and I needed to use the laptop right away so I didn’t have an immediate choice.

Well after a month of use, Windows 7 was already showing the signs that it was going the way of its predecessors in growing exponentially, slow boots and sloooow shutdowns… I heard Ubuntu calling.

You see, Linux takes a while to get used to when you come from a Windows background, things aren’t done the same way, but after time you realise this new way of doing things makes much more sense and takes much less time. So when you go back to Windows after a few years in Linux, you feel like you’re taking a step back in time – to slower, less advanced OS, where a problem can’t be fixed unless you are prepared to fork out a lot of money for a proprietary app that you’re only ever going to need to use to solve that one problem.

It was time to stop the rot and cage Windows 7, I still needed it for Outlook and Exchange (well until Crossover can support 2010) but I don’t need 90% of that operating system. I had done plenty of duel boots before but I wanted to try my hand at turning my Win 7 partition into a VM, and despite the ubiquity of home-brew tutorials out there on the web, I had to turn to several for different problems I experienced along the way. I’m documenting the steps here completely, and will provide attribute the relevant tutorials that helped.

Step 0: Backup

It needs to be said, it needs to be done. I always hate using Windows Backup and sometimes opt to use a Linux live CD to do the backup instead, guaranteeing I can view the process. I usually just make sure that documents are saved, I’m not worried about settings as these can be reset. This time I used Windows backup to an external HDD which seemed to work adequately enough.

Step 1: Shrink Windows 7 Partition

Although it’s not recommended, I always found GParted to be a trouble-free tool and never had a problem with it, so I booted into an Ubuntu Live CD and fired it up. I was then presented with a disk that had no less than 4 partitions. One was a boot partition, one was recovery, the other I couldn’t tell, and the final one was Windows 7. Here is where I made my first mistake, I got cocky and deleted the Windows boot partition thinking I could restore the boot record later with a recovery disk – it seems Microsoft have made that process much less efficient along with making partitions a lot more complicated than necessary.

Anyway, don’t delete the boot partition, but if you do, then here’s what to do:

The first problem I had was that Windows 7 wouldn’t boot I had the following error:

“autochk program not found, skipping autocheck”

Some Googling brought me to a Microsoft Answers post.

  • Use your recovery CD or download one if you got a crappy OEM pre-installed system – Neosmart have some links and instructions for torrent files.
  • Boot into recovery and then when you get to the System Recovery Options screen, you can choose the automatic System Repair option but I’ve never found it any use so go straight to Command Prompt.
  • Run the following command to check your disk for errors and fix them (where x: is the drive containing your Win 7 install):

CHKDSK x: /F /R

  • Once that runs restart the computer.

In my case chkdsk didn’t work and I still got the error, so the next thing I attempted was to attempt to use bootrec to fix the mbr.

  • Boot back into System Restore, go to the command prompt and run:

bootrec /fixmbr

then
bootrec /fixboot

then
bootrec /rebuildbcd

In my case after the last command I got the following error:

“total identified windows installations 0”

Exporting the bcd didn’t work either:

bcdedit /export C:\BCD_Backup
c:
cd boot
attrib bcd -s -h -r
ren c:\boot\bcd bcd.old
bootrec /RebuildBcd

So I attempted the following fix to this following the instructions from Neosmart again, Recovering the Bootloader:

x:\boot\bootsect.exe /nt60 all /force
del C:\boot\bcd
bcdedit /createstore c:\boot\bcd.temp
bcdedit.exe /store c:\boot\bcd.temp /create {bootmgr} /d "Windows Boot Manager"
bcdedit.exe /import c:\boot\bcd.temp
bcdedit.exe /set {bootmgr} device partition=C:
bcdedit.exe /timeout 10
del c:\boot\bcd.temp

But I didn’t get that far because I didn’t have a bootsect file, so I had to do a bit more digging and found a better solution halfway down this thread. These are just the steps, but more detail about why we do this is in the original post.

First of all I seemed to have some kind of corruption in my filesystem telling me that the c:\boot\bcd file didn’t exist, except it was there, when I attempted to copy memtest.ext to BCD it said that a file already existed. This is where the Live CD came to the rescue:

  • Boot into Linux live cd.
  • Mount your Windows 7 partition.
  • Navigate to /Boot
  • Delete the ‘BCD’ file.
  • After a startup repair your original BCD file is renamed to BCD.Backup.0001.
  • Copy memtest.exe memtest.exe.org.
  • Copy BCD.Backup.0001 memtest.exe.
  • Rename memtest.exe to BCD.
  • Rename memtest.exe.org memtest.exe.
  • Now reboot Windows.

In my case, this solution finally worked and I got Windows working again. Now for virtualisation…

Step 2: Virtualising Windows 7 Partition as a VM

I followed instructions given by Rajat Arya on his blog, apart from the 5th step which didn’t work without some slight modification as I had installed VirtualBox v4.0.4 from http://www.virtualbox.org/, not the Open Source Edition.

These are just the steps, Rajat goes into more detail in the post which is worth reading:

You need to take ownership of the disk first under your username. The original way stated is to chmod the /dev/sda file but this is less secure.
sudo usermod -a -G disk wafitz
Then log out and back in to make the changes take effect. Next install the mbr package:
sudo apt-get install mbr
The -e flag below is to set the partitions you wish to make available to Windows boot, so in this case I set 1 (Windows partition) and 2 (recovery).
install-mbr -e12 --force ~/vm.mbr
Then create the vmdk file. I found that the -relative flag didn’t work, neither did the -mbr flag, but it was fine with these left out:
VBoxManage internalcommands createrawvmdk -filename /home/wafitz/wind7part.vmdk -rawdisk /dev/sda -partitions 1,2 -relative
Now create your VM in VirtualBox and boot into Windows 7. If you get a boot error, you’ll need to do Windows recovery again. Set the VM to mount your CD drive then press F12 at startup and boot into recovery… and follow through on Step 1 of this post again.

Now I installed VirtualBox tools and with Seamless mode, I’m able to Outlook as a full-on desktop app within Ubuntu.

Installing Updates… Windows vs Linux

Ever installed an old Operating System from fresh? Ever tried installing all the required updates in one go? It’s a necessity for some corporate environments and for consultants we can’t just grab the latest build from IT services.

Here’s what happens when you install an outdated Linux distro:

  1. Click Update Manager
  2. “You have 217 Updates”
  3. Click Update All
  4. “The system needs to restart to update the Kernel”
  5. Restart………
  6. Click Update Manager
  7. “Your system is up to date!”

Here’s what happens when you install an outdated Windows OS:

  1. Click Windows Update
  2. “You have 48 Important Updates and 13 Optional Updates”
  3. Click Install Updates
  4. “Windows needs to restart to apply updates”
  5. Restart………
  6. Click Windows Update
  7. “You have 17 Important Updates and 2 Optional Updates”
  8. Click Install Updates
  9. “Windows needs to restart to apply updates”
  10. Restart………
  11. Click Windows Update
  12. “You have 4 Important Updates”
  13. Click Install Updates
  14. “Windows needs to restart to apply updates”
  15. Restart………
  16. Click Windows Update
  17. “You have 2 Important Updates and 2 Optional Updates”
  18. Click Install Updates
  19. “Windows needs to restart to apply updates”
  20. Restart………
  21. Click Windows Update
  22. “You have 7 Important Updates and 2 Optional Updates”
  23. Click Install Updates
  24. “Windows needs to restart to apply updates”
  25. Restart………
  26. Click Windows Update
  27. “You have 5 Important Updates”
  28. Click Install Updates
  29. “Windows needs to restart to apply updates”
  30. Restart………
  31. Click Windows Update
  32. “You have 1 Important Update and 4 Optional Updates”
  33. Click Install Updates
  34. “Windows needs to restart to apply updates”
  35. Restart………
  36. Click Windows Update
  37. “You have 3 Optional Updates”
  38. (HURRAY MUST BE NEARLY FINISHED)!
  39. Click Install Updates
  40. “Windows needs to restart to apply updates”
  41. Restart………
  42. Click Windows Update
  43. “You have 7 Important Updates and 1 Optional Update”
  44. Click Install Updates
  45. “Windows needs to restart to apply updates”
  46. Restart………
  47. Click Windows Update
  48. “You have 5 Important Updates”
  49. (BANG HEAD AGAINST WALL)!
  50. ………

….Ad Infinitum.

The Psychology of Ownership

It must be worth something?!Recently I got a new work laptop with Windows 7 and Microsoft Office Professional 2010 installed. Along with the laptop I got a Product Key Card for MS Office Professional 2010 to activate the license.

I am old enough to remember the days MS Office was sold in larger boxes on CDs and DVDs. What happened? I slid out the plastic inner case and opened it to find a card with the product key printed on it. I entered this into the setup screen on my new laptop and MS Office (already pre-installed) was activated right away.

Then I noticed that inside the cover of the slightly slimmer box, Microsoft has taken liberty to print some waffle about the environment – perhaps to infer this is the reason for no longer supplying a disc and using less packaging.

“Of course! What a great idea to reduce packaging! What’s your problem?” I hear you cry.

Well, simply this… why have such bulky unecessary packaging at all? One product key, 25 numbers – and this requires a pamphlet size card inside a plastic box, inside a cardboard box?! Surely, if they were concerned about the environment they could just ship these keys on credit cards? They’d also save a fortune in shipping fees. In fact, why bother shipping credit cards at all – why not just have customers log into your website, make a payment and download the software direct?

Microsoft Office Professional Edition 2010 costs ~$300, that’s ~£300 when you convert the dollar amount (US products are on a 1:1 currency conversion with the UK – think I’m joking – google it).

OpenOffice.org, or it’s successor LibreOffice, on the other hand is free. You just go to the website and download it for free. So are a number of other office productivity suites such as Lotus Symphony and Google Docs.

Imagine if you could simply log into an app store and download Office and had to pay a whopping £300 for it? Maybe some would pay, many would pirate as they do now, and maybe some would go to one of the free alternatives. After a while, the free alternatives would probably become a lot more attractive and popular.

But this is not the case with MS Office, or rather it is the case because when you pay £300 for MS Office, you get a case. Not a credit card, not a piece of paper with 25 numbers on it, not web access to download an app – a case. It’s a pretty case too, it looks nice and expensive. It reminds you how expensive it is with the aid of some nice graphics on the back. It makes you feel like you actually bought and own something – not that you downloaded it – even though you did (unless they were nice enough to pre-install).

How much do you think Microsoft Office, the app suite, is really worth? £150? £100? £50?… £20? Subtract that from £300 and you have the price you paid to own a pretty box.

And if you think I’m talking rubbish, just consider you’d pay upwards of £15 for CD with just 10 songs (only 2 of which you liked) only 10 years ago. Ditching CD boxes, separating tracks and online distribution changed all this.

Bluetooth on Ubuntu Linux vs on Windows Vista

The introduction of new technology into our lives always seems to have a ripple effect on our existing hardware. Recently I bought a Sony Alpha 330 DSLR which as an entry level SLR I am very happy with. However, I discovered my 4 year old desktop PC’s card reader could not handle the SDHC format that this camera uses.

So I ended up ordering an EVO Labs Internal Card Reader with Bluetooth from Amazon and found it installed into Ubuntu Linux without a hitch. I was then able to utilise the bluetooth chip to connect with my mobile and send/receive files. The only complaint I’d have is since my tower sits under my desk sometimes the bluetooth signal is a little choppy – I don’t know if this is a power issue or due to the proximity of other electrical devices.

Enamoured with my new bluetooth enabled desktop, I decided to invest in some cheap but stylish BTHS600 Bluetooth stereo headset headphones which I am happy to report work splendid with Ubuntu. The desktop took a few reboots to get there, I installed Blueman from the Synaptic Package Manager to manage the connection. All I have to do is switch the headphones on to pairing mode when I want to connect. My Sammy N210 netbook connected flawlessly with no reboots or additional software.

During the teething problems of installation, I wanted to try these with Windows to see how they worked and connected. Windows is good OEM OS that they install by default and is a good benchmark to see how hardware connects and responds.

I booted into Vista and this is where I discovered the snag. Vista was happy to recognise my new internal card reader but when it came to utilising it – it was demanding drivers. I have mislaid the driver disk somewhere because I didn’t need it to run on my main OS, and I’m used to Windows being able to recognise stuff – but it was not the case here. So instead Windows redirected me to the manufacturer website which it insisted was Toshiba. I downloaded the recommended driver package but surprise, surprise this driver didn’t work.

So I can’t get bluetooth working on Vista, and I’m not sure if the card slots will work either. Which OS isn’t ready for the desktop again…?

For those keeping score: Linux 1, Windows 0

For anyone else having trouble hooking up your bluetooth headset I recommend trying out these links:

http://it.toolbox.com/blogs/teach-it/bluetooth-audio-finally-working-in-ubuntu-hh-24028
http://fosswire.com/post/2008/10/better-bluetooth-audio/
https://help.ubuntu.com/community/BluetoothHeadset
http://ubuntuforums.org/showthread.php?p=4910397
http://ubuntu-ky.ubuntuforums.org/showthread.php?p=9030305

Is Symantec Anti-Virus Malware?

Not quite going by strict definitions of malware, but it skates pretty close to annoying and intrusive software in my humble opinion.

Recently I had to work on a Windows XP based machine with a Symantec anti-virus ‘solution’ installed. As with most Windows PC’s, the system had ground down to a halt and was complaining of a full hdd. I was trying to troubleshoot the problem that disk-cleanup would not fix.

I installed Treesize, ran it and discovered in the ‘All Users’ profile the source of the problem.

The Windows partition was approximately 70gb. 46gb were taken up by temporary files created by Symantec in “C:/Documents and Settings/All Users/Application Data/Symantec/Symantec Antivirus Corporate Edition/7.5/xfer_tmp/”

Symantec Fail
Malware or Negligence?

I solved the problem by deleting the temp files and the xfer_tmp directory. I didn’t even check this was the right solution – if the program had crashed that would have been a bonus as far as I was concerned.

This is not just a program bug, this is borderline negligible, considering it’s supposed to be corporate software. It may not be malware by typical definition, but in my case: Installed by default and without choice or consultation, rendering the PC unusable – it’s malware to me.

I’m just glad I run Linux and don’t have to put up with this crapware most of the time.

Things I Can Do in Linux that I Can’t Do in Windows

I’m an evangelist. Whenever I discover something new and great that’s improved my life, I try to spread the message. Occasionally I’ll get someone to try out Linux. They’re always impressed at first, but inevitably the question always comes in some form or other: “Why can’t it do this like it does it in Windows?”

There are many answers to that question depending on the task at hand, in some cases Linux does it differently and better, in others Linux just doesn’t do it (just like Windows doesn’t support ext3).

But this post is not going to be one of those posts, this post is going to be about what I can do in Linux that I find myself asking in Windows “Why can’t it do this?”

I’m purposely leaving out the obvious bullet points – including modify it any way I like because it’s open source – I want to focus on a user perspective, especially for those thinking of making the switch.

1. Always On Top

This is such a simple and useful feature, to select a window and tell it to stay on top of the others. I mainly find it useful for Tomboy notes or when I’m using a combination of the terminal and file manager.

This would be incredibly useful when I’m using Windows based work computers, where as many as 15 application windows could be open at once.

2. Virtual Desktop

Of course what do you do when you have several application windows crowding your taskbar and only one screen. Shift to the next workspace of course!

Before Linux, when I was just a Windows guy I used to look at these default 4 workspaces and wonder why you would need more than one. I guess I got incredibly more busy since then and since moving to Linux. Now I wonder how those with just one desktop cope!

3. Change the Background

Yeah this is just another dig at Windows 7 Starter Trial edition. Sorry it’s just an easy target!

4. Boot Live CD/USB

There’s times when it would be so convenient to say, boot up a virtual environment in order to analyse or recover your hard disk without actually loading the OS.

Other times you want to try out a new flavour of the OS, or have a portable working environment to switch from PC to PC. Being able to install a USB live distro with minimal fuss and no licensing restrictions is bliss.

5. Install Applications Effortlessly

A lot of people make a big deal out of installing from source on a command line in the terminal, but I think this ceased being an issue a long time ago. It’s mostly used as FUD now. – unless you’re making the switch to Gentoo.

I think there may have been a couple of rare occasions in the last 3 years where I had to install something from source – usually a fairly new alpha or beta application.

Most of the time, I just go to Applications menu and click on the package manager, search for what I need and find multiple choices to try. No DVDs, no drivers, no license codes to enter, no crashing another application and all upgrades managed semi-automatically. Clean install and clean removal if necessary.

6. Partition Management

Want to install a second OS, need to extend your home directory? Just fire up a live disk/usb and run your free partition editor of choice.

This was a major seller of Linux for me. Before Linux I didn’t even realise that partition editors were so ubiquitous and free! That’s right partition your hard drive easily and for free!

Oh… and remember that thing about rebooting into a command line that you need to do in Windows in order to repartion? No need for that here, repartion on the fly in your live desktop environment. It’s so easy!

7. Command Line Fu

OK so this may be slightly technical for the average Windows user but since embracing Linux I’ve learned to embrace and love the command line.. sometimes it’s just easier and faster to fire up an terminal and type

egrep -i "Date: \d+/03/2010" | cut -f1 -d: | sort | uniq | while read line; do mv $line /home/user/March_2010/ ; done

Rather than sift through numerous files looking for those containing dates from March 2010 and endless click and drag.

8. Mimic An Apple Mac

There are specific themes created by the community and tutorials on how to do it, however you don’t even have to go that far. There are several app docks in the repository, as well as widgets (but I can’t stand widgets personally). Currently I use Cairo-dock on my desktop Ubuntu setup.

9. Bulk Rename

This can be done from the command line itself but I have to give credit to this utility from the Thunar file manager. It really is one of the most practical and easiest applications I use.

10. Recover from Crashes

Yes the Linux desktop does crash occasionally, a lot less than Windows. But there are a number of ways out beyond Ctrl-Alt-Del or the power button. Crtl-Alt-F1 will switch you to a command line login that allows you to identify problem processes and kill them, whilst raising a skinny elephant (Alt-Sys Rq- RSEIUB) will secure your system before rebooting, minimising data loss and hard drive borking.

Addendum

Of course there are things that Windows will do that Linux won’t. For example Linux won’t reboot after every update like Windows does. It won’t run malware and spyware downloaded passively from fraudulent websites. It won’t bug you to purchase a license after 30 days, or check whether your copy of your OS is genuine. It won’t slow down after a certain amount of time. It won’t require a defrag or disk error scanning.

I guess one thing I really miss about windows is all that time I spent searching for performance tweaks, registry hacks and beefing up security. Unfortunately I spend less time messing about with the OS and more getting things done.

Ditch Windows 7 Starter and Send Microsoft a Message

Anyone else get a netbook recently and have you experience stunted by Microsoft with their crippled version of Windows 7? As you know, recently I bought a new Samsung n210 netbook. The trouble is that it came with Windows 7 Starter Trial edition installed.

Of course, I planned to install UNR anyway, but I still wanted to play with Windows 7 6.1 and see how it compared to Vista… boy was I feeling sorely ripped off when I discovered that this is basically some kind of crippled Trial version of Windows. I mean, you can’t even change the wallpaper on it!

All because Microsoft wants to upsell you a copy of Home Premium so that they can subsidise their OS on a system that is just not cost efficient to run it.

Well, there was no way I was going fall into this lousy sales trap and if you don’t want to play Microsoft’s game that it’s forcing on everybody send them a real message. Don’t just pay up and grumble, switch to a complete Operating System with no limits on what you can use it for, switch to Linux.

Here are 5 distro’s I’ve personally used and can recommend, but you don’t even have to go for one on this list, check out others, especially if one doesn’t quite match with your hardware:

Ubuntu
Ubuntu Netbook Remix
Linux Mint
OpenSUSE
Fedora

Or try out these distros that have been specifically created for netbooks:

Moblin
EEEbuntu
Jolicloud
(UNR technically belongs here too)

Most, if not all, of these distros are going to let you install a duel boot with Windows 7, so even if you want to keep it just for manufacturer updates you can.

Best thing about using Linux on a netbook is absolutely no need to have an external DVD player. I have been using a netbook for over a year and have never needed to plug in an external DVD player. Most of the software I use comes straight from the repositories, the rest is available online.

Don’t throw your money at Microsoft, teach them a real lesson, democratise your computing experience and heal your netbook!