Backing up and restoring

copiman

Member
I want to create a image copy of my hard drive, wipe the hard drive, and then reinstall the back up. This should put my PC back to the way it was. Right?

The reason I am doing this it to get hands on doing back ups. I'm using a PC that it does not matter if I blow it up. Basically, I want to back up, work on PCs, and have this in case I crash the sucker.

I am backing one up to an external hard drive that has other stuff on it. I'm thinking this will not work. The reason I say this is when I boot from the external drive, which has other back ups and stuff, it won't know what to load. Right? I'm thinking that I need to use an external with nothing on it but the back up.

Do I need software outside of Windows to do this?


Need your input. First time.
 

salvage-this

Active Member
Imaging PCs can be a bit tricky depending on what you want to accomplish. I have used CLonezilla in the past to make 1:1 copies of HDDs for moving existing installs to new drives.

Spynoodle wrote a nice guide on how to use it http://www.computerforum.com/213395-how-clone-hard-drive.html

At work I use a WinPE boot drive and I capture images with imagex to be deployed later for PCs that are deployed to the end users. It works pretty well for me but it can be a slow process capturing the images and you do need to know how to work a bit in cmd. Nothing too scary but you need to know how to navigate the system a bit.

What work are you backing up? If it is files just move them off to an external location. If there are programs that you are worried about messing up I would just set a restore point before you start the work. Much faster than taking an image of the system.
 

copiman

Member
Here is what I'm doing. I am a student in networking and computers at a technical college. People I know are letting me work on their PCs/laptops. So, what I want to do is have a back up of the entire thing, so if I do something wrong and mess it up worse, I can then just wipe the drive clean and load the back up onto it, and put it back to where it was before I started working on it. I,m afraid that I will do something and loose stuff outside the OS, like files and applications. Seems nobody has any CDs of anything, like recovery, Microsoft office, etc..

I have a PC here that works (XP) that someone gave me to play with. Want to practice doing entire back up, wipe the hard drive (simulating the hard drive crashed while I was working on it) and then put the back up back on it so that it is back to where it was in the beginning.

I have a WD My Book external that has other data on it. I created a folder on it and backed up the PC to that folder. Then it hit me. Once I wipe the drive I will not have an OS to use to restore it back. Not sure how to do it at this stage.

FYI, I have a hard drive enclose that I could by a hard drive to put in it and use it, so that the only thing on it would be the back up if this is an option.

Again, this is a first for me. You would think we would have done this a school. Anyway, I appreciate you responding and if you have more input, I would love to hear it. Just want to cover myself if I make a mistake, which at my stage of the game, there is a chance of that happening.

Sorry to be sooo long winded here, but just want to make sure I'm communicating.
 

salvage-this

Active Member
Long replies do not bother me. I see what you are saying. There are multiple commercial programs that will do what you are trying to do. Acronis True Image is probably the best out there if you want to pay for it.

In your situation I would use WinPE and Imagex for capturing wim files of the whole operating system, programs, and user data. It took me quite a while before I found the right guide for getting myself educated on the process. It might be a bit difficult to learn, but a lot of corporate networks will use an imaging process involving WinPE and standard image deployments. I can't exactly give you the guide that I wrote on the process since it is for our office, but if you are interested in how it works I will copy over a more general guide on how to setup the right software and grab and deploy images for yourself.
 

copiman

Member
Thank you. I am always interested in anything that will further my education and ability. Please send what you feel would help.
 

salvage-this

Active Member
I will. It might be a bit till I have the time to go through and get everything down here but I'll find some time to get i finished.
 

S.T.A.R.S.

banned
Yes you CAN make the entire exact copy of your entire computer on external HDD and it does not matter if that external HDD already has some other data on it.
Of course that depends on the way you use for computer cloning...

I for example have HDD which already contains some data on it,but in there I have created the folder called "Clone data" and in it I have copied EVERYTHING that my computer contains using simple free Linux Ubuntu CD-ROM disk.
And if I screw up something,there is NO NEED TO EVEN REINSTALL THE BACKUP.I just simply copy everything from "Clone data" folder back to the computer's HDD and viola!

