Allocating a Windows Partition to Ubuntu Linux

From Techotopia
Revision as of 18:16, 11 May 2009 by Neil (Talk | contribs)

Jump to: navigation, search
PreviousTable of ContentsNext
Installing Ubuntu on a Windows Disk with WubiConfiguring Ubuntu Linux Wireless Networking


<google>BUY_UBUNTU</google>


One of the most common configurations for a new Ubuntu Linux installation involves reducing the size of the pre-existing Windows partition on the disk drive and using the resulting space to install Ubuntu Linux. This so called "dual boot" configuration allows the user to have both operating systems installed on the disk drive with the option to boot one or the other when the system is powered on. Performing this type of installation was covered in the Installing Ubuntu Linux on a Windows System (Dual booting) chapter of this book.

This chapter is intended for users who have decided they like Ubuntu enough to delete Windows entirely from the disk, and use the resulting space for Linux. In this chapter we will work through this process step by step.


Contents


Deleting the Windows Partition from the Disk

The first step in freeing up the Windows partition for use by Linux is to delete it. Ubuntu Linux ships with a tool called GParted which is a graphical disk partitioning tool. To invoke GParted, open a terminal window (Applications->Accessories->Terminal) and enter the following command:

sudo gparted

Enter your password when prompted to do so and wait for the GParted application to load:

Ubuntu linux gparted main.jpg

The Windows partition can be identified by the filesystem type. In this case the filesystem is of type NTFS (which corresponds to hda1). A FAT filesystem also indicates a Windows partition. The ext3 partition is our current Linux partition. We are now going to delete the Windows partition, but first need to unmount the partition. To do so, right click on the partition, either in the list or in the graphical representation of the partitions and select unmount. Enter your password if prompted to do so. The partition will be unmounted and a mount point will no longer be shown next to the partition in the list.

The next step is to delete the partition. Once again, right click on the partition in the list and select Delete. The delete task will be listed as Pending. To commit the change, click on Apply in the GParted toolbar.

Once the deletion is complete the former Windows Partition will be listed as unallocated. This is now ready for us to use as a Linux partition.

Formatting the Unallocated Disk Partition

The next step is to format the partition so that it can be used by Linux. By default Ubuntu Linux uses the ext3 filesystem format. This is a powerful filesystem format which supports features such as disk journaling which is useful for restoring damaged data.

To format the unallocated partition, right click on the partition and select Format To from the menu. A sub-menu will subsequently appear listing the various format options available. Select ext3 from this menu. At this point the format task has not yet been performed. Instead it is listed as a pending operation and appears in a list at the bottom of the GParted window.

To perform the format operation, click on the Apply button located in the toolbar and then once again in the confirmation dialog. The progress of the formatting and file system creation operation will be displayed in the Applying Pending Operations dialog as shown in the following figure: <google>ADSDAQBOX_FLOW</google>

Formatting a partition using GParted


Editing the Boot Menu

The next step is to modify the boot menu. Since this was originally a dual boot system, the menu is configured to provide the option of booting either Windows or Linux. Now that the Windows partition is gone, we need to remove this boot option. This is achieved by opening a Terminal window (Applications->Accessories->Terminal) and performing the following steps:

sudo gedit /boot/grub/menu.lst

Towards the bottom of the menu.lst file you will see a section similar to:

# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/hda1
title           Microsoft Windows XP Home Edition
root            (hd0,0)
savedefault
makeactive
chainloader     +1

Delete this section from the file, save it and exit from gedit.

Mounting the New Partition

Finally, we need to mount the new partition. In this example we will mount it in a directory called vol1. You are free, however, to mount the new partition using any valid mount point you desire. First we need to create the directory to act as the mount point:

sudo mkdir /vol1

Secondly, we need to edit the mount table so that the partition is automatically mounted each time system starts:

sudo gedit /etc/fstab

At the bottom of the /etc/fstab file, add the following line to mount the new partition:

/dev/hda1 /vol1 ext3 defaults 0 0

Finally, we can manually mount the new partition (note that on subsequent reboots this will not be necessary as the partition will automount as a result of the setting we added to the /etc/fstab file above).

sudo mount /vol1

To check the partition, try running the following command to display the available space:

df -h /vol1

You should see output similar to:

Filesystem            Size  Used Avail Use% Mounted on
/dev/hda1             7.9G  147M  7.4G   2% /vol1

The new file system is now ready for use.


<google>BUY_UBUNTU_BOTTOM</google>