Allocating an Existing Windows Partition to Ubuntu 11.04

From Techotopia
Revision as of 13:45, 29 June 2011 by Neil (Talk | contribs)

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


<google>BUY_UBUNTU_11</google>


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 11.04 on a Windows System (Dual booting).

This chapter is intended for users who took this particular approach and 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.


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. 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, click on the Applications button on the task management panel (the magnifying glass containing the + sign) and enter gparted into the Search Applications field of the resulting panel. If the GNU Partition Editor is shown in the Apps Available for download section it will need to be installed on the system. Click on the icon and wait for the software center to load and update with the GParted package information:


Installing GParted on Ubuntu 11.04 using the software center tool


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, press Ctrl-Alt-T. 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:

sudo 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 the partition tool open a terminal window (Ctrl-Alt-T) 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 11.04


The Windows partitions can be identified by the file system type. In this case the file systems are of type NTFS (which corresponds to /dev/sda1 and /dev/sda2). A FAT or FAT32 file system also indicates a Windows partition. The ext4 (/dev/sda5) and linux-swap (/dev/sda6) partitions are our current Linux partition and operating system swap space respectively. 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. 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 each partition in the list and select Delete from the resulting menu. The deletion tasks will be listed as Pending. To commit the changes, click on the button displaying the green check mark in the GParted toolbar.

Once the deletion is complete the former Windows partitions will be listed as unallocated. This space 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:


The Ubuntu 11.04 gparted new partition dialog


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 11.04 gparted file system creation 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.38-8-generic
Found initrd image: /boot/initrd.img-2.6.38-8-generic
Found memtest86+ image: /boot/memtest86+.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              23G  172M   22G   1% /vol1

The new file system is now ready for use.


<google>BUY_UBUNTU_11_BOTTOM</google>



PreviousTable of ContentsNext
Installing Ubuntu 11.04 on a Windows Disk with WubiConfiguring Ubuntu 11.04 Wireless Networking