This might seem a little bit strange way I admit,but that is my favorite way of cloning computers.I know tons of other ways to do this too,but this way is my favorite...

Just note that if you do something wrong during the process,this way of cloning will not work.But for me that is not a problem since I never do anything wrong lol...
 

copiman

Member
Thanks STARS. I will give that a shot. My weekend is about over, so I will try during the week if I can.

What did you mean exactly by saying "Just note that if you do something wrong during the process"? Do you mean creating the back up or reinstalling/copy? Can you elaborate on this?

Thanks again for your help.
 

salvage-this

Active Member
he is talking about messing up something in the repair process and needing to use the backup to restore the data.

STARS- I have used Ubuntu Livs CDs before to backup the user data, But it won't do programs and the OS AFAIK? maybe you know how to get those through a special command?
 

NyxCharon

Active Member
STARS- I have used Ubuntu Livs CDs before to backup the user data, But it won't do programs and the OS AFAIK? maybe you know how to get those through a special command?

If you use dd in linux to make a backup, it copies block by block, so everything is preserved. Everything. This includes free space (free blocks) in the drive, so it's a 1:1 copy/backup ratio unless your compress the resulting image.
 

salvage-this

Active Member
Nice. Learn something new every day.

Even after a bit of editing it is still a bit long

Copy this over to a text file it will be easier to read Not all parts are necessary for your uses, but I kept them in there in case you need it later. Let me know if you have any questions on the process.
Code:
System Imaging Guide with ImageX and Windows PE

What is Windows PE?
Windows Preinstallation Environment (Windows PE) is a minimal Win32/64 operating system with limited services, built on the Windows 7 kernel. It is used to prepare a computer for Windows installation, to copy disk images from a network file server, and to initiate Windows Setup.

Windows PE is not designed to be the primary operating system on a computer, but is instead used as a standalone preinstallation environment and as an integral component of other setup and recovery technologies, such as Setup for Windows 7, Windows Deployment Services (Windows DS), the Systems Management Server (SMS) Operating System (OS) Deployment Feature Pack, and the Windows Recovery Environment (Windows RE).

------------------------------------------------------------------------------------------------------------------------------------------
We will be using Windows PE as a bootable system that will be completely independent of the HDD.  That way we can take the image off of that system for later deployment.

You will need to install Windows AIK on the PC where you want to build Windows PE.  The download can be found here:
http://www.microsoft.com/en-us/download/details.aspx?id=5753
Burn the image contents to a DVD or mount with an iso mounter then install it on your workstation PC.  Install for just the account you are working from.  Not everyone.

1.  Open the Deployment Tools Command Prompt with admin privileges
	Start > All Programs > Microsoft Windows AIK, right-click Deployment Tools Command 
	Right click -> open as administrator
2.  Use the command copype.exe  <arch> <destination> to copy the Windows PE files to a new directory
	<arch> is the architecture (x86, x64) *note x64 might be labeled amd64*
	<destination> is the location where the files will be copied to.  
	The complete command I used was
	Copype.cmd amd64 c:\winpe_x64
	That will create the folder winpe_64 with the necessary files to boot a 64 bit Windows PE
3.  Use this command to copy and rename the winpe.wim file
	Copy c:\winpe_x64\winpe.wim c:\winpe_x64\iso\sources\boot.wim
4. Copy imagex to the Windows PE boot cd
	Copy c:\<path to Windows AIK>\tools\amd64\imagex.exe c:\winpe_x64\iso\
	This will add imagex.exe to the iso folder.
** At this point you can either use a CD\DVD or a USB drive.  I’ll go through the steps for both**
5.1 USB - Get a flash drive that is completely empty.  We are going to format it so all of the data on it will be lost
Open an administrator command prompt and run Diskpart
Next, run list disk
My USB drive was labeled as Disk 1.  Your drive might be labeled differently.  
Run these commands:
	select disk 1
	clean
	create partition primary
	select partition 1
	active
	format quick fs=fat32
	assign
