RMPrepUSB Blog - please leave a comment or feedback on RMPrepUSB or this Tutorial (please mention Tutorial number).
This tutorial allows you to add some boot menu options to create a partition backup and restore option for your existing Windows hard disk. You do not have to re-format and re-install Windows to add a recovery partition.
Once set up, all the user has to do is press F4 for an automatic restore (with just one confirmation prompt only - but this can be removed if you prefer a fully automatic restore).
It uses CloneZilla and is based on a version posted by ndog37 on reboot.pro here. With this tutorial, you can quickly backup your copy of Windows at any time and then later restore any of the previous backup images. An XP backup takes approximately 5 minutes. Restoring an XP image takes approximately 1 to 5 minutes. Windows 7/8 will obviously take longer!.
The backup is made on the hard disk, so it is not suitable for off-line backups. The backup and restore options can also be fully automated so even your granny could restore Windows if it went wrong!
This tutorial assumes that your Windows OS is installed onto the first hard disk in your system, is the only copy of Windows on that hard disk and you have a backup partition on the first hard disk that has some free space to store the backup images in. If you have more than one partition containing Windows (e.g. dual-boot), then this tutorial will not work correctly and you will need to modify the menu.lst file substantially.
You can find out more about CloneZilla here.
Because this method installs grub4dos, you will need to ensure your computer boots from the Master Boot Record. If your Windows 7 or Windows 8 system uses UEFI booting, you will need to change the BIOS to CSM/MBR mode.
v1 2012-10-24 - First release - no Auto-Backup\Restore option
v2 2012-10-25 - 2nd version - added Auto-Backup\Restore option, split up long command line using grub4dos environment variables for easier editing\viewing, suppress keymap menu
v3 2012-11-01 - Added hotkey to menu, F4 for Restore from any Image, F6 for Auto-Restore
What we are going to do is to place a copy of Clonezilla on a spare backup partition on your hard disk, add some files and then install the grub4dos bootloader onto your hard disk.
After this has been done, your system will boot to a new grub4dos menu, as shown below (in this example we have a Windows XP system, so the menu shows Windows XP).
The menu.lst will automatically work out what partition is your Windows partition and what partition is the backup partition. When the menu is displayed, you will see which partition has been picked by the menu because the names listed in the menu will be changed automatically - e.g. sda1, sda2, etc. Thus it does not matter what partition arrangement you have as long as both the Windows and Clonezilla partitions are on the first disk (i.e. they can be in any order).
Linux disk notation:
sda1 = First hard disk (a), first partition (1)
sda2 = First hard disk (a), second partition (2)
sdb5 = Second hard disk (b), first Logical partition (5) - 1 to 4 are the primary partitions.
This is the grub4dos boot menu - after a 10 seconds countdown it will boot to Windows unless a key is pressed.
1. First we need to ensure that you have a spare partition on your hard disk that we can use to store the backup files and CloneZilla. This will appear on your system as D: and you will need to ensure that you have at least several gigabytes of spare space available on it. If you do not have a 2nd partition or you need to create a larger partition then you can use Windows Vista or 7 Disk Manager to delete, extend or shrink partitions. The Backup partition can be NTFS (preferred) or FAT32 and it can be a primary basic partition or a logical partition.
If you have a Windows XP system, you can download and use the free utility EaSeus Partition Master Home Edition.
PLEASE NOTE: The menu.lst will only detect the BACKUP partition if it is on the first or second internal hard drive.
2. We need some tools, so on any Windows system (it does not need to be the target system), download the zip file CloneZillaBackup.zip from the bottom of this page and extract the contents to a new folder on your hard disk (I will call this new folder c:\xxx).
3. Download the CloneZilla ISO file from here - I used clonezilla-live-20120620-precise.iso. Use 7Zip or some other utility to extract the \live folder from inside the iso and copy it to the C:\xxx\clonezilla folder. Only three files are actually needed but you can copy the whole live folder if you like.
4. You should now have a folder structure like this (where xxx can be any name you choose):
5. Now copy the the xxx folder contents (via a USB drive or via the network) to the backup partition (D: usually) of your target system - you should now have this folder structure (assuming D: is your backup volume)
6. To install grub4dos onto your target internal hard disk, double-click on the file D:\clonezilla\InstallGrub4dos.cmd - If you receive no error message then press Y and hit the <Enter> key.
7. It is time to reboot your system and check that you get the new menu and that you can still boot to Windows. Restart Windows and you should see the new boot menu, if you wait 10 seconds, it should then boot to Windows as normal. You can simply hit <Enter> to avoid the 10 second wait.
8. When the system has rebooted to Windows, double-click on the file D:\Hide.cmd to hide the \clonezilla folder and a few of the grub4dos files - only the D:\UnHide.cmd file should now be visible in Windows Explorer (unless you have changed the Folder View default options).
9. Finally, we need to create a Windows Backup Image - reboot the Windows system and when you see the grub4dos boot menu, choose '2 Create Backup Image' (press 2 and the <Enter> or use the Down or Right cursor keys). You will see a blank screen with a flashing cursor for a few seconds and then some linux boot progress text. The current menu does not allow you to select a keymap, if you delete the preseed option (see below) then you will then see a 'Configuring console-data' screen heading and be able to choose a keyboard type.
If all is well, you should eventually now be offered a file name to use for the backup that you are about to make - e.g. 2012-20-23-12-img - you can change this name if you like and then click on OK to continue.
Clonezilla should then automatically backup your Windows volume (usually sda1) and then reboot.
If you want to have a simple single-backup option, use the 4 Auto-Backup menu - this is fully automated and always backs up to the file IMG.
To restore a previous Windows backup image, reboot and select the '1 Restore Backup Image' option. You will be able to select one of any of the previous backups that you have made and restore that image. When complete Clonezilla will reboot the system automatically.
Tip: to quickly check that the image backup/restore is working, make a backup and then change your Desktop wallpaper and then reboot and restore the original image - your wallpaper should now be changed back again.
The 3 F6 Auto-Restore menu is fully automated and will restore the backup (IMG) made by Auto-Backup (option 4). This means you could remove all other menu options and just leave the F6 menu so that the user could restore the IMG image. If you also deleted the -c option from the menu, the image restore would be completely automatic with no user prompts whatsoever (and all new user data would be lost!). Note that if no IMG backup already exists, it will report an error and reboot.
If you are stuck at a grub4dos prompt and you get no menu and it won't boot to Windows, to boot to Windows, type:
The text file menu.lst controls the menu appearance and the backup/restore optons:
1. If you want to change the background image, use an 800x600 24-bit or 32-bit colour bitmap and change the name in the menu.lst file (see 'How it Works' below).
2. If you don't see a nice bitmap background on the boot menu, it is probably because your system does not support 800x600x32 graphics mode. Please refer to the grub4dos tutorial for information about high-resolution background images and how to make it work for your system. Use the UnHide.cmd batch file to unhide all the files on the D: volume so that you can easily alter them. Typically you will need to run vbeprobe inside the grub4dos console shell (press c in the boot menu) to see what graphics modes you have available, then find a suitable bitmap of matching resolution (e.g. 1024x768x24 colours) and then edit the menu.lst file to change to the correct graphics mode and display the correct bitmap.
3. The current menu will not prompt the user to select a keymap, this can be added if you delete the text ocs_live_keymap="NONE" from the kernel parameter list in the menu entries.
4. You can delete the 'Auto-Backup' and 'Auto-Restore' menus (starting at title) or you can delete the 'Restore Backup' and 'Create Backup' options or the manual menu, as you wish. Simply edit the menu.lst file using Notepad.
5. To not prompt the user before an auto-backup or auto-restore is actually performed (i.e. fully automated backup/restore), remove the -c option from the middle of the RUN1 parameters in the menu.lst file.
6. The latest version has the hotkey grub4dos utility added. This allows the user to press a function key to execute a menu item. You can change the function key number by editing the menu. See Tutorial 57 for more details.
Once grub4dos is installed the boot sequence is as follows:
The menu.lst file is shown below with extra comments in colour (note: some long lines may be wrapped over onto the next line!):
If you want the user to see a splash screen but no menu at all, the user will then have no idea that the backup/restore menu exists. After 10 seconds the splash screen will disappear and the system will boot to Windows as normal. However, if the user hits a function key, the appropriate menu will be activated. This can be accomplished by changing the menu slightly as below:
write (md)0x220+1 !BAT\necho -n -P:0000 $ \0initscript (md)0x220+1
/clonezilla/menusetting.gz 0 0 0 0 0 0 0 0
If you want to return to a normal booting system and remove the grub4dos bootloader and menu system, run RMPrepUSB hit Ctrl+F5, select the HDD and then hit Ctrl+B.