How to Restore Your Entire Windows OS and Still Keep Everything Intact When All Else Fails

How to Restore Your Entire Windows OS and Still Keep Everything Intact When All Else Fails

In this tutorial, I will detail the most unorthodox way to restore your entire Windows OS (including installed programs and settings) when you have exhausted all other options.

The Backstory

You can skip ahead if you want to get straight to the instructions, but basically, I had an old Windows 10 Enterprise installation on a laptop that worked perfectly fine, but Shannon‘s laptop’s trackpad had completely stopped working, so I switched out the hard drives with one of my laptops to give her a “new” one, but now I was stuck with a laptop with a broken trackpad. So I had really nice unused laptop running Ubuntu on an M.2 with room for a 2.5″ SSD, but my Windows install was on mSATA. So I started looking into my options…


Restore from System Image?

This seemed like the most likely choice. I hooked up a 4TB external USB3 NTFS drive and went to Control Panel > Backup and Restore (Windows 7) > Create a system image, and got to work. Boom. Success. Then I booted the new laptop from a recovery USB and selected the “Restore from System Image” option. Well, as it turns out, the new laptop was booting from UEFI, and the old laptop was booting from legacy BIOS, and apparently you cannot restore a legacy BIOS image on a UEFI laptop.

The smartest thing to do at this point would have been to go into the BIOS on the new laptop and enable legacy boot, but alas, this was not an option, because for reasons untold, I lacked access to the BIOS on the new computer at that point in time. However…I did have access to the BIOS on the old computer, so why not just enable UEFI and create a system image from there, right? Right? Not so easy. For me at least.

I did a bunch of stupid things to try and get my computer to boot from UEFI, which included completely obliterating my MBR along the way, and long story short[er], I straight-up deleted my system partitions and a whole bunch of other stuff that an experienced person such as myself should have never done, thinking I could recreate things the way they should be.

So as it turns out, I was able to create a UEFI boot file on my C:\ drive, but the only way to get the old laptop to boot at all at this point was to hit F9 on startup and manually navigate to bootx64.efi (which allowed me to boot into the OS just fine). So at this point I’m thinking this computer is about to be running Arch Linux or something anyway, and all I need to do is migrate this damn OS, so if it doesn’t boot and the new computer has a fresh Windows installation, then whatever. So I navigate back to the Create a system image option and tried to create an OS image to restore now that I was booted via UEFI. No such luck. I kept getting an obscure Volume Shadow Copy error that I Googled for hours trying to resolve and trying everything in the book, but again, no such luck. I even tried the EaseUs backup utility thing, but even that was failing me.


I started to lose it…

I thought to myself, “okay, well maybe I should cut my losses,” so I decided I would just refresh Windows. Keep in mind, there are no System Restore points, no going back to a previous build, all of my options were looking to be exhausted at this point. I actually threw up my hands at one point and decided that if I couldn’t keep my installed programs, I could at least keep my files, so I chose to reinstall Windows keeping my previous files. It failed. Apparently that requires booting straight into Windows at some point, and since I could only manually boot via UEFI, it was either booting straight back into Windows thinking nothing had happened, or I was having to boot to the recovery USB, which also thought nothing had happened, leaving me right where I started. So I started freaking out. At this point, I was just wanting to be back where I started with a messed up trackpad, but I had managed to wedge myself into a tight spot.

Where the hell do I go from here?

If you have read this far, you are either laughing at my stupidity, or you have found yourself in the same situation and exhausted all of your options. And yes, I tried multiple USBs, and yes they were USB2 and not USB3, and for the love of God, I tried every possible version of the following:

bootrec /fixmbr
bootrec /fixboot
bootrec /scanos
bootrec /rebuildbcd

I even tried “The Nuclear Holocaust Method” from https://neosmart.net/wiki/recovering-windows-bootloader/, which is an excellent resource if you’re in a similar (yet not as horrible) situation.


Taking a step back

I have a tendency to overthink things and come up with very complicated solutions to solve simple problems, because I am so often met with complicated problems that require complicated solutions. This happens with a lot of engineers, that we tend to automatically jump to complicated conclusions instead of trying to work from the ground up. So I decided to take a step back from the situation and think outside the box, leaning on my previous teachings from old IT wizards and masters, who taught me that you have to try and think of the simplest solutions first before you decide to go and make things complicated.

So I thought to myself…okay, everything I need for this damn Windows installation is located on the C:\ drive. The system files, the registry, all of the complicated shit that makes Windows work is there…so theoretically, shouldn’t it be possible to copy the entire contents of the C:\ drive to replace the C:\ drive on a different computer?

Well, kids…YES. It is indeed possible, because that’s exactly what I did, and while I did it to copy the OS to a new laptop, I did it again to the old computer just to make sure it would work for this tutorial — and you can do the exact same thing in order to get your shit working again within a few hours, and here’s how to do it:

ROBOCOPY to the rescue!

What you’ll need:

  • USB boot enabled in your BIOS
  • External NTFS-formatted USB drive that is larger than your C:\ drive
  • Windows Installer flash drive
  • Obviously 2 free USB ports (or a USB hub, which I have not tried)
  • Time and patience

The Backup

Ideally, you should have a folder in the root of your NTFS drive called C or Backup, or something that you can recognize without having to use diskpart in order to figure out which drive is the correct one in the next step. We’ll say that you have created an empty folder on the NTFS drive called BACKUP.

