Allocating a Windows Partition to Ubuntu 10.x

From Techotopia
Jump to: navigation, search
PreviousTable of ContentsNext
Installing Ubuntu 10.x on a Windows Disk with WubiLogging into the Ubuntu 10.x GNOME Desktop

One of the most common configurations for a new Ubuntu installation involves reducing the size of the pre-existing Windows partition on the disk drive and using the resulting space to install Ubuntu. 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 Installing Ubuntu on a Windows System (Dual booting).

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, therefore, we will work through this process step by step.




Deleting the Windows Partition from the Disk

The first step in freeing up the Windows partition for use by Linux is to delete it. The Ubuntu distribution includes a tool called GParted which is a graphical disk partitioning tool. This tool is not, however, typically installed by default. The tool may be installed either from the command prompt in a terminal window or using the Ubuntu Software Center.

To install using the Ubuntu Software Center, select the Applications -> Ubuntu Software Center desktop menu. The software center application will subsequently load and appear as outlined in the following figure:


The Ubuntu 10.10 Software Center


In the search text box, type in GParted. Once entered, the tool should appear in the list of results in the main panel of the software center window as the Gnome Partition Editor. Once selected, an install button will appear next to the package:


Installing gparted on Ubuntu 10.10


Click on the Install button to initiate the installation process, enter your password if prompted to do so, and wait for the installation to complete. Once the GParted tool is installed, exit from the software center application.

An alternative to installing applications and packages using the software center tool is to use the apt-get command-line tool. These commands may be issued from within a Terminal session. To open a terminal window, select the Applications -> Accessories -> Terminal desktop menu option. The terminal window will appear and present a prompt at which commands may be entered. Since the installation of software requires administrative privileges, the command to install the Gparted tool must be pre-fixed with the sudo command as follows:

sudu apt-get install gparted

The apt-get tool will check to see that a package matching the name specified is available, identify any package dependencies and then prompt for confirmation that the installation is to be performed. Enter Y to initiate the installation.

To invoke GParted either select the System -> Administration -> Gnome Partition Editor menu option, or open a terminal window (Applications -> Accessories -> Terminal) and enter the following command:

sudo gparted

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


GParted running on Ubuntu 10.10


The Windows partitions can be identified by the file system type. In this case the file system is of type NTFS (which corresponds to /dev/sda1 and /dev/sda2). A FAT file system also indicates a Windows partition. The ext4 (/dev/sda5) partition is our current Linux partition. We are now going to delete the Windows partitions, but first need to unmount them. To do so, right click on the Windows partitions (in this example the partition represented by /dev/sda1 and /dev/sda2), either in the list or in the graphical representation of the partitions and select unmount. The partition will be unmounted and a mount point will no longer be shown next to the partition in the list. If the unmount option is not selectable then the partition is not currently mounted.

The next step is to delete the partitions. Once again, right click on the partitions in the list and select Delete. The delete tasks will be listed as Pending. To commit the changes, click on button with the green check mark in the GParted toolbar.

Once the deletion is complete the former Windows partitions 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 the current version of Ubuntu uses the ext4 file system format. This is a powerful file system format that 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 New from the menu to display the Create new partition window:


Creating a new Ubuntu disk partition


Within this dialog, make sure that the File system: option is set to ext4 and click on the Add button. At this point the task has not yet been performed and is instead it is listed as a pending operation and appears in a list at the bottom of the GParted window.

To perform the operation click on the green checkmark button located in the toolbar, and 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:

Ubuntu 10.10 new partition creation in progress


The schematic diagram of the disk partition layout should now list the former Windows partition as being an ext4 partition. At this point it is now safe to exit from the GParted tool.


Updating the Boot Menu

The next step is to update the boot menu. Since this was originally a dual boot system, the menu was 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. Previous versions of Ubuntu required the manual alteration of a configuration file. With more recent Ubuntu releases, however, this task can be performed automatically in a terminal window by issuing the following command:

sudo update-grub
[sudo] password for demo:

Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.35-19-generic
Found initrd image: /boot/initrd.img-2.6.35-19-generic
Found memtest86+ image: /boot/memtest86+.bin
Found memtest86+ multiboot image: /boot/memtest86+_multiboot.bin
done

The update-grub command scans the partitions on any connected hard disks and identifies any boot images for which an entry must be included in the boot menu. The /boot/grub/grub.conf file is then updated to reflect the latest configuration. In the above example output the update command found a number of Linux images but was no longer able to locate the Windows images. As a result the Windows boot option is not included in the generated configuration file.

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/sda1 /vol1 ext4 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/sda1              13G  160M   12G   2% /vol1

The new file system is now ready for use.

Purchase and download the fully updated Ubuntu 11.04 version of this eBook in PDF & ePub formats for only $12.99
PDF/ePub version contains 39 chapters and over 250 pages.

Buy eBook



PreviousTable of ContentsNext
Installing Ubuntu 10.x on a Windows Disk with WubiLogging into the Ubuntu 10.x GNOME Desktop