Some Notes On Migrating A Wubi Ubuntu Install

For no particular reason, I decided to migrate my Windows development server to a Ubuntu Server install. Not wanting to just wipe the drive and deny myself a safety net, I went the Wubi route. Wubi allows you to install Ubuntu inside a disk image, rather than a partition, so there's no risk of accidentally destroying your Windows install and completely removing Ubuntu is a simple matter of running the Wubi uninstaller. I eventually got to the stage where I was happy with my Ubuntu Server setup and felt it was time to dump Windows altogether.

The problem is, migrating from a Wubi-created disk image to a real partition is not a supported feature. Some high-quality, mostly bullet-proof scripts are available to automate the process, but being a Windows guy with little Linux experience, there were a few lingering questions and doubts about the process that I couldn't immediately find answers to. So, to save others the stress, here's a few notes you might find useful.

1) If you installed Wubi onto the drive / partition you plan to wipe, this complicates things slightly. You'll first have to move the install to a partition that can support the size of root.disk — the Ubuntu disk image. Unfortunately, you can't just copy and paste the "ubuntu" directory from one partition to another and have it boot. Here's what you need to do and this will only work if you haven't upgraded or changed kernels since you installed Ubuntu via Wubi:

  • Copy (don't move) the "ubuntu" directory (it should be in the root of the drive you installed Wubi to). Once the copy is complete, rename the copied folder to something like "ubuntu_backup".
  • Uninstall Wubi. This will delete Ubuntu from your machine, but it's OK as long as you made the copy.
  • Reinstall Wubi to the desired partition. You should probably set the disk image to its smallest possible size — we'll eventually overwrite it.
  • Now, boot into the fresh Ubuntu install. Once you're inside the GUI, you'll need to mount your original root.disk image. Fire up a terminal and type the following: sudo mkdir /media/oldroot sudo mount (path) /media/oldroot
  • Where (path) is the path to the original root.disk. All your drives can be found under /media/, so just locate it using Nautilus and make a note of the full path.
  • Open up an instance of Nautilus with root access: gksudo Nautilus
  • When Nautilus opens, find the GRUB2 config file for your current install. The file can be found in "/boot/grub/grub.cfg". Copy it and then browse to the GRUB2 config file in your original Wubi install (it'll be in the root.disk file you just mounted). Overwrite this config file with the one you copied (feel free to make a backup first).
  • Close everything and boot back into Windows. Make a backup of your new root.disk, in case something goes wrong.
  • Overwrite the new root.disk with your old root.disk, from the "ubuntu_backup" folder we made before.
  • Reboot. If all goes well, you should be able to get back into your previous Ubuntu install, but it'll now be located on the new partition.

Now, what I've just told you to do is hardly recommended, fairly crude and requires you to have the same kernel in the old and new Ubuntu installs, but it will get you back into your original root.disk. If anyone knows a better way, let me know! I believe you can do it from a GRUB2 prompt, but that's a little out of my depth.

2) Although the migration scripts are available on the Ubuntu forum, you can't actually download them without a user account. Signing up isn't painful by any means, but if you're just after the files, you can grab them off of their official repository on Github.

3) The migration assumes that you're going to continue to run Windows side-by-side with Ubuntu, so there's no mention of what happens if you just wipe Windows completely and replace it with the Wubi-installed Ubuntu. Of particular concern is whether or not the darn thing will boot once you complete the process and restart. Don't worry — the migration script takes care of that and, if all goes well, you should boot to GRUB, where you can select the kernel you want to run as usual.

4) You need to set up the partitions for Ubuntu to be migrated to. If your Wubi Ubuntu install is on a different partition to the one you'll be migrating to, you can do this from within Ubuntu, without using a recovery disk or live CD. Just load up the Disk Utility, locate the desired drive and create the partitions. If you go with a swap partition (rather than a file), make sure to mark it as such.

I'm more than willing to admit I'm no Linux expert, so the migration process was a lot more harrowing than it needed to be. There's a surprisingly lack of info about the finer details of completely replacing a Windows install with a Wubi-created Ubuntu one, so if anyone has any tips or suggestions, please don't hesitate to comment.


Comments

    "if anyone has any tips or suggestions, please don’t hesitate to comment." Say goodbye to your Microsoft sponsorship.

    "Say goodbye to your Microsoft sponsorship."

    Even Microsoft has come around, and is now a top ten contributor to the Linux kernel - primarily drivers and tech to ensure that Windows runs well in a Linux-centric world. Why, I haven't heard them use the word "cancer" all year! ;-)

      @ricegf - I get that Microsoft tolerates Linux, but this article asks for tips and suggestions about 'completely replacing Windows with a Wubi-created Ubuntu one,' that good sir is MUTINY!!

    yes....all of us have a place in our homes for a paid ms server licence.....

Join the discussion!

Trending Stories Right Now