Thanks 4wd for the links. I hadn't heard of this site but looks to be very informative. I didn't see it posted anyware on the linked pages but how does the recovery menut get started?
The Setting up a multiboot/dualboot
shows you how to install MrBooter, a small boot loader that resides in the MBR that opens a menu so you can select which OS you want to boot into. It always gets displayed when the PC gets booted, exactly the same as the normal XP ntldr when you have more than one OS installed - in fact you could just use the normal XP ntldr.
eg. In your case you'd have an NTFS partition which contains the normal bootable XP OS plus
a smaller FAT32 DOS partition that contains the partition restore program and the XP OS image.
I haven't looked at MrBooter but most boot loaders have a way to specify a default boot option with a timeout value, ie. after 5 seconds load XP.
However, within that timeout period you can select to boot into the DOS partition which you can set up with an autoexec.bat file to automatically restore the NTFS partition from the image stored on the DOS partition.
This is basically what Acronis and other similar programs do, albeit in a bit more colourful fashion.
As a simple safeguard against accidental restoration you can have your batch file ask for acknowledgment, (eg. Enter 'I want to restore' to proceed: ), before continuing or you could make it more complex.
A simple procedure:
First a few assumptions:
1) You start from scratch with a blank HDD - it is a LOT simpler
2) The target PCs have no floppy/CD/DVD or anything other than a HDD to boot off, (you will need a floppy for installing the MS-DOS system files though - USB floppy drives are cheap);
3) You know what you're doing. a)
Using a MS-DOS 98, or better, system floppy, use fdisk to create a FAT32 DOS partition of about 3GB then format it with the /s switch to copy across the system files to make it bootable, (check BootDisk
for floppy images).b)
Now install your XP OS, (plus any base programs you require), into the remaining
area of the HDD, (it'll need to be NTFS IIRC). The XP install will see the DOS partition and add it to the boot.ini menu - XP will be the default with a timeout of 30 seconds - this can be changed later.c)
Create your XP OS image using the programs/instructions found at Imaging: create a Windows system image
- you should end up with an image of your XP install and a boot floppy that's used to restore it, (at least I assume so, I haven't actually read/done what the page says).d)
The programs on the floppy can now be copied to your DOS FAT32 partition along with the image you created. If the image is too big for the 3GB partition you created then you can resize the partitions to suit using GNU Parted
Edit the default autoexec.bat on the DOS partition to do what you want, eg. run restore immediately, ask acknowledgment, etc.f)
Boot into XP, if you're not there already, and open My Computer->Properties->Advanced->System Startup.
The top section describes the contents of the boot.ini file. Set the 'Time to display list of operating systems:' to 5 seconds.
Click the 'Edit' button, boot.ini will open in Notepad. Under the section [operating systems] you'll see two lines similar to the following:
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /noexecute=optin /fastdetect /usepmtimer
Change the "C:\DOS" to read "Restore OS" or something similar, then exit Notepad, saving the file.g)
All being well, you've just finished - sit back, relax, go fishing.
Upon booting the PC you should see a boot menu giving you the two choices for a period of 5 seconds before it defaults to booting XP.NOTE:
The only possible drawback to this simple method is that the XP system will reside on D:\ because MS-DOS is C:\ - most people are sheep1
when it comes to following instructions to install software and the instructions almost always say, "Install to C:\..........." - however I'm sure that suitable
instructions can be made to make the
people aware of this.
Also, it might pay to make the MS-DOS partition Read-Only from within XP - you don't want your recovery image being inadvertently written over or deleted - see Addendum.Addendum:
There's probably a way in which you can make the MS-DOS partition hidden, (by setting a bit in the partition identifier like they do in Acronis, etc), but I'm not sure if it is able to be booted into if that is done. ie. The Partition Type for a standard FAT32 is 0x0B, for a Hidden FAT32 it is 0x1B. It is easy enough to try though, download ptedit (ftp://ftp.symantec.com/public/english_us_canada/tools/pq/utilities/ptedit.zip), (free PowerQuest Partition Type editor), extract and run it.
It should show two partitions, click in the Type box of the first one, (which should be 0B), click the 'Set Type' button, scroll down and select 1B, (Hidden FAT32), then OK, then 'Save Changes'. In theory, it should no longer show up in XP - all you need to check is whether you can still boot into it via the Recovery option on the boot menu.1) I apologise to the sheep out there.