Main menu:
Tutorials > More
Here’s the scenario. You have a dual boot machine, Ubuntu on one side, Windows on the other. You’re tooling around, doing your thing and then one day you boot into Windows and get this:
Windows could not start because the following file is missing or corrupt: \WINDOWS\SYSTEM32\CONFIG\SYSTEM.
: You will be digging into your windows system32 folder and mucking about. If this makes you feel queasy, or if you’re not entirely confident that you have a complete backup you may not want to do this. In other words, proceed at your own risk.
Hop on in to your Ubuntu install, and lets install a few tools we’ll need to access your Windows partition. You may have ntfs-3g installed already. Open up a CLI (Applications-> Accessories-> Terminal) and type:
sudo apt-get install ntfs-3g ntfsprogs
Now we have what we’ll need to work in the NTFS partition that contains your Windows install.
Next, we’ll have to determine which partition that is and then mount it so we can work in it.
sudo fdisk -l
That command will list all of the available partitions on your hard drive(s). You’re looking for the one that says NTFS. It may look something like
/dev/sda2 1 9327 74919096 83 NTFS
If you have multiple NTFS partitions it’s a good idea to start with the first one. We’ll go through mounting them and you won’t do any harm in looking around. If you can’t find the directories needed in your first NTFS partition, try the next one. In this tutorial, we’ll use /dev/sda2. Remember to change this to correspond with what actually exists on your system.
So, we know what we want to mount (or have a good idea) so let’s get that partition mounted.
First let’s make a directory where it can sit.
sudo mkdir /media/windows
Now let’s mount it and make it read/write so we can modify it.
sudo mount ntfs-3g -o rw /dev/sda2 /media/windows
Change ‘sda2‘ to reflect your hard drive. If this generates an error message, you may have to force the mount with:
sudo mount nfts-3g -o force,rw /dev/sda2 /media/windows
Now you should be able to change directory into your windows partition.
cd /media/windows
That’s the root of your drive. Lets go to where the files you’ll need to replace are.
cd WINDOWS/system32/config
There are five files you’re going to need to pull from your restore point and plonk down here. First though, let’s back up the original files, even if they’re corrupt. Better safe than sorry.
cp default default.bakcp SAM SAM.bakcp system system.bakcp software software.bakcp security security.bak
Now you have your backup. Next we’re going to overwrite the corrupted files with ones from your last restore point.
cd ‘/media/windows/WINDOWS/System Volume Information’
Now let’s take a quick look.
ls -las
you should see at least one directory that starts with ‘_restore’ and then some random characters. Change directories into that.
cd _restore*
Now another ls to find the restore point directory with the latest date.
ls -las
Look for the most recent directory that is similar to RP123 – it will be different on your machine. Lets move into that directory
cd RP123
Now into the snapshot directory
cd snapshot
If you want to take a look around, do an ‘ls‘ to see what’s there. We’re going to copy those five files we made backups of back to their appropriate place.
cp _REGISTRY_USER_.DEFAULT /media/windows/WINDOWS/system32/config/defaultcp _REGISTRY_MACHINE_SECURITY /media/windows/WINDOWS/system32/config/securitycp _REGISTRY_MACHINE_SOFTWARE /media/windows/WINDOWS/system32/config/softwarecp _REGISTRY_MACHINE_SYSTEM /media/windows/WINDOWS/system32/config/systemcp _REGISTRY_MACHINE_SAM /media/windows/WINDOWS/system32/config/SAM
Now that you’ve copied these, let’s tell windows to to force a file system consistency check.
sudo ntfsfix /dev/sda2
It’s time to boot into your Windows partition and see if we’ve fixed the problem. So restart and select Windows from your boot loader menu. When it first starts up, you should get a blue screen telling you that you’ll need to run a file system consistency check. Let it do it, and reboot again. Hopefully you’ll be back into your Windows install!
Sub-Menu: