formatting a windows partition to linux (ubuntu)

by on Jun.13, 2009, under linux/ubuntu

There are many reasons why you may wish to format an existing windows partition over to linux, most commonly it seems to be users coming from a dual boot scenario and now wish to make the full switch to a better operating system (LINUX!). We all want to rid our computers of the nasty virus of microsoft – and dual booting will soon be a memory of the past – virtualization technology is becoming more and more popular.

So on with the show! Lets delete the windows partition and allocate that space to our nice ubuntu linux install. I love the fact that you never have to re-install linux to do such tasks.

Note: I always like to unplug or unmount all of my external drives to make sure I don’t accidentally select the wrong device

Lets grab a GUI tool (GParted)

sudo apt-get install gparted

From the command line lets run it

sudo gparted

A graphical interface will pop up showing you the partitions you have, as well as any unallocated space. (For me it looks like I might pick up an extra 5mb of unallocated space – sweet!)

I started off with an install of windows, so it’s taking up the first bit of my hard drive (/dev/sda1). And I should also note it contains a boot flag – which is important to booting into either my windows or linux operating systems when my computer starts. (If you don’t have a boot flag and proper boot loader, you wont be able to load anything when you turn on your system)

Select the windows partition (Mine is NTFS on /dev/sda1 with a boot flag)

Right click on the entry and “unmount” (if its not mounted, skip this)

Next right click and select DELETE! :)

Now click the Apply (along the top tool bar)

You should now have a large unallocated partition (or more accurately the size of your previous windows install). Great, things are feeling so much better.

Right click the unallocated disk space and select “new”

Select a file system of ext3 and create the partition as primary

Click apply

Depending on the size of the partition we just made, it may take a short while to format the new file system. Once that is completed we’re going to edit the boot menu that existed previously.

Open a terminal and type

sudo nano /boot/grub/menu.list

Towards the bottom of the text file you will see a windows entry similar to the following

# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/sda1
title        Windows Vista/Longhorn (loader)
root        (hd0,0)
chainloader    +1

Just delete that entry and save. (note if you changed the default boot sequence order, you may wish to set “default 0″ near the top of your menu.list)

Next we will mount the new partition to where we would like when the system starts.

sudo nano /etc/fstab

Add the following to the file (make sure the directory exists) – you can use any folder you wish, I like to keep “my” stuff in the /home directory

# /dev/sda1
/dev/sda1     /home/disk     ext3     defaults     0     0

If the directory is outside of your home (ie /home/username), you may need to change the permisions

sudo chown username.username disk/

Lets mount our new partition

sudo mount /dev/sda1 /home/disk

Excellent, all is good! we now have lots of extra space to add games, movies or whatever your heart desires!

Note: You may also want to add the boot flag to your linux partition mounted on / (if it didn’t have the boot flag to begin with). Just right click the partition entry in GParted and select manage flags (selecting “boot”)

When you restart your system everything should be A-OK. The new partition will automatically mount to the location you declared in the /etc/fstab file.

:, , ,
1 comment for this entry:
  1. Rahul

    Thanks a lot buddy.
    That was a very neat explanation.
    Being a novice in disk partitions, this really helped me.

Leave a Reply

You must be logged in to post a comment.

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...