exit
5.2 Copy the contents of the iso folder to the USB or build an ISO to be burned to a CD/DVD later with the following command 
*note this command is for a CD\DVD only*
	Oscdimg -n -bC:\winpe_x64\Etfsboot.com C:\winpe_x64\ISO C:\winpe_x64\winpex64.iso
You should now have a fully bootable Windows PE device. 

Generalize the install

Setup a pc with all of the necessary software that you want included in your image.  Make sure that you have all of the configurations in place.  Any configurations that you make after the image is taken will need to be done separately after every install of the image.  Be sure to update Windows and clean up any left over documents that you do not want in the image.

*Sysprep is here for reference.  Do not use for cloning drives!*

Sysprep Overview
The System Preparation (Sysprep) tool is used to change Windows® images from a generalized state to a specialized state, and then back to a generalized state. A generalized image can be deployed on any computer. A specialized image is targeted to a specific computer. You must reseal, or generalize, a Windows image before you capture and deploy the image. For example, when you use the Sysprep tool to generalize an image, Sysprep removes all system-specific information and resets the computer. The next time that the computer restarts, your customers can add user-specific information through the Out-Of-Box Experience (OOBE) and accept the Microsoft® Software License Terms. You can run Sysprep as either a command-line tool or a graphical user interface (GUI) tool.

We use sysprep to generalize the system and prepare it so we can grab an image that has no drivers that are tied to it.  You can either call sysprep from CMD or from the GUI.
CMD -> run as administrator.  You will get a prompt that looks like this
C:\Windows\System32>
Run the following commands to call sysprep from CMD
	cd sysprep
	sysprep /generalize
To use the GUI, navigate to C:\Windows\System32\sysprep\ Run sysprep.exe as administrator
When the system preparation tool opens make sure that the settings match to the picture below.
 
	
Hit OK to run sysprep with those options.  It will generalize the install and shutdown the PC.  Now you are ready to install the bootable Windows PE medium and grab the system image.


Grabbing the Image
Boot your Windows PE USB\CD\DVD.  If you boot the HDD instead of Windows PE, you need to do another generalize and reboot.  When it is fully loaded you will see a command prompt with the following
X:\windows\system32>
The first thing that you want to do is figure out what volumes you have on the system and what labels they have.  
	diskpart
	list disk
The output will show you what disks (not partitions) are available on the system. Once you find what disks are available you can quit diskpart
exit
The output should be similar to this
Microsoft DiskPart version 6.1.7600
Copyright (C) 1999-2008 Microsoft Corporation.
On computer: MININT-6ILNCG9

DISKPART>list disk
  Disk ###  Status         Size     Free     Dyn  Gpt
  --------  -------------  -------  -------  ---  ---
  Disk 0    Online          465 GB      0 B         
  Disk 1    Online          465 GB  1024 KB         
  Disk 2    Online         3864 MB      0 B         

DISKPART>exit
Leaving DiskPart...

Here we can see that my 500gb internal drive, 500gb external drive, and my Windows PE flash drive have been initialized by the system.
Next, you want to find what the labels of the partitions are.  To do this you can use the command
dir <partition label>
So dir will show you the label of the volume, as well as the contents of that volume.  Here is a sample output.
 X:\windows\system32>dir c:\
 Volume in drive C is System Reserved
 Volume Serial Number is 5A2F-D07C

 Directory of C:\

X:\windows\system32>dir d:\
 Volume in drive D has no label.
 Volume Serial Number is E031-299C

 Directory of D:\

03/28/2013  02:22 PM    <DIR>          Intel
07/13/2009  07:20 PM    <DIR>          PerfLogs
04/02/2013  11:18 AM    <DIR>          Program Files
04/02/2013  08:19 AM    <DIR>          Program Files (x86)
03/28/2013  02:27 PM    <DIR>          swsetup
03/28/2013  02:21 PM    <DIR>          Users
04/02/2013  12:19 PM    <DIR>          Windows
               0 File(s)              0 bytes
               7 Dir(s)  461,311,115,264 bytes free

