- How to Remove Linux and Install Windows on Your Computer
- Summary
- More Information
- Examples of Linux Partition Tables
- Single SCSI drive
- Multiple SCSI drives
- Single IDE drive
- Multiple IDE drives
- Linux Developer Space
- Install Windows on a Separate Partition
- Boot into a Windows installation media and complete the installation
- Restore / Reinstall Grub 2 with a Ubuntu Live Media
- Reinstalling Grub in an EFI Based System
- 9 responses
- Leave a comment
- How to install Windows after installing and deleting Linux
- 3 Answers 3
How to Remove Linux and Install Windows on Your Computer
For a Microsoft Windows XP version of this article, see 314458.
Summary
This article describes how you can remove the Linux operating system from your computer, and install a Windows operating system. This article also assumes that Linux is already installed on the hard disk using Linux native and Linux swap partitions, which are incompatible with the Windows operating system, and that there is no free space left on the drive.
Windows and Linux can coexist on the same computer. For additional information, refer to your Linux documentation.
More Information
To install Windows on a system that has Linux installed when you want to remove Linux, you must manually delete the partitions used by the Linux operating system. The Windows-compatible partition can be created automatically during the installation of the Windows operating system.
IMPORTANT: Before you follow the steps in this article, verify that you have a bootable disk or bootable CD-ROM for the Linux operating system, because this process completely removes the Linux operating system installed on your computer. If you intend to restore the Linux operating system at a later date, verify that you also have a good backup of all the information stored on your computer. Also, you must have a full release version of the Windows operating system you want to install.
Linux file systems use a «superblock» at the beginning of a disk partition to identify the basic size, shape, and condition of the file system.
The Linux operating system is generally installed on partition type 83 (Linux native) or 82 (Linux swap). The Linux boot manager (LILO) can be configured to start from:
The hard disk Master Boot Record (MBR).
The root folder of the Linux partition.
The Fdisk tool included with Linux can be used to delete the partitions. (There are other utilities that work just as well, such as Fdisk from MS-DOS 5.0 and later, or you can delete the partitions during the installation process.) To remove Linux from your computer and install Windows:
Remove native, swap, and boot partitions used by Linux:
Start your computer with the Linux setup floppy disk, type fdisk at the command prompt, and then press ENTER.
NOTE: For help using the Fdisk tool, type m at the command prompt, and then press ENTER.
Type p at the command prompt, and then press ENTER to display partition information. The first item listed is hard disk 1, partition 1 information, and the second item listed is hard disk 1, partition 2 information.
Type d at the command prompt, and then press ENTER. You are then prompted for the partition number you want to delete. Type 1, and then press ENTER to delete partition number 1. Repeat this step until all the partitions have been deleted.
Type w, and then press ENTER to write this information to the partition table. Some error messages may be generated as information is written to the partition table, but they should not be significant at this point because the next step is to restart the computer and then install the new operating system.
Type q at the command prompt, and then press ENTER to quit the Fdisk tool.
Insert either a bootable floppy disk or a bootable CD-ROM for the Windows operating system on your computer, and then press CTRL+ALT+DELETE to restart your computer.
Install Windows. Follow the installation instructions for the Windows operating system you want to install on your computer. The installation process assists you with creating the appropriate partitions on your computer.
Examples of Linux Partition Tables
Single SCSI drive
Multiple SCSI drives
Single IDE drive
Multiple IDE drives
Also, Linux recognizes more than forty different partition types, such as:
FAT 16 > 32 M Primary (Type 06)
FAT 16 Extended (Type 05)
FAT 32 w/o LBA Primary (Type 0b)
FAT 32 w/LBA Primary (Type 0c)
FAT 16 w/LBA (Type 0e)
FAT 16 w/LBA Extended (Type 0f)
Note that there are other ways to remove the Linux operating system and install Windows than the one mentioned above. The preceding method is used in this article because the Linux operating system is already functioning and there is no more room on the hard disk. There are methods of changing partition sizes with software. Microsoft does not support Windows installed on partitions manipulated in this manner.
Another method of removing an operating system from the hard disk and installing a different operating system is to use an MS-DOS version 5.0 or later boot disk, a Windows 95 Startup disk, or a Windows 98 Startup disk that contains the Fdisk utility. Run the Fdisk utility. If you have multiple drives, there are 5 choices; use option 5 to select the hard disk that has the partition to be deleted. After that, or if you have only one hard disk, choose option 3 («Delete partition or logical DOS drive»), and then choose option 4 («Delete non-DOS partition»). You should then see the non-DOS partitions you want to delete. Typically, the Linux operating system has two non-DOS partitions, but there may be more. After you delete one partition, use the same steps to delete any other appropriate non-DOS partitions.
After the partitions are deleted, you can create partitions and install the operating system you want. You can only create one primary partition and an extended partition with multiple logical drives by using Fdisk from MS-DOS version 5.0 and later, Windows 95, and Windows 98. The maximum FAT16 primary partition size is 2 gigabytes (GB). The largest FAT16 logical drive size is 2 GB. For additional information, click the article number below to view the article in the Microsoft Knowledge Base:
105074 MS-DOS 6.2 Partitioning Questions and Answers
If you are installing Windows NT 4.0 or Windows 2000, the Linux partitions can be removed and new partitions created and formatted with the appropriate file system type during the installation process. Windows allows you to create more than one primary partition. The largest partition that Windows NT 4.0 allows you to create during installation is 4 GB because of the limitations of the FAT16 file system during installation. Also, the 4-GB partitions use 64-KB cluster sizes. MS-DOS 6.x and Windows 95 or Windows 98 do not recognize 64-KB cluster file systems, so this file system is usually converted to NTFS during installation. Windows 2000, unlike Windows NT 4.0, recognizes the FAT32 file system. During the installation of Windows 2000, you can create a very large FAT32 drive. The FAT32 drive can be converted to NTFS after the installation has completed if appropriate.
Linux Developer Space
October 11, 2017
As you know, the most common, and probably the most recommended way of dual booting Ubuntu and Windows is to install Windows first and then Ubuntu. But what if you want to install Windows second on a computer with Ubuntu/Linux already installed?
This guide assumes that you have Ubuntu already installed on your system, and will guide you through installing Windows 7/8/8.1/10 when you have a working Ubuntu/Linux partition.
The problem here is that the Windows installer tends to overwrite Grub bootloader or whatever making only the Windows installation bootable. But the good news is that your Linux partition is untouched, including the original bootloader and the other Grub configurations. So restoring or recovering Grub is just a matter of running a few commands on the terminal.
Install Windows on a Separate Partition
If your Ubuntu installation occupies the entire hard drive, to be able to create free space for the Windows installation, you may have to shrink an existing partition using a disk utility like GParted. GParted comes preinstalled on Ubuntu LiveCD.
Boot into a Windows installation media and complete the installation
Once installed, because of Microsoft’s false assumption that there are no non-Microsoft operating systems you’ll be taken straight into Windows.
Restore / Reinstall Grub 2 with a Ubuntu Live Media
- Now boot into a Ubuntu Live/USB or CD.
- Open a terminal. (Ctrl + Alt + t)
- Use a command like lsblk, blkid or GParted to identify your Linux root, and boot partitions. You may or may not have a separate boot partition.
Find Linux Partitions
/dev/sda1 is the Linux boot partition
/dev/sda2 is the Linux root partition
/dev/sda3 is the Windows partition
Setup a Chroot Environment
Now we’ll be repairing our old grub bootloader in a chroot environment.
Mount your root filesystem under /mnt
If you’re using BTRFS (New Linux B-Tree File System) instead of EXT4, the above command should change to sudo mount -t btrfs -o subvol=@ /dev/sda2 /mnt/
Run ls /mnt to verify that the correct partition is mounted. It should list the content of your root.
Mount the boot partition. (SKIP if you don’t have a separate boot partition)
If you have an EFI partition you should mount that also. It is basically a small FAT32 partition around 100mb. Please refer to the section on how to reinstall Grub in an EFI system.
Bind these directories, so grub can detect other operating systems, like so.
Let’s chroot into our existing Ubuntu/Linux system on the hard disk.
Once you’ve successfully reinstalled Grub, restart the computer. On next reboot Grub will be the default bootloader and you’ll be presented with a list of operating systems to choose from (Ubuntu and Windows, of course).
Reinstalling Grub in an EFI Based System
Reinstalling Grub bootloader in a UEFI based computer is no different from installing Grub on a legacy BIOS system. Here we also mount the EFI partition before chrooting, as we’d do with the boot partition.
Case #2
Here /dev/sda1 is the EFI partition and /dev/sda2 is the root.
Mount EFI partition under ‘/mnt/boot/efi’
Forgetting to do so will result in errors being thrown while trying to execute grub-install: “/boot/efi does not appear to be the EFI partition”
As shown previously, bind the /dev , /dev/pts , /proc , and /sys directories.
In some rare occasions, Grub might not detect Windows. In that case just login to Ubuntu (installed one on the disk, not the bootable Live USB/CD) and execute,
9 responses
Just wanted to give you a heads up. I recently followed your guide for repairing Grub after installing windows but wanted to let you know I had to deviate due to a typo I noticed. I worried someone else might make a catastrophic mistake if they didn’t notice so I’m letting you know.
In the section about Reinstalling Grub in an EFI based system, the example under “Mount EFI partition under ‘/mnt/boot/efi’” says to mount /dev/sda2, when I believe it should actually be /dev/sda1, according to your system layout shown earlier.
It’s possible I’m wrong, I’m not extremely well versed, but changing it worked for me and it looks like following the guide to the tee would result in installing Grub in the wrong partition.
Kane – June 19th, 2019
Thanks for the heads up. I fixed the typo that you pointed out.
Gayan Weerakutti – June 20th, 2019
I need your help. I have both Linux mint and Ubuntu installed on my system. I had Windows 8.1 before and I tried dual booting with Linux mint, I failed so I ended up with just Linux mint because i really wanted it. I installed Ubuntu later on, but I don’t like it.
The problem now is that there are applications I need to use which only support windows. I want to reinstall windows 8.1 on the Ubuntu partition but I keep getting error 0xc000000f. I do not mind doing a clean install of windows and dual boot later, but I’m stuck with that error. Please help.
Bongi – December 15th, 2019
It’s hard to tell without knowing the exact error, your partition scheme, when and how you got it. But what I’d do is to install GParted on Linux Mint. Then would create, and format partitions as necessary to install Windows. Find out if you’re currently using BIOS or UEFI. Boot into your Windows installation media in the same boot mood. Then would follow this article to recover Grub.
Gayan Weerakutti – December 15th, 2019
Thanks for the how-to. Worked like a charm.
MJ Patterson – February 12th, 2020
This has been so helpful for me ! Thanks a lot
Anonymous Coward – April 19th, 2020
Hi, In the case of a separate /home partition, should we also mount it? Thanks, Nivs
Nivs – May 2nd, 2020
Not it’s not necessary to mount a /home partition or any other partition that is not mentioned in the post.
Gayan Weerakutti – May 2nd, 2020
Hi, have very little knowledge but a new laptop came with ubuntu installed I would like windows 10 which I have just purchased but it does not install saying unable to use this file type? I cannot create a suitable partition for the install any ideas please?
Pete – May 16th, 2020
Leave a comment
© 2021 Gayan Weerakutti, unless otherwise noted.
How to install Windows after installing and deleting Linux
After installing Linux Mint I formatted my HDD (using the bootable usb linux mint’s partition manager Gparted) (ntfs formatted). The reason was that I want to install windows. I have my bootable windows usb which booted up fine before installing linux mint. The error that I get now is something like: SYSLINUX . Copyright Peter.
So in other words, I can’t get the windows installer to boot up after installing Linux Mint and after deleting it by formatting it to ntfs.
3 Answers 3
Seems like you are still booting from the hard drive and not starting the windows dvd. You have to change boot priority of the dvd drive (or usb drive in case you want to install from that) to be before the hard disk in the bios/uefi.
You just have to do a fresh install like normally, give priority to USB drive from BIOS or . After that format all the hdd, cancel all the possible partitions found and start the installation. The actual OS that is on HDD doesn’t really matter if you format the hdd
Since this question already has multiple answers and they all point to the same thing, here’s a generic guide to change boot device priority:
- Get into your BIOS. This is usually done by pressing DEL key repeatedly right after the unit starts. If that does not work, try f2 or TAB key, though you can usually read it as it flashes quickly on the screen.
- Navigate using your arrow keys. Go to your boot settings/menu.
- Look for a list of boot devices. This may be inside of a menu option or it may be shown up front.
- Change boot order. It might be by numbering, or might be tabbing or using arrow keys, or using f5/f6 (Phoenix on laptops). Place flash drive on top of the list, or above the hard disk drive (whichever you prefer). In case of numbering, give the flash drive a higher priority than the hard disk.
- Boot up and do your thing. Install/Delete OS’es, or just booting from an external device. Your call.
tl;dr. If this does not help, a quick search of your BIOS manufacturer and version should give more info.