How to backup/restore a Wubi installation

About a week ago, I decided to format the whole harddisk and start anew.

Of course, this meant losing the triple-boot configuration and Wubi along with it. I was fine with losing the windows, but didn’t want to lose the Wubi Ubuntu installation.

So I just copied the /ubuntu folder on the harddisk. Oops, forgot the wubildr and wubildr.mbr in the root folder of that partition in a rush :/ But I guess they were the same as the files in /ubuntu/winboot/ as it worked in the end when I copied those files from that folder to the root folder.

Thus; Step 1:

Make a backup of the /ubuntu folder on your harddisk along with wubildr and wubildr.mbr files in the root folder.

Step 2:

We need to copy/get a screenshot/jot down/etc. the boot configuration data(BCD).

The tool bcdedit can access this store on Windows Vista and 7. This tool requires administrative privileges btw, so be sure to run it so. Just run the command bcdedit and it will list the boot managers, boot loaders, and boot sectors existing in the MBR.

On Windows XP and below, you can just copy your boot.ini file. (or just the entry again if you will)

bcdedit can export the whole store, but that would be meaningless as we just need the Wubi entry. I am not sure if it can export a single entry outside.

You may not even need to note it down actually, if you installed Wubi into the default location on the harddisk, in which case the path of the boot sector entry would be \ubuntu\winboot\wubildr.mbr. The device field of that entry would be the partition that it is installed in, in my case partition=D: and the description field is just anything you want, Ubuntu in my case. The identifier would be something along the lines of {04d135e7-894e-11de-aebe-c7d69a3f2716}. (I am not really sure if this identifier is important or not, I am guessing it is just a unique id for the entry)

Step 3:

Format your drive, repartition your drive, install Windows again etc.

Step 4:

Copy back the directory and files that we have backed up in Step 1 to a partition you like.

Run up bcdedit, create a new entry and basically give it the fields that you’ve noted down/know by heart before.

OR on Windows XP and below: just copy the entry from the backed up boot.ini file and paste it to the new one. (also change the partition if you have changed it)

Step 5:

So we are all set, just restart the system and boot up Ubuntu from the list.

Step 6(optional):

Damn, it gives an error. “ALERT! /dev/disk/by-uuid/FCD401C9D3217200 does not exist”. Well, Ubuntu uses these uuid’s to access the partitions in the recent versions.

This problem could arise if you have repartitioned your disk, thus giving the partition a new uuid(Universally Unique Identifier), or maybe just changed the partition on which the /ubuntu folder was located before.

At any rate, if you come across this error; you will have to replace this uuid with the correct one(the one to the root partition). This is probably your Windows partition on a dual-boot configuration. After the error you are dropped out to a busybox shell. We can run some commands to find the correct uuid, or just reference the partition with /dev/hd?? or /dev/sd??.

Run ls –l /dev/disk/by-uuid. You will see that these uuids are links to /dev/hd??s or /dev/sd??.

At the next boot of Ubuntu, hit ESC to go to the menu and hit e to edit the entry. Replace the root entry with the root partition (something like root=/dev/sda2), and hit b to boot. You can just try all of them one by one if you can’t figure out what the root partition is.

At some point, it will work and you will boot to your precious Ubuntu 🙂

OK; however, we don’t want to change this entry everytime we boot up, so we will edit the /boot/grub/menu.lst file of the GRUB bootloader, and change the entry permanently from there.

Save it up, and you will not have any problems booting up anymore.

 

Of course, I didn’t figure everything by myself, I had to do a little googling, but as I did this thing almost a week ago, I can’t seem to find the exact source for this uuid problem.

Another question is probably why am I not just using a full Ubuntu installation (it is better in many ways). Well, I am actually, I have 2 Ubuntus installed right now (different versions) 😛

Well, let’s just say that I want it to be portable, I can just grab my external harddisk and ‘copy’ the Ubuntu OS (a specific version, with tools already loaded and stuff) whenever I need it. On second thought, I can probably also just get an image of the Ubuntu partitions maybe for this? Well, still, I have to change the boot manager and stuff, I think this is easier.

I would actually want to do this also for other Linux distributions, I wonder if I can modify Wubi to download and install another distro instead =)

Advertisements

8 Comments

  1. Travis Stein said,

    May 5, 2010 at 11:14 pm

    This was extremely helpful in saving at least one out of my two for dual boot system 🙂 Thanks!

  2. geaplanet said,

    June 27, 2010 at 3:06 am

    Really interesting.

  3. sandy13an said,

    January 7, 2011 at 2:06 pm

    Thanx man..!! Was looking everywhere for this..!!

  4. Erel Segal said,

    February 7, 2011 at 1:27 pm

    If you just want to backup and restore your Wubi installation, why don’t you just copy the ubuntu folder (step #1), then re-install Wubi on your formatted drive, and then copy the ubuntu folder back in place?

  5. Ozan Safi said,

    February 7, 2011 at 1:51 pm

    Hmm. Yeah it makes sense. The problem there was the change in boot config. But reinstalling Wubi would create the correct boot entry, and all that is needed would be copying the ubuntu folder back in place as you have said.

    Thanks for the feedback.

    I don’t remember how Wubi works right now though, haven’t used it for a while, if one has to wait for it to download the whole Ubuntu image before creating the boot entry; that could mean waiting for some time on a slow (or maybe no) internet connection. In that case this could be a faster option.

  6. Moses said,

    March 18, 2011 at 4:39 pm

    Thanx alot. I couldnt get this information anywhere else. It has really helped me copy my wubi installation from one computer to another.
    Step 6 was really helpful as my second computer had UUI different from first computer. This page really rocks. Thanx a million times.

  7. Moses said,

    March 18, 2011 at 4:52 pm

    Thanx alot. I couldnt get this information anywhere else. It has really helped me copy my wubi installation from one computer to another.
    Step 6 was really helpful as my second computer had UUI different from first computer. This page really rocks. Thanx a million times.

  8. Thor said,

    February 3, 2012 at 7:07 am

    Am I the only person running Wubi who doesn’t have a /boot/grub/menu.lst file? This is driving me crazy! I my windows installation got corrupted and while I managed to copy my files off the disk, I had to reformat before I knew anything about jotting down any specifics.
    My wubi doesn’t (and never did) boot into grub. After windows bootloader it goes straight into ubuntu.
    I’ve managed to mount my old root.disk file within a new wubi installation… but after that I’m at a dead end.


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: