Move Ubuntu from a wubi partition to a real one!

Wubi offers a quick and painless way of trying out Ubuntu. However it does have some performance drawbacks but the major one is that it doesnot allow Hibernation, which is a must for me. After having played around with Ubuntu for some time , I figured its time to install it as a partition, but I didnot want to give away my Wubi installation. So i decided  to move it and believe me, It’s not as straightforward as it sounds .. And after playing around with VirtualBox , I finally figured it out 🙂 ..

So this is what you need :

1) Live CD of your Ubuntu distribution

2) Two partitions on your hard drive (Can be primary or extended)

3) Patience !!! Lots of it ..

In case you dont hve two free partitions then you need to make them somehow. Since you already have a windows installation, you can use any partition manager to resize your existing partitions to create space for Linux or use GParted as I did. It is better to have the partitions of the same size as your Ubuntu disks. And how do you know the size of the disks? You can find your Ubuntu disks (aka. Wubi installations) under your installation_drive_used_for_wubi/ubuntu/disks . Here you will find two disks namely root.disk and swap.disk . Write down the size and make your partitions accordingly. Also you can directly format the partitions as ext4 although it is not mandatory.

Once you are done with the partitions, you are ready to proceed. Next is boot off the live cd. If you dont have the live cd, download it off the site. You can boot off your usb too, using the nifty utility “UnetBootin“. Instructions to use Unetbootin can be found on its site. Once you booted off the livecd/usb, then comes the mounting part.

Go to Applications>Accessories>terminal and type the following commands

$  sudo fdisk -l

This should give you the list of partitions on your hard drive. Make a note of the two partitions that you made. If you made a primary partition, It should be one of /dev/sda[1-4], while extended partitions will be /dev/sda[5+]. Lets assume the root partition is /dev/sda6. Now mount the hard-drive partition where the ubuntu disks are located. You can do this by just going to Places menu and clicking on your partition. To know the path where it is mounted, on the Terminal type :

$  sudo /etc/mtab

Your newly mounted partition will be listed , usually at the end of the list and it would probably start with /media/XXX . You can also mount the partition manually if you can locate your partition in the fdisk output, in which case you just need to type :

$  sudo mount /dev/sdaX /media/Data

Lets say the partition is mounted at /media/Data. Now we need to copy the disks onto the partitions. For this we will use the dd command.On the terminal, cd into /media/Data/ubuntu/disks and type :

$  sudo dd if=root.disk of=/dev/sda6

This would take a long time depending upon the disk size. For a 30 gig disk, it took an hour for me . Repeat the same for the swap disk.

$  sudo dd if=swap.disk of=/dev/sda7

After the copying is completed , the last step that remains is setting up the Bootloader. For Ubuntu 10.04, Grub2 is being used and I will give directions for the same.

Fire up a terminal from the Live CD for Ubuntu 10.04.
$ sudo fdisk -l (Note the partition number on which Linux resides)
$ sudo mount /dev/sdaX /mnt (Replace X with the partition number housing Linux, 6 in our case)
$ sudo grub-install --root-directory=/mnt/ /dev/sda
$ sudo update-grub
$ sudo reboot

Credits to
http://mundogeek.net/archivos/2009/12/08/recuperar-grub-2/ for the enlightening post &
http://www.webupd8.org/2009/12/how-to-recover-grub2-linux.html for the awesome translation.

After the reboot, you should see the dual-boot screen of Grub2 asking you to select the OS. Boot into Ubuntu and you should hopefully see the login screen. 🙂 …

Post comments for any clarifications..

Advertisements

Posted on September 7, 2010, in mobile. Bookmark the permalink. 2 Comments.

  1. That won’t work. There’re a lot of things missing e.g. updating /etc/fstab, removing the lupin support, updating grub. You don’t need to transfer swap – there’s nothing there that you’d need to move.
    If you didn’t update grub, then the grub is probably just booting the old wubi you still have.
    You can probably recover it though.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: