Accidentally deleted Windows after installing Linux
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Accidentally deleted Windows after installing Linux
Hello all,
My goal was to dual-boot Windows and Linux but I realize that I might have accidentally deleted Windows after installing Linux (Lubuntu), and below is the output when I enter
3 would need to be shrunk to have room for two OSes. You should start from scratch, possibly keeping 1 & 4 only or 1, 2 & 4 only, and ensuring Windows does not use the whole disk or remainder, but only as much of it as you choose. You can use any live Linux disk to fdisk in advance instead of leaving it all up to the Windows installation partitioner, or use a Gparted or other bootable partitioner media. Alternatively to installing Windows first, reinstall Lubuntu to a smaller partition, leaving room for Windows to follow in remaining space. With UEFI and GPT, it's not important which to do first, but to boot from Linux after installing Windows will require a minimal amount of effort to restore Linux to boot control, as simple as a BIOS change, or learning your BBS hotkey and using it.
Another alternative is to try the legacy OS inside a virtual machine. Qemu and VirtualBox are available. That way once you get the legacy system installed, updated, and configured you can take a snapshot of the image and use that as your starting point each time you fire it up. That will come in handy to prevent it from going bad either from malware (which will be an issue) or through so-called bit rot. So I'd give a virtual machine a try before any major attempts at reinstallation.
don't forget windows will overwrite the boot loader, so linux should be repaired afterward (I mean grub should be reinstalled again). But if it was a fresh new install then start over, delete everything, install windows, leave space for linux and install linux at the end.
don't forget windows will overwrite the boot loader, so linux should be repaired afterward (I mean grub should be reinstalled again).
Overwrite bootloader is false, and reinstall Grub is an obsolete instruction, in UEFI environments. UEFI Windows installation changes nothing that Linux writes to any disk or filesystem. There is no code written to MBR in a UEFI system. The MBR on a UEFI system is not directly involved in booting. The only exception to the need to reinstall Grub occurs if you let Windows create a new ESP or format the existing ESP.
The boot initiator is the UEFI BIOS, by loading a boot file from a VFAT filesystem, and it is the system/BIOS NVRAM that specifies which directory on the ESP filesystem to load an EFI boot file from. It is only upon loading the appropriate boot file from a directory created by Linux, which Windows won't touch, that Grub will be loaded from a Linux filesystem that Windows can't read or write. Windows never touches Grub on a UEFI system. After Windows installation, the only "repair" required is implemented via UEFI BIOS setup by moving a Linux entry back to the top of the boot priority list. Alternatively, this so-called "repair" can also be made by running efibootmgr from any UEFI Linux boot.
Overwrite bootloader is false, and reinstall Grub is an obsolete instruction, in UEFI environments. UEFI Windows installation changes nothing that Linux writes to any disk or filesystem. There is no code written to MBR in a UEFI system. The MBR on a UEFI system is not directly involved in booting. The only exception to the need to reinstall Grub occurs if you let Windows create a new ESP or format the existing ESP
Yes, you are right. It is only a problem with MBR, and not an issue with UEFI. And Windows came with UEFI. Just linux can be still installed with MBR.
Had you looked at the disk partitioning before installing linux you would have seen exactly what you see now, but partition 3 would have been the windows OS partition.
In general, when dual booting with windows already installed you only need to use windows to shrink the main OS partition by the size you want for the linux install then install linux into the now unallocated space, allowing it to use the existing efi partition.
If you do not have install media for windows it can be easily downloaded. A quick search for 'download windows install iso' will give you a lot of links, but direct from microsoft is best.
I would first reinstall windows on that drive, then after windows is reinstalled and set up, follow the tutorials or the general instructions above to reinstall linux as dual boot.
Last edited by computersavvy; 12-19-2022 at 11:47 AM.
Yes, you are right. It is only a problem with MBR, and not an issue with UEFI. And Windows came with UEFI. Just linux can be still installed with MBR.
To be precise, both CAN be installed MBR: for Windows it takes jumping through some hoops, less so for Linux. I dislike using UEFI, but it does have some significant advantages and in particular when multi-booting EFI compliant operating systems.
If possible, download the OEM OS image form your hardware provider if you had the OEM version of Windows. It may have the OEM key already included, and if not then your old key should work assuming you retained a copy.
If possible, download the OEM OS image form your hardware provider if you had the OEM version of Windows. It may have the OEM key already included, and if not then your old key should work assuming you retained a copy.
Once a PC with an OEM Windows version has had Windows validated, the PC is in Windows' database indefinitely, and the original key and active validation are not required when Windows gets reinstalled. In this situation, Windows gets activated automatically when it first contacts mommy. Unless the situation changed since I last needed to use it, a retail version of Windows may be transferred to a replacement PC, unlike OEM versions, so on installation to a replacement PC, activation is required using the original retail key.
I'm chiming in late so you may have already done whatever but when I was new always just started over from scratch... so many times! LL
We can install microcoughed\windows use it to shrink its own partition and then install GNU\Linux, easy peasy or the Linux installer can shrink windows for us.
I realize that I am jumping in late, but the recovery from the initial error is very simple.
1. reinstall windows and tell it to use the entire disk as done previously. Install it in UEFI mode as was originally done.
2. After booting and configuring windows from within windows use the disk manager to shrink the windows file system and leave enough unallocated space to install linux.
3. install linux into the open space left with step 2 above. Use uefi mode and it will use the existing EFI partition and share it with windows.
These steps are the normal steps given in 90+% of the online tutorials for a dual boot install. Almost all linux distros will configure the boot loader for dual boot if these steps are followed.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.