Saturday, January 29, 2011

How to install Ubuntu after Windows installation

This situation is recommended most of the time because installing Ubuntu after Windows will not make Windows disappear in the way Windows does it when it is installed after Ubuntu. But even that it is suppose to be the easiest case, you still can encounter problems. The next steps will help you to complete this task for the most commune situation:

1. Windows installed (in my case Windows 7).
2. One empty partition where we want to install Ubuntu
3. Ubuntu LiveCD (it can be on a CD or USB stick). I test it for Ubuntu 10.10

Installation steps:
1. First you will need to split the empty partition in two (sometimes are recommended three partitions). One will be used for Ubuntu OS and one will be the swap. The recommended size for swap partition is at least the computer internal memory size (1, 2, 4 GB).
1.1. Boot into LiveCD and open GParted. It can be found under System > Administration > Partition Editor. Resizing and creating ext4 partition for Ubuntu OS and swap partition with GParted is covered in the tutorial How to install Windows 7 and Ubuntu side by side.
1.2. If you have problems launching GParted application from Ubuntu LiveCD, you can use EASEUS Partition Master from Windows. I would not recommend Disk Management from windows (Start > Run > compmgmt.msc).
1.3. From EASEUS Partition Master you can easily resize one partition in two. You can even set the File System ext3 and swap for them.

2. Install Ubuntu
2.1. When you reach the step "Prepare disk space" select "Specify partitions manually".
2.2. Highlight the ext3 partition and assign the mount point "/". Check "Format the partition" checkbox and select ext4 as File System.
2.3. Highlight the ext4 partition and click next.
2.4. While the Ubuntu is installing on your computer, you will be asked for location, username, password and so on.

3. Dual boot
3.1. After you reboot the system following Ubuntu installation, you will now see the GRUB menu from where you can select to boot Ubuntu or Windows.

How to install Windows 7 and Ubuntu side by side
EASEUS Partition Master

How to Install / Reinstall Windows after Ubuntu

I have a laptop with two OS installed on it: Windows 7 and Ubuntu. After some drivers problems I had to reinstall Windows 7. Before that I, made some research over the net of how to reinstall Windows after Ubuntu. I find a couple of sites with very useful informations, but as you can imagine, they did not worked smoothly. So here there are the combined steps which will help you reinstall Windows after Ubuntu installation:

1. (very important step) Back-up your important data for both Windows and Ubuntu files, setting, bookmarks...

2. Create an NTFS partition for windows (using fdisk, GPartEd or whatever tool you are familiar with). This step is already done because we have Windows installed on an NTFS partition.

3. Backup the MBR
Normally when Windows is installed after Ubuntu the "Master Boot Record", MBR, will be overwritten. You can save the MBR before installing Windows.
3.1. Boot from Ubuntu and run command: sudo dd if=/dev/sda of=/mbr.bin bs=446 count=1

4. Install Windows

5. Restore the MBR
5.1. Boot into a LiveCD
5.2. Mount Ubuntu root partition in the LiveCD (mbr.bin file was saved on Ubuntu partition). The simplest way to do this is by accessing Nautilus and click on the Ubuntu drive. Ubuntu will give a name for the Ubuntu partition something like 96be32...
5.3. After you mount Ubuntu partition, you have to restore MBR:
e.g. sudo dd if=/media/96be32.../mbr.bin of=/dev/sda bs=446 count=1

6. Restart and dual boot will reappear. Now you can boot Ubuntu.