The hard drive on my laptop is slowly failing and a combination of being busy, lazy, and cheap is preventing me from replacing it. About once every two weeks over the past couple months, one of the Windows registry files becomes corrupted and the XP disk is unable to repair it. And the HD fails basic manufacturer-provided diagnostics. But I’m stubborn. So I’ve been routinely resuscitating this box and I decided to post the process I use.
If you boot and see a message like
Windows could not start because the following file is missing or corrupt C:\windows\system32\config\system
then you may be interested in this.
I should note that there are more Windows-y ways to fix this. But I have an Ubuntu Edgy disc on hand, and so these instructions are for using Ubuntu Edgy as
a band-aid for a dying hard drive or a screwy Windows installation. The ntfs-3g and ntfs-config packages are necessary to mount your local hard drive in read-write mode, otherwise these instructions would be much shorter.
I’m assuming you have a good backup from which to restore the missing or corrupt files that are preventing you from booting Windows off your hard drive. My backups are available via a networked Samba mount. If yours are on a secondary internal hard drive, an external hard drive, a CD or floppy or thumb drive, some of these steps won’t apply to you.
- Get a copy of Ubuntu and burn it to a bootable medium. I'm using a Ubuntu 6.10 (Edgy) on a CD-R.
- Insert your bootable medium into the crappy computer. Boot said crappy computer from the medium. You may need to fiddle with your BIOS to get it to boot from removable media, but hopefully not.
- At the Ubuntu boot menu, chose "Start or Install Ubuntu." Don't worry: it won't write over your hard drive or touch any of your data.
- When the operating system is done loading, click on the Applications menu, and choose Accessories, then Terminal.
- Since my backups are available on a Samba mount, and the Edgy CD does not have Samba installed, I first must install the Samba FS and its dependencies:
sudo apt-get install smbfs
- Create a directory for mounting the Samba share:
sudo mkdir /mnt/remote
- Mount the share, substituting appropriate values for the IP address and the share name:
sudo smbmount //192.168.1.5/backups /mnt/remote
- If not running Edgy, see this guide to mounting local Windows drives in read-write mode. Otherwise, first open the aptitude sources list:
sudo nano -wc /etc/apt/sources.listand add the following three lines at the bottom of the file:
deb http://flomertens.free.fr/ubuntu/ edgy main main-all deb http://ntfs-3g.sitesweetsite.info/ubuntu/ edgy main main-all deb http://flomertens.keo.in/ubuntu/ edgy main main-allSave and close the file.
- Let aptitude update its list of sources:
sudo apt-get update
- Install necessary packages:
sudo apt-get install ntfs-3g ntfs-config libfuse2
- Launch the ntfs-config utility:
sudo ntfs-configCall the mount point "windows", which will live at /media/windows. Click the Add checkbox next to the device corresponding to your local drive (/dev/hda1 for me). Click Apply. Make sure the checkbox next to "Enable write support for internal drive" is clicked on the next dialog, and click Ok.
- Copy over backed up versions of missing or corrupt files:
sudo cp /mnt/remote/repair/system* /media/windows/WINDOWS/system32/config/is an example I've used a couple times.
- Shutdown, remove the Ubuntu CD when prompted, and boot off your hard drive. Cross fingers. And you should be back in action.