25 June 2014

Salvaging Asus Netbook Recovery Partitions: Going back to Windows after Linux

Getting Ubuntu, Mint or other consumer-oriented Linux distros set up on a netbook is fairly straighforward--there's not a lot of wrestling with drivers or even much need for the command line, like in the old days. Getting back to Windows a couple of years later can be a little trickier, though, as I discovered tonight.

Many netbooks shipped with neither install discs nor disc drives, leaving only a recovery partition on the hard drive. Back when I set up a somewhat locked-down Edubuntu install for my nephew, I at least had the foresight to leave the recovery partition in place, figuring if the machine survived then I might want to migrate him to Windows down the line. I have the machine (Asus 1005HAB) back for a hardware fix now, and he's a bit older, so the time has come.

Ideally, you hit F9 during boot and recovery just happens. My best guess for why that didn't happen in my case is that Linux overwrote the necessary files in the Master Boot Record (MBR). I found reports from others who had the same experience after running Linux live USBs, without ever actually installing Linux. In those cases, repairing the boot files with the ms-sys utility from a Linux live USB did the trick. With no Windows installation present, ms-sys didn't work for me. 

What I ended up doing was copying the recovery partition (about 5GB) to a USB stick, deleting the original (which I'd also backed up along with the old Linux partitions on an external hard drive) and setting the boot options in BIOS to boot from the USB stick. Most of the partition work was done using a gParted Live USB. I'd merged and reformatted the netbook's Linux partitions to NTFS along the way, or I probably could have used gParted in the original install. I was back and forth between the netbook and my main PC, juggling three bootable USBs and an external hard drive by the end, but if I'd known what would be necessary, it could probably all have been done with the netbook and one USB stick.

Chances are anyone finding this post is already as far up a creek as I was by that point, but maybe I can save you some frustration. As usual, I make no claims and accept no liability regarding what YOU do to YOUR DEVICE. Proceed at your own risk. Breaking it down:

Tools

  • At least one USB stick (two preferred). One must be larger than 4GB.
  • At least one computer with a functioning OS. 
  • Recommended, maybe required: a gParted Live USB (LiLi USB for Windows can help you here)*

Steps

  1. Back up! If you have any external storage available, back up the netbook's current system, ideally at the partition level using gParted.
  2. Using gParted, delete the current partition(s), if any, on the USB stick.
  3. Copy the recovery partition, probably the first partition, a few GBs in size, on the netbook hard drive*
  4. Paste the partition to the unallocated space on the USB stick. You can also expand the new partition to fill the stick if you like.
  5. Make sure the new partition is still marked as a "boot" partition (it would be "active" in Windows). 
  6. Make sure you hit Apply!
  7. Delete the original recovery partition, and hit Apply.*
  8. When changes are complete, shut down.
  9. Remove the gParted live USB if applicable, leaving the new recovery USB, and power on.
  10. During boot, hit F2 to enter BIOS.
  11. Navigate with the arrow keys to Boot, go down to Hard Disks, and using Enter choose your USB stick as number one.
  12. Hit F10 to save and exit.

From here, recovery should proceed automatically with a couple of restarts. It will take a few minutes and return the machine to Asus factory setup for either XP or Windows 7 Starter, with all the Asus bloatware you would expect.

*If you attempt to use gParted from within your current Linux install on the netbook, it may not let you delete the original recovery partition, which is NECESSARY. Otherwise, you'll get into recovery on the USB stick, but get an error that the target partition is too small, because recovery on the USB is trying to write to the first partition it sees, which is the little recovery partition on the hard drive. It may also be necessary to merge and/or reformat the old Linux partitions--I'd already done it in the course of trial and error--for recovery to recognize them. If so, you'll want to format as NTFS. 

Also, most Linux images for a Live USB will include gParted--you don't have to go with the image named "gParted" if you want to have a more full-featured distro or utility disk handy. There are also partition managers like EASEUS for Windows that could handle most of this stuff, but they probably won't be able to get at the hard drive in your netbook. I used EASEUS on my PC to set up my recovery USB stick just because I was trying other things on the netbook and wanted to multitask. 

Much of this process would probably generalize to any laptop (or even off-the-rack desktop) refusing to do a factory reset, though I can't guarantee anything. And of course, conscientious backups and recovery discs could spare us the necessity, but throwaway machines like these tend to get separated from their backups, and recovery media, and OSes...