X:\windows\system32>dir e:\
 The device is not ready

X:\windows\system32>dir f:\
 Volume in drive F is New Volume
 Volume Serial Number is FCE8-B463

 Directory of F:\

03/19/2013  07:23 AM    <DIR>          Affective
02/28/2013  12:05 PM         2,612,672 anyconnect-win-3.0.10057-web-deploy-k9.exe
03/07/2013  12:44 PM       523,666,432 archive.pst
03/21/2013  10:48 AM    <DIR>          Blancco Test Files
11/19/2012  07:55 AM    <DIR>          Dell Latitude 6520 win7 64bit sp1
04/02/2013  03:53 PM             2,930 dir.txt
04/03/2013  06:55 AM               642 dirlist.txt
04/01/2013  01:31 PM    <DIR>          Firefox
03/31/2009  07:20 PM           217,769 grldr
04/02/2013  02:43 PM    <DIR>          HPImage
03/25/2013  01:42 PM    <DIR>          install stuff
12/21/2012  08:03 AM    <DIR>          MapPoint 2013
07/18/2012  10:18 AM               240 menu.lst
12/01/2006  08:37 PM           904,704 msdia80.dll
12/31/2012  09:19 AM    <DIR>          New folder
04/02/2013  06:12 PM    <DIR>          WorldShip 2013
               9 File(s)  5,238,076,749 bytes
              21 Dir(s)  409,609,949,184 bytes free
 Volume in drive G has no label.
 Volume Serial Number is 6266-088C

X:\windows\system32>dir g:\
 Directory of G:\

03/28/2013  02:43 PM    <DIR>          boot
03/28/2013  02:43 PM    <DIR>          EFI
03/28/2013  02:46 PM    <DIR>          sources
07/13/2009  06:39 PM           383,562 bootmgr
07/13/2009  06:45 PM           667,712 bootmgr.efi
07/14/2009  07:10 AM           581,008 imagex.exe
               3 File(s)      1,632,282 bytes
               3 Dir(s)   3,875,164,160 bytes free

	
From the output I can see what partition labels I need to finish my commands.
C:\ - System Reserved
D:\ - Windows, Users, Applications... (what I want to build the image from)
E:\ - “the device is not ready” Most likely this is the CD\DVD drive.  The device is on, but there is no media in the device.  You may also see this if you have a card reader installed.
F:\ - External drive
G:\ - Windows PE bootable USB
Now that we know where everything is we can issue the command for capturing the image.
G:\imagex /capture D:\ F:\HPImage\HP_Image.wim “HP_Image”
To break that down here are the individual labels
G:\imagex – path to imagex on Windows PE device
/capture – argument for imagex giving the command to capture an image
D:\ - location of the generalized Windows install
F:\HPImage\HP_Image.wim “HP_Image” – location of where I want to save my image, what I want to name the image, and the “image label”
The command should run for about a half hour.

Once the command finishes you should now have an image saved to the external drive.  

 

Deploying the Image
To deploy the image, we will need to boot the system with the new hard drive installed as well as our external drive and Windows PE device.  
Boot to Windows PE and run diskpart
list disk
select disk <disk where you want to install>
the internal drive most likely listed as disk 0 
select disk 0 
clean
create partition primary [size=<n>]
you can either leave the size option out to have the partition use the entire volume or specify a size in mb.
create partition primary entire volume
create partition primary [size=92160] create a primary partition with a size of 92160mb/90gb
Mechanical drives can partition the entire drive.  To maximize SSD Life make the primary partition 70%-80% of the full drive capacity.  
select partition 1 
active
format quick fs=ntfs label=OS
	the label is not necessary but the functionality is there if you want to label it.
assign letter=C

