To do this you need following tools:
1) Imagex (465 KB)
http://sdrv.ms/1hGhxHR or
https://skydrive.live.com/redir?resid=868489BE53951B6E%21110
2) Windows 7 setup disk (bootable) or usb flash drive (bootable)
Need this only to boot to Windows PE
You have to capture HP Recovery partition and System Partition using Imagex tool.
You can apply the captured partition (from old HDD) to new Hard drive and can recover Windows by pressing F11.
To do this, first download Imagex (from above link), extract it, and placed it on pen drive or C: drive (Where your windows is installed). There are two imagex files i.e., imagex32.exe and imagex64.exe. Depending upon your system architecture, you use which one is appropriate. If imagex32.exe does not work then you can use imagex64.exe. For convenience you can copy both the version.
In my example, I’m going to boot Windows 7 from usb flash drive. I have also copied imagex32.exe and imagex64.exe into windows 7 flash drive.
Steps:
1. Boot Windows 7 from usb flash drive. When Windows setup ask for Language selection , Press Shift+F10. This will take you to command prompt. You can open any number of command prompt by pressing Shift + F10.
2. On the command prompt type: (please ommit # sign and > sign and also don't type enter)
#
diskpart > enter (do not type hash sign and Greater than (>) sign)
to view disk type
#
list disk> enter
See which one is your Hard drive, its usually Disk 0, where your Windows is installed.
type:
#
select disk 0 >enter (do not type hash sign (#) and greater than (>)sign.
now see the partitions by typing
#
list partition>enter
you can also see the volume by typing
#
list volume> enter
Now open another command prompt by pressing Shift + F10 . Do not close the other prompt. It will help you to figure out partition and volumes.
Please note the driver letter, volume number and partition. And figure out which one is your System partition, Recovery partition and Windows partition.
It’s usually
Partition 1 is your
System partition (100 MB)
Partition 2 is
Windows partition and
Partition 3 is
Recovery partition ( 10-15 GB)
3. Now on the New Command Prompt, go to flash drive (where you have copied Imagex tool)
In my example, I have copied imagex on the flash drive where Windows 7 setup is.
Lets assume F: drive is your flash drive where you have copied imagex.
on the command prompt type:
#
f: > enter (do not type # sign and > sign) (f colon
🙂))
#
dir>enter
*dir command will show the content of F drive. Note down imagex file name. In my example, my imagex file name is imagex64.exe
CAPTURING RECOVERY AND SYSTEM PARTITIONS
4. Now capture the recovery Partition using imagex. In my example, drive E is my recovery partition.
type:
#
imagex64.exe /capture e:\ d:\recovery.wim “recovery” >enter (don’t type # and > sign)
*this command will capture e drive which is HP recovery partition to D drive with file name as recovery.wim.
*I have saved the recovery image (recovery.wim) to D: drive, which is also Windows 7 installed partition. If you have External USB Harddrive then you can directly save the recovery.wim file to external drive. This will save your time and it is more convenient.
5. Now capture System partition i.e Partition 1. My system partition is Drive C
type:
#imagex64.exe /capture c:\ d:\system.wim “system” >enter (omit # , > sign and do not type enter)
* This command will capture sytem partition to d drive.
6. Now you can copy the captured wim files (recovery.wim and System.wim) to USB Hard drive or into you Desktop computer so that you can apply it to new Hard drive. When coping the wim files to usb hard drive please don't forget to copy imagex files. And copy all the files on the root of usb hard drive. Do not place those files unside a folder
Now insert the new hard drive (not the usb hard drive). We have to re-partition
PARTITIONING NEW HARD DRIVE
Steps:
1. Boot from bootable Windows 7 dvd or bootable flash drive. In my example, I’m booting it from usb flash drive.
2. When Windows 7 Setup ask for Language selection, press Shift + F10. This will open the command prompt
Now type the following commands (please don’t type # sign and > sign)
type:
#
diskpart >enter
#
select disk 0> enter
*This will select your hard drive
#
clean > enter
*this will wipe your hard drive (everything will be deleted, including data, partitions)
Now create system partition:
type:
#
create partition primary size=100 >enter
*this will create a primary partition with size 100 mb, we are creating this for System
partition)
#
format quick fs=ntfs label=”System” >enter
*this will format your 100 mb system partition with ntfs file system and label it as System.
#
assign letter=”S” >enter
*you have assigned system partition as letter S
Now create Windows partition:
type:
#
create partition primary size=100000 >enter
*this will create primary partition wit size 100GB, this is where we are going to install windows.
#f
ormat quick fs=ntfs label=”Windows” >enter
#
assign letter=”W” >enter
Now create Recovery partition:
type:
#c
reate partition primary size=14000 >enter
*we have created recovery partition with size 14GB
#
format quick fs=ntfs label=”Recovery” >enter
#
active > enter
*You have to make your recovery partition as Active. HP usually set Recovery partition as Active
#
assign letter=”R” >enter
NOW WE HAVE CREATED PARTITIONs. YOU CAN ALLOCATE THE REMAINING SPACE AFTER YOU INSTALL WINDOWS. Do not turn off your pc now. You have to attached usb hard drive (where you have copied you wim files.)
Now it’s time to apply the captured image to the new Hard Drive. In my example I copied my recovery.wim and system.wim to external usb hard drive.
APPLYING RECOVERY IMAGE AND SYSTEM IMAGE TO NEW HARD DRIVE
Steps:
1. Open the new command prompt by pressing Shift+F10
2. Go to usb hard drive
type:
#
g: >enter
*in our example , g is the drive letter of usb hard drive.
Now apply recovery image file to recovery partition (drive R)
type:
#
imagex64.exe /apply recovery.wim 1 r:\ >enter
*you have applied recovery.wim image file to drive R which is your recovery partition
Now apply System image file to System partition (drive S : )
Type:
#
imagex64.exe /apply system.wim 1 s:\ >enter
NOTE: When you reboot the system, you drive letter for particular partition may change, you can see the drive letter of particular partition any time by typing: list volume on diskpart windows.
After you apply the above image files. Reboot the system. Tap F11 while rebooting the system. This will take you to recovery window. From the Recovery Window, you can reinstall Windows to Windows partition.