How to remove Windows after installing Trisquel GNU/Linux in dual boot?

This guide is designed primarily for users who have a dual boot that now want to fully escape Windows and go purely with Trisquel GNU/Linux.

Prerequisites

  1. A Trisquel GNU/Linux LiveCD or GParted LiveCD.
  2. Basic knowledge on Disk Partitioning.
  3. Experience editing with a text editor such as gedit or nano.
Important!
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.

1. 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.

2. Run GParted and Locate Windows.

On the Trisquel GNU/Linux LiveCD, go to Main Menu (Trisquel) -> System Settings -> GParted.

Instead

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.

3. 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.

Instead

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 Apply All Operations button to start the pending deletion operations.

Instead

4. 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 Apply All Operations in the GParted window. 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 Trisquel GNU/Linux installation lives on the extended partition, you will not be able to expand the main Linux partition into the space created by deleting the Windows partition. One solution is to

    1. Create a new partition using the space left by the deleted primary partition. (see Creating a New Partition below.)
    2. 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.)
    3. 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 Apply All Operations.) (Had it been possible, resizing the old partition would also have involved copying and would have taken just as long.)
    4. Reinstall GRUB2 to the new partition. (See Here.)
    5. 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 and choose New). 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.

5. Edit GRUB.

Once back in your install, you will probably want to remove Windows from your GRUB2 menu. Using root privileges and your favorite text editor or terminal interface, open /boot/grub/grub.cfg.

1. Using gedit.
gksudo gedit /boot/grub/grub.cfg

2. Using a terminal interface.
sudo nano /boot/grub/grub.cfg

Now scroll down into the file to where it says something similar to

### BEGIN /etc/grub.d/30_os-prober ###
menuentry 'Windows Recovery Environment (loader) (on /dev/sda3)' --class windows --class os $menuentry_id_option 'osprober-chain-E261-3734' {
        insmod part_gpt
        insmod fat
        set root='hd0,gpt3'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt3 --hint-efi=hd0,gpt3 --hint-baremetal=ahci0,gpt3  E261-3734
        else
          search --no-floppy --fs-uuid --set=root E261-3734
        fi
        drivemap -s (hd0) ${root}
        chainloader +1
}
menuentry 'Windows 8 (loader) (on /dev/sda5)' --class windows --class os $menuentry_id_option 'osprober-chain-40FA653EFA6530F8' {
        insmod part_gpt
        insmod ntfs
        set root='hd0,gpt5'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt5 --hint-efi=hd0,gpt5 --hint-baremetal=ahci0,gpt5  40FA653EFA6530F8
        else
          search --no-floppy --fs-uuid --set=root 40FA653EFA6530F8
        fi
        drivemap -s (hd0) ${root}
        chainloader +1
}
### END /etc/grub.d/30_os-prober ###

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.

6. Edit /etc/fstab.

If you made a data partition, you can have it automatically mount by adding the correct entry to fstab, which you can edit using root privileges.

1. Using gedit.
gksudo gedit /etc/fstab

2. Using a terminal interface.
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, Open a terminal and enter:
sudo blkid

To mount your data partition automatically, assuming it is of type ext4, edit /etc/fstab as:
UUID=30fcb748-ad1e-4228-af2f-951e8e7b56df /media/data ext4 defaults 0 2

Replace 30fcb748-ad1e-4228-af2f-951e8e7b56df with corresponding UUID of the data partition obtained running sudo blkid and /media/data with your favourite mount point.

You may refer the manpages for more information on fstab. Open a terminal and enter: 
man fstab

7. Reboot.

You can now reboot your system - go to Main Menu (Trisquel) -> Power Off -> 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 Trisquel GNU/Linux from it.

Happy Hacking!

© Contributors to the Ubuntu documentation wiki.
The material on this wikipage is released under the Creative Commons Attribution-ShareAlike 3.0 License.
AttachmentSize
Screenshot from 2015-10-21 05_57_20.png120.24 KB
Screenshot from 2015-10-21 07_35_49.png56.62 KB
Screenshot from 2015-10-21 07_47_36.png64.19 KB

Revisions

11/24/2015 - 17:29
lap4fsf