Monday, November 21, 2011

Remove Windows Partition and Re-Allocate it to Ubuntu (Or any Linux Partition for that Matter)

The objective here is to remove a Windows partition from a dual boot and add it to your Linux partition. You are doing this because you no longer need Windows and would like the space for your Linux partition.

First make a live USB or live CD with GParted on it.

GParted is a Gnome Partition Editor. Make the live USB with Unetbootin or another tool of your choice. Unebootin can be installed via the Ubuntu Software Center.

After you have created your live USB, boot your device from the USB.

Select the default option from the GParted boot menu, then enter through the default options for keyboard layout etc.

Now, GParted will start, showing you the partitions on your disk.

Select the Windows partition which will likely be NTFS and delete it.
Next delete the extended partition that contains your linux swap.

At this point, you should have only have your linux partitions.

Now, click the "resize/move" button and drag the arrows on either side of the file system so that it is taking up the free space. You want to leave room for your swap which should be as much as twice the RAM on your machine.

So, lastly, you need to re-create the swap partition by selecting the leftover space and right clicking to format it to a linux swap partition.

You then hit apply, and this will take several hours. It is essentially moving all of your data to a different sector on the disc.

Boot as you would normally.

To remove the Windows 7 grub item:

sudo grub-update