Restoring the MBR for Windows 7

During my explorations of dual-booting of Windows 7 and Ubuntu 10.10, I ended up restoring the master boot record (MBR) so that Windows 7 could load again or to find out if it wouldn’t start for me. The first hint that came to me when I went searching was the bootsect command but this only updates the master boot code on the partition so it did nothing for me. What got things going again was the bootrec command.

To use either of these, I needed to boot from a Windows 7 installation DVD. With my Toshiba Equium laptop, I needed to hold down the F12 key until I was presented with a menu that allowed me to choose from what drive I wanted to boot the machine, the DVD drive in this case. Then, the disk started and gave me a screen where I selected my location and moved to the next one where I selected the Repair option. After that, I got a screen where my Windows 7 installation was located. Once that was selected, I moved on to another screen from I started a command line session. Then, I could issue the commands that I needed.

bootsect /nt60 C:

This would repair the boot sector on the C: drive in a way that is compatible with BOOTMGR. This wasn’t enough for me but was something worth trying anyway in case there was some corruption.

bootrec /fixmbr
bootrec /fixboot

The first of these restores the MBR and the second sorts out the boot sector on the system drive (where the Windows directory resides on your system. In the event, I ran both of these and Windows restarted again, proving that it had come through disk partition changes without a glitch, though CHKDISK did run in the process but that’s understandable. There’s another option for those wanting to get back a boot menu and here it is:

bootrec /rebuildbcd

Though I didn’t need to do so, I ran that too but later used EasyBCD to remove the boot menu from the start-up process because it was surplus to my requirements. That’s a graphical tool that has gained something of a reputation since Microsoft dispensed with the boot.ini file that came with Windows XP for later versions of the operating system.

Manually adding an entry for Windows 7 to an Ubuntu GRUB2 menu

A recent endeavour of mine has been to set up a dual-booting arrangement on my Toshiba Equium laptop with Ubuntu 10.10 and Windows 7 on there side by side. However, unlike the same attempt with my Asus Eee PC where Windows XP coexists with Ubuntu, there was no menu entry on the GRUB (I understand that Ubuntu has had version 2 of this since 9.04 though the internal version is something like 1.9x; you can issue grub-install -v at the command line to find out what version you have on your system) menu afterwards. Thankfully, I eventually figured out how to do this and the process is shared here in a more coherent order than the one in which I discovered all of the steps.

The first step is to edit /etc/grub.d/40_custom (using SUDO) and add the following lines to the bottom of the file:

menuentry ‘Windows 7′ {
set root='(hd0,msdos2)’
chainloader +1

Since the location of the Windows installation can differ widely, I need to explain the “set root” line because (hd0,msdos2) refers to /dev/sda2 on my machine. More generally, hd0 (or /dev/sda elsewhere) refers to the first hard disk installed in any PC with hd1 (or /dev/sdb elsewhere) being the second and so on. While I was expecting to see entries like (hd0,6) in /boot/grub/grub.cfg, what I saw were ones like (hd0,msdos6) instead with the number in the text after the comma being the partition identifier; 1 is the first (sda1), 2 (sda2) is the second and so on. The next line (chainloader) tells GRUB to load the first sector of the Windows drive so that it can boot. After all that decoding, my final comment on what’s above is a simple one: the text “Windows 7” is what will appear in the GRUB menu so you can change this as you see fit.

After saving 40_custom, the next step is to issue the following command to update grub.cfg:

sudo update-grub2

Once that has done its business,  then you can look into /boot/grub/grub.cfg to check that the text added into 40_custom has found its way into there. That is important because this is the file read by GRUB2 when it builds the menu that appears at start-up time. A system reboot will prove conclusively that the new entry has been added successfully. Then, there’s the matter of selectively to see if Windows loads properly like it did for me, once I chose the correct disk partition for the menu entry, that is!

Adding workspaces to Windows

One of the nice things about working with Linux/UNIX is that you can organise your open applications so that they are open in different workspaces or virtual desktops. When I return to working on Windows, having everything open on the same desktop is something that I find less tidy. However, there is an open source application that adds virtual desktops to Windows and very useful it is too.

It is called VirtuaWin and it adds an icon to the taskbar for switching between workspaces when it is running; there might be a bit of tweaking to be done for it to stay visible all of the time though. You can have it as a startup application in the same way that you have your security software and I have been using it smoothly on both Windows XP and Windows 7 running in VirtualBox virtual machines. Insofar as I have seen it, you can have as many workspaces as you want and switching from one to another is achievable using keyboard shortcuts. Using CTRL, ALT and one of the arrow keys does it for me but you can set up your own. All in all, it’s a small download that brings a little sense of Windows desktop computing.


For a while, the Windows computing side of my life has been spread across far too many versions of the pervasive operating systems with the list including 2000 (desktop and server), XP, 2003 Server, Vista and 7; 9x hasn’t been part of my life for what feels like an age. At home, XP has been the mainstay for my Windows computing needs with Vista Home Premium loaded on my Toshiba laptop. The latter variant came in for more use during that period of home computing “homelessness” and, despite a cacophony of complaints from some, it seemed to work well enough. Since the start of the year, 7 has also been in my sights with beta and release candidate instances in virtual machines leaving me impressed enough to go popping the final version onto both the laptop and in a VM on my main PC. Microsoft finally have got around to checking product keys over the net so that meant a licence purchase for each installation using the same downloaded 32-bit ISO image. 7 still is doing well by me so I am beginning to wonder whether having an XP VM is becoming pointless. The reason for that train of thought is that 7 is becoming the only version that I really need for anything that takes me into the world of Windows.

Work is a different matter with a recent move away from Windows 2000 to Vista heavily reducing my exposure to the venerable old stager (businesses usually take longer to migrate and any good IT manager usually delays any migration by a year anyway). 2000 is sufficiently outmoded by now that even my brother was considering a move to 7 for his work because of al the Office 2007 files that have been coming his way. He may be no technical user but the bad press gained by Vista hasn’t passed him by so a certain wariness is understandable. Saying that, my experiences with Vista haven’t been unpleasant and it always worked well on the laptop and the same also can be said for its corporate desktop counterpart. Much of the noise centered around issues of hardware and software compatibility and that certainly is apparent at work with my having some creases left to straighten.

With all of this general forward heaving, you might think that IE6 would be shuffling its mortal coil by now but a recent check on visitor statistics for this website places it at about 13% share, tantalisingly close to oblivion but still too large to ignore it completely. All in all, it is lingering like that earlier blight of web design, Netscape 4.x. If I was planning a big change to the site design, setting up a Win2K VM would be in order not to completely put off those labouring with the old curmudgeon. For smaller changes, the temptation is not to bother checking but that is questionable when XP is set to live on for a while yet. That came with IE6 and there must be users labouring with the old curmudgeon and that’s ironic with IE8 being available for SP2 since its original launch a while back. Where all this is leading me is towards the idea of waiting for IE6 share to decrease further before tackling any major site changes. After all, I can wait with the general downward trend in market share; there has to be a point when its awkwardness makes it no longer viable to support the thing. That would be a happy day.

Never undercutting the reseller…

Quite possibly, THE big technology news of the week has been the launch of Windows 7. Regular readers may be aware that I have been having a play with the beta and release candidate versions of the thing since the start of the year. In summary, I have found to work both well and unobtrusively. There have been some rough edges when access files through VirtualBox’s means of accessing the host file system from a VM but that’s the only perturbation to be reported and, even then, it only seemed to affect my use of Photoshop Elements.

Therefore, I had it in mind to get my hands on a copy of the final release after it came out. Of course, there was the option of pre-ordering but that isn’t for everyone so there are others. A trip down to the local branch of PC World will allow you to satisfy your needs with full, upgrade (if you already have a copy of XP or Vista, it might be worth trying out the Windows Secrets double installation trick to get it loaded on a clean system) and family packs. The last of these is very tempting: three Home Premium licences for around £130. Wandering around to your local PC components emporium is an alternative but you have to remember that OEM versions of the operating system are locked to the first (self-built) system on which they are installed. Apart from that restriction, the good value compared with retail editions makes them worth considering. The last option that I wish to bring to your attention is buying directly from Microsoft themselves. You would think that this may be cheaper than going to a reseller but that’s not the case with the Family Pack costing around £150 in comparison to PC World’s pricing and it doesn’t end there. That they only accept Maestro debit cards along with credit cards from the likes of Visa and Mastercard perhaps is another sign that Microsoft are new to whole idea of selling online. In contrast, Tesco is no stranger to online selling but they have Windows 7 on offer though they aren’t noted for computer sales; PC World may be forgiven for wondering what that means but who would buy an operating system along with their groceries? I suppose that the answer to that would be that people who are accustomed to delivering one’s essentials at a convenient time should be able to do the same with computer goods too. That convenience of timing is another feature of downloading an OS from the web and many a Linux fan should know what that means. Microsoft may have discovered this of late but that’s better than never.

Because of my positive experience with the pre-release variants of Windows 7, I am very tempted to get my hands on the commercial release. Because I have until early next year with the release candidate and XP works sufficiently well (it ultimately has given Vista something of a soaking), I’ll be able to bide my time. When I do make the jump, it’ll probably be Home Premium that I’ll choose because it seems difficult to justify the extra cost of Professional. It was different in the days of XP when its Professional edition did have something to offer technically minded home users like me. With 7, XP Mode might be a draw but with virtualisation packages like VirtualBox available for no cost, it’s hard to justify spending extra. In any case, I have Vista Home Premium loaded on my Toshiba laptop and that seems to work fine, in spite of all the bad press that Vista has gotten for itself.