I've got sweet Adata 256GB SSD as the main drive in my workstation, but today's solid state drives are not reliable enough in my opinion. Theoretically when they die, they become a read-only flash media, but I've heard too many nightmare stories about SSDs suddenly go dead the next morning, without any chance to recover your data from it. Obviously the first thing you have to do is making frequent backups, but it's worth preparing for the total loss of the SSD (or your system HDD for that matter). What will you do until you can get it replaced? In a desktop computer there's plenty of space for my Plan B: having a bigger hard disk with a fresh (enough) copy of the SSD partitions, from which you can boot your computer and continue to work like if nothing happened.
For this you can kind of use the full system backup function in Windows, but if you ever tried it, you know about its limitations when it comes to restoring the image. It's much better to use the MiniTool Partition Wizard from which the Home Edition is free and has all the features we need to copy and activate partitions. It even lets you resize them while copying, so it's the perfect tool for the job. Also once you installed it, you can simply copy its folder from Program Files and use it in portable mode without the need to install it on any system. As it happens, it's a key feature because you shouldn't make a copy of your Windows partition while it's running, right?
I've been using a customized Windows PE (Preinstallation Environment) for these kind of rescue operations since the Vista days, it's basically a minimized version of Windows that you can boot from DVD or a USB flash drive and use for deployment, or simply for accessing and repairing a broken system. Now that I'm using Windows 8, it was time to create a new rescue media based on the new Windows PE 4.0 which now supports .Net Framework 4.5 applications and Windows PowerShell 3.0 if you set it up. It's not going to be a full blown guide to create a Windows PE image (there are dozens you can find) and I'll deal only with the latest version for Windows 8, even though the steps are roughly the same for previous versions of Windows PE. For extra content here are the official walkthrough guides for Windows 8 and for previous versions. It's also worth mentioning that I won't over-explain everything and I take no responsibility for your actions if you mess up something in your system. If you can't follow this guide, chances are you shouldn't deal with it at all.
The first step is installing the Windows PE related bits from Windows Assessment and Deployment Kit (ADK) for Windows 8. The previous versions were called Windows AIK, search for it in the Download Center. Start the Deployment and Imaging Tools Environment as Administrator, all the build commands will be entered into this command window. Its default directory is this:
C:\Program Files (x86)\Windows Kits\8.0\Assessment and Deployment Kit\Deployment Tools
In this example I will use C:\WinPE as the working directory where the image will be assembled and I chose the x86 version to work on. You may create an amd64 version (apply your changes to the commands below) but it won't run 32 bit programs at all. To create an instance of the basic build, enter this command:
copype x86 C:\WinPE
It will create the C:\WinPE directory and a bunch of files in there. The Media directory is what we will put on the bootable media. The image we work on is under Sources\boot.wim and for customizing it needs to be mounted into an existing but empty directory, then it has to be unmounted to save the changes we made, back into the boot.wim file. We will use the C:\WinPE\Mount directory for this, note that it's empty. For mounting and unmounting we will use the following commands, you may create a batch file for both to make it easier to customize the image, probably you will do it several times before everything is perfect for you.
rem Mount the image into the work directory to customize imagex /mountrw C:\WinPE\Media\Sources\boot.wim 1 C:\WinPE\Mount rem Unmount and commit changes to the image imagex /unmount /commit C:\WinPE\Mount
Once you mounted the image file, you can see its contents in the previously empty Mount directory. To avoid a lot of typing, create a batch file with the following commands that will install various packages into your image. You have to do it only once, the order of the packages do matter due to their dependency. You may check out the other packages in the WinPE_OCs directory and if you want to do custom localizations, you have to add your selected language resources beside the en-US versions. If you will use your Windows PE only in English, you are fine with this below.
rem Go into the x86 packages directory cd /d "C:\Program Files (x86)\Windows Kits\8.0\Assessment and Deployment Kit\Windows Preinstallation Environment\x86\WinPE_OCs" rem Windows Script Host (WSH) support dism /image:C:\WinPE\Mount /add-package /packagepath:"WinPE-Scripting.cab" dism /image:C:\WinPE\Mount /add-package /packagepath:"en-us\WinPE-Scripting_en-us.cab" rem Windows Management Instrumentation (WMI) support dism /image:C:\WinPE\Mount /add-package /packagepath:"WinPE-WMI.cab" dism /image:C:\WinPE\Mount /add-package /packagepath:"en-us\WinPE-WMI_en-us.cab" rem Microsoft Data Access Component (MDAC) support dism /image:C:\WinPE\Mount /add-package /packagepath:"WinPE-MDAC.cab" dism /image:C:\WinPE\Mount /add-package /packagepath:"en-us\WinPE-MDAC_en-us.cab" rem HTML Application support dism /image:C:\WinPE\Mount /add-package /packagepath:"WinPE-HTA.cab" dism /image:C:\WinPE\Mount /add-package /packagepath:"en-us\WinPE-HTA_en-us.cab" rem .Net Framework 4.5 (subset but most features are supported) dism /image:C:\WinPE\Mount /add-package /packagepath:"WinPE-NetFx4.cab" dism /image:C:\WinPE\Mount /add-package /packagepath:"en-us\WinPE-NetFx4_en-us.cab" rem Windows PowerShell 3.0 dism /image:C:\WinPE\Mount /add-package /packagepath:"WinPE-PowerShell3.cab" dism /image:C:\WinPE\Mount /add-package /packagepath:"en-us\WinPE-PowerShell3_en-us.cab" rem Windows PowerShell 3.0 cmdlets dism /image:C:\WinPE\Mount /add-package /packagepath:"WinPE-DismCmdlets.cab" dism /image:C:\WinPE\Mount /add-package /packagepath:"en-us\WinPE-DismCmdlets_en-us.cab" rem Allocated writeable memory in MB (32, 64, 128, 256, 512 - Default: 32) dism /image:C:\WinPE\Mount /Set-ScratchSpace:512
With the same dism command you can make other changes, do localization and install optional device drivers, see the walkthrough links above but normally it's not necessary to do so.
Unmount the image (make sure absolutely nothing keeps the Mount directory open, file manager windows, command line or whatnot) and back up the boot.wim file if you want. If you made a mistake and you want to discard your changes, or there is a problem (open Mount directory for example) and the unmount command can't close your image, you should unmount it without adding /commit. Your basic Windows PE is pretty much ready but there are some other things you should add to it.
You should add ImageX which can be a very powerful tool to make backups into a single, optionally compressed wim file and restore it to the same partition or to a new disk. Copying the exe file itself may be enough, but you should just copy the contents of this directory into Windows\System32 of your image, mounted into the Mount directory:
C:\Program Files (x86)\Windows Kits\8.0\Assessment and Deployment Kit\Deployment Tools\x86\DISM\
Create a Tools directory in your image's root and put some tools in there, I always add Far Manager, command line tools like rar and zip, shortcut batch files, a text file with reminders of useful commands and the above mentioned Partition Wizard which will surely come handy. You may also add Raw Copy which is another tool to copy partitions and remember, you can add programs written for .Net Framework 4.0 / 4.5 too, they will run like a charm.
You should create/modify startnet.cmd in the Windows\System32 directory of your image, the commands you put in there will be executed when Windows PE opens its initial command line prompt. Beside displaying some info there with echo commands, I also do this (all between @echo on and @echo off lines) :
rem Put X:\Tools on path for easy access set PATH=%PATH%;X:\Tools rem Start Far Manager cd \ regedit /s \Tools\Far\Far_Config.reg start \Tools\Far\far.exe rem Start Notepad with my reminder notes start notepad.exe \Tools\readme.txt
When Windows PE is up, the image is loaded into a RAM Disk which gets the drive letter X by default. As you can see, I put the X:\Tools directory on path for quick access to the files in there, so I don't have to copy everything into the Windows directory, it's all nicely separated. Unmount the image and you're pretty much done, you just have to put it on a bootable media.
I recommend using a USB flash drive for this so it will be easy to change the image and add other stuff, not necessarily into the image but on the drive itself. In that case you have to figure out the assigned drive letter of your boot device in order to use them, PStart may help you out with that. To make the drive bootable, use these commands and at select disk you obviously have to enter the number of your pendrive you see in the list of disks.
diskpart list disk select disk # clean create partition primary select partition 1 active format quick fs=fat32 assign exit
You can also use a rewritable DVD for this, for example my rusty Macbook and my wife's Macbook Pro refuses to boot from this flash drive (possibly a UEFI boot issue, DVD works), but it's bootable on everything else. At this point you can simply copy the contents of the Media folder to the drive, or use one of these commands:
rem Format the flash drive H: and copy the Media directory on it MakeWinPEMedia /ufd C:\WinPE H: rem Create a bootable ISO that you can burn onto a CD or DVD MakeWinPEMedia /iso C:\WinPE C:\WinPE\WinPE.iso
Once your flash drive is ready and it works, you can simply replace the Sources\boot.wim file on it after you applied some changes, no need to format the drive again. If you don't want to deal with localization at all, you can remove the da-DK kind of directories in the Media directory and its sub-directories to clean it up, but you should keep en-US everywhere.
Now that your Windows PE Rescue Disk is ready, you can do your periodical hard disk partition backups, and restore from them when it's necessary. For an always working copy of your system disk partitions, copy them with Partition Wizard to a secondary disk where you left out enough partitioned or unallocated space for them. You can use the rest for additional data storage, like I do on my workstation. If you want, you can create the partition during coping onto an unallocated space and can set a different size to expand or reduce it. Make sure you choose the same partition type (Primary for me) and set the copy of the system partition Active.

You can also use ImageX that you added to your Windows PE system, like this:
rem Backup partition C: into a single WIM file imagex /capture C: D:\backup.wim "Backup" rem Restore partition C: from a single WIM file imagex /apply D:\backup.wim 1 C:
When you copied or restored the system partition, you have to make it bootable with the commands below, set up for Windows Vista or later versions. I used drive C: in this example but it works for any drive letter you want to handle, for example a bootable backup partition on another drive might be on E: after you assigned a drive letter to it.
bootsect /nt60 C: /mbr bcdedit /set {bootmgr} device partition=C: bcdedit /set {default} device partition=C: bcdedit /set {default} osdevice partition=C:
That's it! According to my Plan B, if my SSD dies, I just make my HDD the primary disk and boot from it, restore some recent file backups and wait until I can get a new SSD because I'm way too addicted to its amazing speed by now. :-)
