Before you Start
Before you start fiddling with your partitions, you should make sure that you have ALL IMPORTANT data backed up, preferably on a secondary hard drive (internal or external), a USB flash drive, or a CD-R or DVD-R. Although it is not common for problems to happen during the partitioning process, it is still possible. Actually, the primary cause of data loss is you! Users sometimes get confused and end up deleting the wrong partition, or just forget to backup their family photos and favorite music before they delete partitions. If at any point during this process you get confused or concerned, STOP and ask for help. The best place for this is the Ubuntu Forums.
This guide is designed primarily for users who have a dual boot that now want to fully escape Windows and go purely Ubuntu.
OS-Uninstaller Graphical Tool
A simple way to remove Windows (or any OS) is to use this little graphical tool: OS-Uninstaller.
Alternative: via gParted and GRUB update
Please note that although you can install GParted inside your Ubuntu installation, you will be unable to resize your root partition without a LiveCD since you cannot change a partition that is mounted.
Boot the Disc
Place the LiveCD into your CD/DVD drive, and reboot the computer. Each computer is different, but you may need to change your BIOS to have the system boot from the CD drive before the hard disk. Refer to your computer manufacturer's documentation for this.
Run GParted and Locate Windows
On the Ubuntu LiveCD, go to System -> Administration -> Partition Editor. If you have more than one hard drive on your computer, choose the correct device from the drop down box in the upper right hand corner of the window. Your windows partition will most likely be formatted as NTFS and have a boot flag, which makes it easy to locate. Again, if you are unsure, don't delete it!
For more details on partitioning, see HowtoPartition and its subpages.
Deleting the Windows Partition
Select the correct partition, either from the bar graph representation of your disk, or from the list, and press the Delete button at the top with the trash can icon, or right-click the partition from the list and choose Delete. Note that a Windows installation might use more than one partition; for example, Windows preinstalled on an Acer desktop might have a "hidden" (but not to GParted) recovery partition, a partition named "SYSTEM RESERVED", and one named "eMachines". In this case, you'll have to select them all for deletion. Now if you are sure that you want to proceed, click the Edit -> Apply button to start the pending deletion operations.
Use the Newly Freed Space
After the deletion operation completes, you'll have a section of unallocated space. Now, you can either format it as the filesystem type of your choice to use as a data partition (or something else), or you can resize an adjacent partition to use this space.
Resizing an Existing Partition
Right-click the partition that you want to expand into the empty space and select Resize/Move. You can use either the number sizing, or you can graphically drag the arrows on the visualization into the empty space (the numbers will adjust automatically). When you are finished, click the Resize/Move button, then Edit -> Apply in the GParted window. Again, read the prompt and click Edit -> Apply. The operation may take awhile, depending on the size of the partition, but DO NOT interrupt this process, or you risk losing everything on the partition you are resizing.
If your Linux installation lives on the extended partition (see HowtoPartition/OperatingSystemsAndPartitions), you will not be able to expand the main Linux partition into the space created by deleting the Windows partition. One solution is to
- create a new partition using the space left by the deleted primary partition (see Creating a New Partition below),
- if the new partition is smaller than the main Linux partition, resize the latter to fit the former (but only if the latter is not so full that data would be lost),
copy the data of the old partition to the new one (click on the old partition; Ctrl-C; click on the new partition; Ctrl-V; click Edit -> Apply) (had it been possible, resizing the old partition would also have involved copying and would have taken just as long),
reinstall GRUB2 to the new partition (see Grub2#Reinstalling GRUB2), and
- boot into the new partition (see Reboot below) and make sure everything works as normal.
Once you're satisfied that this operation succeeded, use GParted again to delete the old partition and to create a new one in its place, or to expand the new main partition, or to just leave the unused disk space as it is, to be used later.
Creating a New Partition
If you choose to simply use the newly freed space as a new partition, select the unallocated space and click the New button (or right-click). Choose which filesystem you want, then click Add, then Apply, and Apply again.
Since you are not using Windows on this system anymore, ext4 is probably the best choice for your new filesystem. If you plan on sharing this drive with Windows (maybe you have Windows on another drive on this computer), NTFS or FAT32 would be better choices.
Once back in your install, you will probably want to remove Windows from your GRUB2 menu. Using root privileges and your favorite text editor, open /boot/grub/grub.cfg
In Ubuntu, run:
gksudo gedit /boot/grub/grub.cfg
In Kubuntu, run:
kdesu kate /boot/grub/grub.cfg
Or for a terminal interface, run:
sudo nano /boot/grub/grub.cfg
Now scroll down into the file to where it says something similar to
### END DEBIAN AUTOMAGIC KERNELS LIST # This is a divider, added to separate the menu items below from the Debian # ones. title Other operating systems: root # This entry automatically added by the Debian installer for a non-linux OS # on /dev/sda1 title Microsoft Windows XP Professional root (hd0,0) savedefault makeactive chainloader +1
You can place a # in front of each line to "comment out" these entries. If you are comfortable with deleting the entries, you can also do that. After you you save and close, these entries will no longer be available at the GRUB menu.
In Ubuntu, run:
gksudo gedit /etc/fstab
In Kubuntu, run:
kdesu kate /etc/fstab
Or for a terminal interface, run:
sudo nano /etc/fstab
You may also need to change UUIDs in your fstab file if they changed (perhaps due to partition resizing). To see the UUIDs for your partitions, run one of these two commands:
sudo blkid sudo ls -l /dev/disk/by-uuid
For more information regarding fstab, see Fstab.
You can now reboot your system - go to System -> Quit -> Restart. Don't forget to take out the LiveCD at the beginning of the boot sequence since you can't remove it while the disc is being used and you don't want to reload Ubuntu from it.