Thursday, March 4, 2010

Beginners Guide on How to create and restore a preconfigured and costumized Windows clone

When working with windows, it IS known that a lot of crap will accumulate on you PC that will slow down EVERYTHING..
It is also quite known that it's a loooong process to first backup your important data and format everything and then Install windows from the windows CD (witch takes more time than trying to start a war between Iceland and The Faeroe islands..
However there is a way of only having to do that ONE time (and one time only).. This is a guide on how to create an image of you current system to keep if you later on will have to restart (witch you eventually have if you use the computer for more than just seeing pictures and writing documents)
It's "EASY" (and safe if you do it correctly!) And is hell of a better alternative than reinstalling windows every time you suspects to have a hidden virus or get's tired of a sloppy system!!


Part one - The beginning, gathering resources

To create a clean windows clone for restoring a ready and optimized windows you will need:

- Two ntfs partitions where the first partition (usually c:\) is used for windows and the used programs. This setup is recomendable, and is essential for using this method, hence you wont need to backup the data you save on your secondary partition.

- A clean windows install with pre installed drivers also recommended that you install the latest updates + those few programs you know, you will need from the start like your preferred web-browser, refrain yourself for installing any games since it messes up windows key-register.

* The first partition (c:\) should be the smallest (10-15 GB's should be enough! But if you wanna be sure not to )
* The next partition should be used for all your documents, music videos and games (usually d:\) this partition should be the biggest since you're gonna use up a lot of space.

- A CD-burner and an empty CD

- A system recovery CD with the necessary tools for the task (in this guide the tools are ntfs-3g and ntfsclone and xz), I use the Linux based SystemRescueCd, download and burn ISO image from http://www.sysresccd.org/Main_Page - It's free!!! (Hooray for Open Source!:D)


Part onepointone - Booting
Write down the steps below or print out this guide, you will need the commands from this point until the command # startx", since theese step are going to be writen without a graphical interphase, you wwill first be able to start the internet after this part.

Insert the newly burned SystemRescueCd in the disc drive, restart the computer, Then wait..!!

Press enter when asked to choose, then Wait a little more.. but this time, make sure to be keeping an eye out since at one point you get to enter what keyboard layout you desire to use, and you only get 20 seconds to decide!! (ex. typing: 11 then pressing enter loads up the danish keyboard)

Now.. wait some more!!

[Write these comands down before starting]
When boot is finished press:
# net-setup

to setup internet connection (not necessary for the cloning but comfortable if you wanna surf or chat online (Firefox and pidgin pre installed) while doing it..

If that doesn't work type:
# dchpcd eth0

!Works only for Ethernet setup!
If this doesn't work either, then stop wasting time on the internet connection!!

Now start the graphic interface:
# startx
After this point you will be able to access Firefox, and thus find this guide again.

Simply download a popular linux distribution, like Ubuntu, and burn the .iso image to an empty dvd, the tools needed for this procedure is quite custom for many distributions.

If using Ubuntu, then chose "Try Ubuntu" when prompted at startup.

Part onepointtwo - The Cloning!!!

When interface starts up open a terminal, hitting the start-key (or the dash button located in one of the corners, write in "terminal" and open.
In ubuntu a shortcut is to press ctrl+alt+t.

The following codes are marked by a "# ", bear in mind that this should not be included when typing the commands!

Start out by acquirering super user access, type:
# sudo su

Next mount your windows partition, since windows by default installs on the first blocks of the hard disk, that partition is usually "sda1" for XP and "sda2" for win7 and later.
First we need to make a folder for mounting windows
# mkdir /mnt/windows


Next mount the windows partition using ntfs-3g:
 # ntfs-3g /dev/sdaX /mnt/windows
*Make sure to swift out "sdaX" with either "sda1", "sda2" or maybe even "sda3" ... depending on which partition windows are installed.

To check if it's the right partition that you just mounted press:
# ls /mnt/windows

That should show up the files and folders on the c-drive, containing a windows folder and program files folders etc..


The swapfile and hibernation file is not useful when cloning the image, and is just using up a lot of space so simply delete that file by typing:

# cd /mnt/windows/
# rm pagefile.sys hiberfil.sys

Not to worry.. after windows starts up the next time, it will automaticly create new files!
The swapfile is used for storage of temporary data while working in windows, it's therefore not an important file for restoring windows, it's just a waste of mighty fine Gigabytes and kilobits.

Now unmount the windows partition:
# umount /mnt/windows

Mount the destination partition witch you want the image file, if you use an USB drive, skib the two lines below, if you use the secondary ntfs partition do this:

# mkdir /mnt/d-drive

# ntfs-3g /dev/sdaY /mnt/d-drive
*Y stands for secondary drive so makje sure to swift this out with "sda2" or "sda3" or in some cases even "sda4"

Change directory to the target folder on the USB drive
# cd /media/ubuntu/XXXX
*XXXX this is usually a long combination of numbers and letters, just press Tab for autocompletion, then press Enter. (If you have more usb drives, then first run # ls /media/ubuntu/XXXX to identify which drive is your target drive)

If unstead storing the image on the secondary partition write 
# cd /mnt/d-drive/



..and then let the cloning begin!!:
# ntfsclone -so - /dev/sda1 | xz -c ./NAMEOFTHEFILE.img.xz

!NAMEOFTHEFILE! should be changed out to a name you would recognize for example the date "060606_xp.img.xz"

This command creates an the image of the windows partition, and send it as and output signal witch will will be converted into an image and compressed into a very small file.
The process takes between 1 and 2 hours on my computer.. BE SURE NOT!!! TO CLOSE DOWN THE TERMINAL WHILE IT'S WORKING.. THAT WOULD JUST WASTE EVERYTHING AND YOU WILL HAVE TO OPEN A NEW TERMINAL AND START THE CLONING OVER AGAIN!!!

Et Voila, you have now (successfully i hope!) created a precise image of the current windows installation and settings..


Part two - Releasing the BEAST!!

You have been working with windows for a loooong time now and it really starts to get sloppy.. DAMN it's slow!!
And what the fuck is happening to all those annoying startup programs?? You had even maybe got your system infected by a few viruses and some Trojan horses as well..
What do you doooo??? NUKE THE SHIT OUT OF THIS ... err... SHIT??

NOT to worry.. I got a solution!!! :P

Alright enough with the annoying writing sorry got carried away for a sec there!
The next step is of course, restoring the system you cloned!

That is actually quite simple!!

First boot from the SystemRescueCd that by now properly have collected a lot of dust under some papers..

Repeat the boot section as described in part onepointone,then mount the drive with the compressed clone image (in this example sda2):

# mkdir /mnt/d-drive

# ntfs-3g /dev/sda2 /mnt/d-drive


Change directory to the mounted drive by typing:
# CD /mnt/d-drive

And then (happily of course:) press:
# xz -dc 20100304_xp.img.xz | ntfsclone -rO /dev/sda1 -

!Make sure to remember adding the ending -!

When finished type:
# reboot

(I wonder what that does!)
And be fast to remove the CD, AFTER the computer is closing down and starting back up again!

Now you got your cloned windows back, and are ready to start catching up on those nasty viruses and Trojan horses + annoying terrorizing startup programs (wad'up ITUNES!??) infecting your PC again!


Reasons to use this instead of formatting, then reinstall windows:

* The system is more updated, that saves you a lot of hours of installing updates and rebooting, then install more updates, then reboot again.. and so on and so forth..

* You got pre installed drivers, this saves you a lot of time finding the drivers for all your hardware, in worst cases a reinstalled windows might not have drivers for your internet card, that means you will have to borrow another computer in order to get this driver!

* As long as you saves all the data you want to save on the non-system drive (usually d:\), you won't loose any data

* When you first HAVE created the cloning image, it's a lot faster and very easy to restore the system, you don't even need a windows CD!!

* All configurations and installed programs before the cloning will be kept and reloaded at restoration!

Hope it's useful and easy enough.. To all the linux haters out there.. EAT LESS CARBONHYDRATES, BITCHES!!

- Enjoy

© Soupé resorts – (Created by Dungdae)

Thanks to biGBro for the guidence on how to actually do this!!


P.S.

If you want to use your Documents and Settings without having to think about backing it up before restoring the system.. and start getting windows to automaticly use the d:\ for storage of Documents and Settings, then use the guide on:

http://www.tech-recipes.com/rx/1409/move-your-documents-and-settings-username-profile-off-of-the-c-drive/

!!But make sure to make a clone image of your system BEFORE starting that guide!!

The mentioned guide is not created by me!

No comments:

Post a Comment