*If you get an error saying that the label C is not available then one of the other devices may have grabbed the C as it’s label in windows PE.  If that is the case go into disk part and reassign the media to another drive letter.  
**these commands only necessary if you have a device labeled C:\ that is not the drive you want to image**
	diskpart
…This is the output from my workstation desktop as an example…

Microsoft DiskPart version 6.0.6001
Copyright (C) 1999-2007 Microsoft Corporation.
On computer: KYLE-AFWS

DISKPART> list volume
  Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
  ----------  ---  -----------  -----  ----------  -------  ---------  --------
  Volume 0     D                RAW    DVD-ROM      2048 B  Healthy            
  Volume 1     E                       DVD-ROM         0 B  No Media           
  Volume 2     C                NTFS   Partition    149 GB  Healthy    System  
  Volume 3     G                       Removable       0 B  No Media           
  Volume 4     H                       Removable       0 B  No Media           
  Volume 5     I                       Removable       0 B  No Media           
  Volume 6     J                       Removable       0 B  No Media           
  Volume 7     K   Seagate Exp  NTFS   Partition    932 GB  Healthy 
  Volume 8     L            OS  NTFS   Partition     90 GB  Healthy

 I can see that I have a volume already labeled as C, so I need to move it from C to an unused letter. From the output above I would issue the following commands.
	select volume 2
	assign letter=M
That command will free up C as a label allowing you to assign the drive to be imaged as the new C:\ drive
	select volume 8
	select partition 1
	assign letter=C


At this point we are now ready to pull the image down to the drive that we just set up.  Referencing the output of the dir commands under the section “Grabbing the Image” the command for installing the image to your new drive would be
g:\imagex /apply f:\HPImage\HP_Image.wim 1 c:\
Breaking the commands down…
g:\imagex – is calling imagex from your Windows PE device 
/apply – is an argument for imagex telling it to apply an image
f:\HPImage\HP_Image.wim 1 – location of the image file that you want to be applied.  It is important that you use the exact file name as what is saved on the external device.  The 1 is a version number.  There is a possibility to have different versions of an image so mark the image to be applied as 1 unless there is another version that you want to use.  
C:\ - where you want the image to be applied.   
Imagex will now take the image and apply it to the C:\ drive.  Once the imaging process is complete navigate to the C drive and install the boot configuration
C:
cd Windows\system32
bcdboot c:\windows /s c: 
restart the PC without all of the external devices, install any missing drivers and setup the PC for the end user.
 
Last edited:

copiman

Member
Thanks for the info. Looks a little over my head, but will read it and see. I just cloned my PC yesterday to a larger HDD. I used Clonezilla. Still need to study up on Clone vs. Image. One step at a time.

When I cloned from the 500G to the 1T drive, I still have the exact partitions, one C: for my active and one D: for my recovery. This is all shown by clicking computer. Does not show anything else. I used MiniTool Partition Wizard and ****** Partition Master and both show 588G of unallocated. Can't seem to get the unallocated space to C:. The recovery partition is between the active and the unallocated. Tried to move them and I'm sure I'm missing something. Read up on it and still cannot get it.

On a positive note, I actually did a clone:).
 
Last edited:

johnb35

Administrator
Staff member
If the recovery partition is between the 2 then you can't do anything with it besides create a single data partition, which most people do. 1 partition for OS and programs and the other for personal data.
 

S.T.A.R.S.

banned
he is talking about messing up something in the repair process and needing to use the backup to restore the data.

No lol that's not what I am talking about.I don't use any REPAIR processes...I don't do it that way.

STARS- I have used Ubuntu Livs CDs before to backup the user data, But it won't do programs and the OS AFAIK? maybe you know how to get those through a special command?

When I said "clone" I literally meant CLONE.So that means that I copy every single byte of data on the entire HDD and not just some user data lol.
And no...I do not use any special commands to accomplish this.
I could have,but I found a simpler way...

Like I said...in the next few months I might post the pictures on how to do that in a new thread...
 
Top