Plug in your external NTFS drive and your USB recovery/installer drive, tapping F9 on startup if necessary to boot into Windows Recovery from the USB installer, and select Repair your computer. Then click Troubleshoot > Advanced options > Command prompt. You will be sitting at X:\, which is the recovery drive. Sometimes in recovery, drive letters tend to change, so make sure you know which volume contains your Windows installation, because it may not always be C:\. The quickest way of finding stuff is just DIR C:\, DIR D:\, … DIR G:\, etc., but if you want to be absolutely certain, you can get the info straight from the horse’s mouth by running diskpart:

diskpart
list volume
exit

The above commands should show you what volume your Windows installation is on and also which volume is your external NTFS drive. For the rest of this tutorial, we will assume that your Windows installation is indeed on C:\ and that your external NTFS drive is listed as G:\.

It is important that you replace the drive letters and backup folder name below with your own, depending on your specific scenario.

Copy the entire contents of your Windows installation

We’re going to use ROBOCOPY to copy your whole Windows installation to the external NTFS drive, preserving everything in the process. Just run the command below, tweaking the file paths to fit your needs:

ROBOCOPY C:\ G:\BACKUP\ /E /COPYALL /SECFIX /R:5 /W:5 /IT /ETA

If you want to know all the ins and outs of what this does, look it up for yourself: https://ss64.com/nt/robocopy.html

When it finishes, it might report a few errors it encountered along the way, but fuhgettaboutit, everything is going to be OK. At least you have your files backed up now, right?

Exit out of the command prompt, select Turn off your PC, and gently toss that NTFS drive into a safe spot for the next few minutes.


The Clean Install

Turn your computer back on with only your Windows Installation USB plugged in, and hit F9 if you need to in order to boot from the USB. This time, when booting from the Windows Installer USB, you are going to select Install now. At the Windows Setup screen, you are going to choose Custom: Install Windows only (Advanced), because we are pretty advanced, right?

This next part may be arguable to some, but if you have reached this point of despair, just follow the directions. You may have some system partition that allows you to restore, but the odds are that you’ve tried that already, so just bear with me:

Delete ALL of the things…

Every single partition you see under Where do you want to install Windows?, select each one, and delete that shit. Every single one of them (unless you have separate hard drive installed with other important stuff on it that used to reside outside of your C:\ drive. If that’s the case, then by all means, leave that guy intact — otherwise, just absolutely delete everything. Windows will re-create the necessary partitions from scratch. You will see alerts pop-up, and just blindly click OK, and have a little faith. After panicking while you follow these instructions, you should be left with a single Drive 0 Unallocated Space. Select this drive, and hit Next.

Install your brand new fresh copy of Windows

Wait for all the files to finish copying, and go ahead and boot into your new Windows installation (taking out the installation USB before Windows boots). Please bear with me, I haven’t forgotten about your files. We just have a little tweaking to do.

When you start Window for the first time, don’t connect to a WiFi network (Skip this step), and disable all the location and telemetry settings just for good measure. However, what may be a crucial step is that when it asks you to create a user, use the same username and password you had on your old Windows installation. I have no idea what would happen if you do it differently. Windows may compensate, or it could just screw everything up. We’re trying to recreate everything exactly as it was, remember? So just create your same exact username and password, and go ahead and sign in. Don’t worry about downloading updates or anything like that, because this installation isn’t hanging around for long enough to worry about that mess.

Plug in your NTFS external drive, and take a look — BUT DON’T PANIC! Your backup folder is only hidden. Go to the View tab in Windows Explorer, and click the checkbox next to Hidden items. Now you should see your BACKUP folder or whatever you named it. Go ahead and Right-click that guy, select the Properties, and on the main General tab, uncheck “Hidden”, and select Apply changes to this folder, subfolders and files, and click OK. This will be a pretty big help in the next step.


The Restore

Go ahead and plug your Windows installation USB back in, reboot Windows, and tippety-tappety on F9 to boot from the Windows installer USB. Go through the same motions in our backup step: Repair your computer > Troubleshoot > Advanced options > Command prompt.

Follow the same steps detailed in the backup step before [using diskpart > list volume > exit] to nail down the correct drive letters for your current Windows installation, as well as your external NTFS drive. For the sake of simplicity, we are going to say again that your current Windows installation is located at F:\ and your external NTFS backup drive is located at D:\. Remember how I said they could swap letters in Recovery Mode? This is just a good lesson to pay attention to your drive letters and don’t blindly follow commands — change them for your specific scenario.

ROBOCOPY FOR THE WIN!

Now let’s get something straight — if diskpart tells you that your NTFS backup drive is located on D:\, and you run DIR D:\ and get File Not Found — again, don’t panic — it just means that you didn’t follow the previous step when I said to unhide the backup folder. We can easily get around that, however. If you forgot the name of the folder, just run DIR /A:H D:\, and you’ll see the name of the folder you need to specify in The Golden Command below. If the folder is named BACKUP, then run attrib -s -h D:\BACKUP, and now you should be able to see it normally when running DIR D:\.

The Golden Command

ROBOCOPY D:\BACKUP\ F:\ /B /E /COPYALL /SECFIX /R:5 /W:5 /IT /ETA

Make sure not to omit the /B flag, as it is crucial in this step — otherwise you will end up seeing a bunch of Access Denied errors. Now just wait patiently, if you are religious, say a little prayer, and wait for the magic to finish happening.


Profit

After ROBOCOPY has finished copying all of your files, type exit, hit Enter, and select Turn off your PC. Unplug your Windows installer USB, as well as your NTFS backup drive, because hopefully you won’t be needing those guys again for a long time.

Turn on your computer, and allow Windows to boot normally, and then sign in to your brand-spankin’ new, old operating system. Heave a sigh of relief. Curse under your breath a little. Take a drink if you must. Bingo-bango, you are dunzo.


If you realize I made any mistakes along the way or need me to make any clarifications, feel free to post a comment.

Leave a Reply