The following tutorial is intended for those with some knowledge of Linux and the command line. At the least, you should be comfortable with creating and navigating directories, and should possess a fundamental knowledge of hardware device names under Linux.
Sound scary? A “point-and-click” guide to accomplishing most of the same tasks is also available.
Like it or not, Windows needs to be reinstalled occasionally. Whether the cause is a bloated registry, a virus/spyware attack, or an idiotic user, with time Windows just seems to slow down and/or behave erratically.
Re-installing Windows from scratch is a pain. Once you get the base system installed, most people have to download millions of updates and patches, scour the web in search of the latest drivers, and reboot, reboot, reboot.
Once you get your Windows system installed and configured the way YOU want it, you should be able to restore to that pristine state in a matter of minutes, not hours. The way to do this is to create an “image” of your freshly-installed system, from which you can later restore when necessary. Of course, there are a number of commercial packages available to do this task, but what if you do not want to spend any money?
Linux and open-source software to the rescue. Yes, you can quickly, and (dare I say) easily image and restore a Windows system using open-source tools. Before we begin, please back up any critical data. This procedure worked for me, but I am not responsible for any data loss.
The Main Tools
Repeat after me: “I am NOT afraid of the Command Line!”
The open-source tools that we are going to use are:
- ntfs-3g – a driver for NTFS
- GParted – a partition editor
- ntfsclone – exactly what it sounds like
- a Linux “live” CD
In order to restore Windows, you need to run from a different working environment, such as a Linux “live” CD. Any Linux “live” CD with the above tools will work, but two available options are SystemRescueCD and Puppy Linux. Both allow you to boot and run entirely in RAM, freeing your CD/DVD burner for any additional tasks that you might need. I successfully completed all of the tasks detailed below using both Puppy and SystemRescueCD. Just grab the latest version of whichever you prefer.
Note: If you use SystemRescueCD, I recommend typing docache doeject at the boot prompt. These two options will load the entire rescue environment into RAM and then eject the CD afterwards. Puppy Linux, on the other hand, loads into RAM by default. The rest of this tutorial will use Puppy Linux, though the commands can easily be issued from any live CD that contains the above tools.
Before you can image and restore your system, you need to consider a few things:
- ntfsclone cannot (yet) easily restore an image to a partition smaller than the size of the original partition. Thus, if you clone a 120 GB partition with only 20 GB used, you must restore to a partition size of at least 120 GB. There is a fairly-easy way around this. Keep reading.
- Where are you going to store your newly-created image? I recommend storing it on a separate partition or on a separate server (using SSH). I will walk you through both of these methods.
- Gloriously, the ntfs-3g driver provides full NTFS read/write support! I did not encounter any problems manipulating NTFS on either Windows 2000 or XP. This procedure should work for Vista, but since I do not own it, so I cannot test it.
The entire process in a nutshell:
- Boot into the “live” CD.
- Make room for a new partition (recommended, but optional).
- Make directories and mount (not applicable for SSH).
- Create the image.
- Restore the image.
- Using SSH (optional)
- Conclusion / Advanced Restoration.