Ghost How does one load an image to a partition then schedule it?

Yes,

I have searched for a while, no answeres here or google searches for this seemingly simple question

 

I have machines with 2 partitions partition 1 is c:  Partition 2 is D:

D: has the .gho image I want to restore to C:

ghost.exe resides on th D:

 

I get no results when I use  

 

ghost -clone,mode=pload,src=d:\restore.gho,dst=1:1 -fx -sure -batch  (borrowed this from the internets)

 

ghost and the image are on D:

 

I don't understand how the parameters above would force the restore on  C: anyway sice there is no refrence

 

I want to use the msft task scheduler to trigger restoring C:  From a saved image in partition D:

 

Is what I'm requesting even possible?

 

Dave,

 

Thank you for the reply.

 

I did not see anything pertaining to partition from image command so I'm still looking for how to do this from the command line.

 

 

On drive 2, where I have the image to restore, ghost32.exe resides  I'm attempting to load the image from D to partition C:

 

Normally I insert a ghost usb key and reboot then make my selections manually

 

The link below is to a Ghost manual.  On page 539 is where the fun begins, the clone switch is kinda explained.  You'll note no explanation save one for restoring a partition from an image.

http://service1.symantec.com/SUPPORT/on-technology.nsf/docid/2008050108242360

 

This is what I submitted

ghost -clone,mode=pload,src=d:\restore.gho,dst=1:1 -fx -sure -batch  (borrowed this from the internets)

 

This is revised

 

ghost -clone,mode=prestore,src=d:\restore.gho,dst=1:1 -fx -sure -batch    Not much of a change.

 

Still neither work.

 

Stil there is no example for restoring a partition from an image.   Again, am I adking the impossible of ghost?  I can execute this operation manually, why can't I execute from the command prompt?

 

Is there an open source alternative  you reccomend?

 

Mike,

 

I played with this some time ago. I had the computer scheduled to shut down at 3 am, run the DOS Ghost restore and restart into Windows.

 

Just a few questions. Which OS? Which DOS Ghost? How do you plan to run the Ghost command line? From a USB flash drive, from a CD, from a HD DOS partition, etc? How often will you be doing this? Apart from general interest, why do you want to do this?

OK, your talking about Ghost solution suite.

 

I'm pretty sure "prestore" is used to restore a selected partition from a multi-partition image (a whole disk image).  When you use that you would have to specify the partition you want to restore after the path to the image.

ghost -clone,mode=prestore,src=d:\restore.gho:X,dst=1:1 -fx -sure -batch

The ":X" I added there would be partition to restore 1, 2, etc.

 

 

But if it's a image of a single partition you just need to use mode=restore

Just take the "p" of the front of "restore" in your line there and it should work.

 

But as Brian asked, you need to first figure out how your going to run Ghost from the command line or batch file.

What I was trying to explain was that right now if you started the Ghost32 executable on the D drive and manually tried to restore the image it would not work.  You would be trying to use Windows on the C drive to run the executable and you can't restore the windows partition on a windows partition that is in use.

 

When your doing this from your flash drive you are doing this "outside" of the operating system your restoring.

So you'll need to also do this "outside" of windows, either from DOS, or another operating system.

 

Dave

 

 

Dave and Brian,

 

Thank you for your comments.

OK so what am I trying to do?

 

I have a rack of 5 test machines, each with 2 partitions, c: is the working drive, D: is the repository

I want to have the machines restore at a set time just as Brian described.

Currently all machines are W7x32 with one W7x64

 

Why do I want to do this?

 

I am trying to automate test deployments, part of this requires restoring the test machines to a baseline.  I've got all of the GUI automation working (C# with the WHITE wrapper).  Now I need to automate the restoration of a machine to facilitate the install.

I would have used a virtual machine solution (easier) except the application under test needs physical components, VM's don't do that hence Ghost..

As an aside, last time I ran across a similar issue that seemed simple, programatically generating a process dump using C#.  Lots of info on how to do it by invoking a separate tool, zero info on how to code a dump generator that does not rely upon any other installed software (well, not anymore, I share my information:-)One Christmas vacation later I coded my own solution using a C++ interop since C# does not provide this functionality.  Lesson learned, what sems to be simple can be insanely complicated

 

What if I create a micro partition on the host drive with DOS and place ghost there?

 

Brian, what did you do to schedule the task nightly?  I use the task scheduler regularly?

 

Thank You,

 

Mike

 

 

Mike,

 

I found it to be an interesting exercise.

 

I used an 8 MB DOS partition containing ghost.exe (Ghost 2003) and pqboot.exe. At 3 am a Windows Scheduled Task would run pqboot32.exe to restart the computer into DOS. The command line would run and pqboot.exe would take the computer back into Windows.

 

You didn't mention which DOS Ghost you are using. It could make a big difference with Win7 as the BCD may need to be edited to run smoothly.

 

This was my restore command line. Adapt it to your situation and see if it works. Get back to us. Auto restores are fascinating.

 

ghost -clone,mode=prestore,src=2:2\winxp.gho:1,dst=1:1 -fx -sure

 

prestore has replaced pload in Ghost 8 and later although pload is probably OK

My winxp.gho was on the second HD, second partition (numbers determind by the Ghost app, drop down list)

The restore partition was on the first HD, first partition

winxp.gho:1   The :1 was necessary but I can't recall why.

 

 


Brian_K wrote:

 

winxp.gho:1   The :1 was necessary but I can't recall why.

 


I just told you why, do you have your preferences set to not disply my posts? LOL

Would you happen to know how DOS could be setup on a drive other than C?

Or how you could change the windows 7 bootmenu from a command line?

 

 

 

If I were to do something like this using XP I would setup a dual boot between DOS and XP.

In DOS I would have the autoexec go into the Ghost restore of the XP partition.

 

Then I would make 2 boot.ini files, one that booted XP and one that booted DOS.

The scheduled task in XP would first rename the current boot.ini to boot.xp and would rename the boot.dos to boot.ini

Then it would trigger a reboot.

The system would boot into DOS and restore the image, the last couple lines of the autoexec.bat would switch the boot.ini files back around.

 

If I wanted to get fancy I would add a "choice" command to the autoexec. The default choice would do the restore, the one that needed a user input would just start ghost (use that to update the recovery image as needed).

 

Since the boot.ini files are only switched in a scheduled task, the end users never see the option to boot into the restore and they could reboot as normal to install software.

 

I have no idea how I would do it with Windows 7. LOL

Dave

 


DaveH wrote:

I just told you why, do you have your preferences set to not disply my posts? LOL


 

Dave, you did too! I was using a partition image not a whole drive image so your comment didn't sink in to my thick skull.

 

Did you ask how I set up DOS? I have it written out if anyone is interested.

 

I'm not sure if pqboot32.exe runs in Win7. If it doesn't there are alternatives.

 

 

I was wondering if you knew how install DOS to another partition. If Mike has to keep windows 7 on the C drive he would need a way to boot to DOS on another lettter.  I also have no idea how to start DOS from the windows 7 boot manager.

 

I opened EasyBCD and I see an option to add windows 98 so it must be possible.

Dave

 

Drive letters exist in the mind of the booted operating system so Win7 will be C: drive and DOS will also be C: drive. I have about 15 C: drives in my computer.

 

I tried pqboot32.exe in Win7 in my test computer. It sort of works. There are a few error messages but then Win7 reboots. I'll try it later on a better computer.

 

Brief instructions on how to install DOS in an 8 MB partition, anywhere on HD0 (using WinXP here but Win7 could be present instead)....

 

Download
http://www.allbootdisks.com/downloads/ISO/AllBootDisks_ISO_Image_Downloads25/Win98SEnoram_bootdisk.iso  

Burn as an image to a CD.

 

Install BING

In BING create an 8 MB FAT partition
Create a DOS boot item with only one partition in the MBR and make it active (shift boot)
Boot from the Win98SE CD and sys C: 
Put the DOS partition in WinXP boot MBR. Boot to WinXP and copy all the files from the CD (have to unhide OS files to get them all) to the DOS partition. Don't over write files already present..  You can delete unnecessary files later.
(After unhiding hidden OS files you see command.com, drvspace.bin, io.sys and msdos.sys)

Copy ghost.exe, pqboot.exe and ctmouse.exe to the DOS partition. Create your ghost.bat.

 

Edit autoexec.bat to

 

@ECHO OFF
PROMPT $p$g
echo.
ctmouse.exe
call ghost.bat
echo.

 

Edit msdos.sys to (have to temporarily remove Read Only)

 

[Options]
BootWarn=0
BootWin=1
Logo=0

 

Edit config.sys to

 

DEVICE=HIMEM.SYS /testmem:off
DOS=HIGH,UMB
FILES=30
buffers=10

BING can be uninstalled.

 

Edit.... Once you have made the DOS partition you don't have to do it again. You can image/restore to other computers.

 

 

 

 

Thanks Brian, very interesting.

I have pqboot in partition magic and Drive Image. This system I'm on right now I use drive image for backups.

 

I never knew what pqboot does, I ran the DOS version with /? and it says "Activates the selected partition and reboots the computer"

So that solves the problem of active partitions and rebooting.  You wouldn't need to use my suggestion of installing DOS on the C drive because thats the reason why I thought it would have to be on C.

 

Assuming that XP is NTFS if you created a second FAT32 partition and booted with the win98 boot disk or ISO, of course it couldn't read the NTFS drive, it would give the second partition the temporary letter C.  When you did a "sys C:" I'm pretty sure it would then be transfering the system files to the second partition.

Then you could copy the rest of the files over and maybe even use fdisk to make the first partition active again.

(I haven't tested any of that yet)

 

But if you made it that far you would only need to add the DOS to the boot menu and back in xp\7 copy the rest of the files there and write the autoexec.bat

 

You might as well make it a larger FAT32 partition and keep your images there too.

 

My ghost.bat was

 

ghost -clone,mode=prestore,src=2:2\winxp.gho:1,dst=1:1 -fx -sure
pqboot /p:1

 

So after the restore had completed, Win7 (partition 1) would boot.

 

I'm still looking at running pqboot32.exe from Win7. There is an error but after pressing Enter it works. Do you know how to get around this?  pqboot32.exe is needed to shut down Windows at 3 am and boot into DOS.

 

 

I tried it again and BING doesn't have to be installed.

 

Create an 8 MB FAT partition using the BING CD
Boot from Win98 CD and sys C:  (check to make sure C: is the DOS partition before doing this)
Boot into Windows and copy the files as previously described


If you later want to boot into DOS, set it active from the BING CD.

 

Edit... You should be able to do this project without using BING. Use your favourite partitioning app.

 

 

I don't know how you could get past a key press unless there are some undocumented switches to continue.

 

Maybe for windows 7 a batch file could be scheduled?

I'm not sure how you would "string together" all the commands for diskpart to set an active partition but the reboot part would be easy: shutdown /r

 

Going from DOS/XP back to 7, pqboot is a clear winner.

 

If someone didn't have pqboot it would have to be a 2 step deal.

How about mbrwork?

 

edit- I don't have a windows 7 system on right now, just XP

I run mbrwork /? from a command line and got these options

 

Valid parameters:

Ax - Set partition x (0-3) active

R - show recovery option even when EMBR exists

To have it automated, pqboot or TeraByte's bootndos and mbr.exe would work. There must be more.

 

pqboot32,exe works fine in WinXP but not in Win7.

Brian- I once spent a lot of time trying to figure this one out and since you mention pgboot I wonder if you know.

Do you know how powerquest drive image and I assume partition magic were able to boot into a floppy image?

 

As an example, drive image has a floppy image and it also gives you a tool (winimage) to edit it if you need to add drivers or something.  When you set the program to image or restore the system partition, it does something that makes the system boot into this floppy image. The image gets created or restored from the floppy image just like what were trying to do here.

However, unlike the old ghost 2003 that used a virtual partition, these did it from a floppy image.

 

Would you have any idea how it did that?

Dave, I used Drive Image years ago but I never understood how the virtual image worked.

 

Is Drive Image still OK? I heard there was a limitation. Can it handle large HDs? I've forgotten the details.

I'm not sure if it has any drive size limitations. I never had a primary partition over 30-40GB.  I think on my wifes laptop she has an 80GB partition.  I also don't think I ever used it with a drive over 250GB but it wouldn't suprise me if it had the same large drive limitation that powerquest partition magic has (1TB?)

 

The big limitations that I know of is that it's unable to write an image onto an NTFS partition.  It can image and restore one, it just can't read and write an image to NTFS. But that doesn't bother me, I setup my systems using it with a FAT32 partition to hold the image.

 

The second limitation is it doesn't work with windows 7 :(

 

I been using it for years and really trust it.

I also picked up a whole mess of deeply discounted version 2002 and back when I used to fix and build systems I would install a version on every system and image it so when the user screwed it up I could restore it in a snap. ;)

 

I never been able to figure out how Ghost 2003 could write to NTFS without any drivers. Amazing feat actually.  But I disliked the way the program required a free primary spot to be able to reboot and do the image.  It booted into a virtual hard drive partition and drive image booted into a floppy disk image.

 

I tried figuring it out before but never could.  It boots into the floppy image well before the point where windows starts to load.

It must be manipulating something before or at the boot sector.

 

I thought it would be a handy thing to figure out at the time. Being able to multi-boot into different floppy images would have been helpful.

 

I recently ended up making those floppy sets into DOS based ISO's and boot them with grub, starting grldr from my boot.ini

 

 

 

 

pqboot32.exe doesn't run properly as a scheduled task in Win7. No problem however. Forget it.

 

You can run a diskpart task at 2:55 am to set the DOS partition active and a shutdown task at 3 am to restart the computer into DOS.

 

In the DOS partition, if you don't have pqboot.exe you can use TeraByte's mbr.exe (free app).

 

eg       mbr 0 0 /a /reboot 

 

This will set partition 0 on hard drive 0 active and cause a reboot.

 

 

Edit.... Even easier than using diskpart and shutdown. You can use the Windows version of mbr.exe. It is far better. A single simple command line. Similar to above.

 

eg mbr 0 1 /a /reboot

 

( In the above examples the HD is 0, partition 0 is Win7, partition 1 is DOS)

 

 

Following Brians instructions, I just did it in windows vista.  I'm using virtual PC and I chose Vista because it runs so much better than windows 7.

(They never released any windows 7 additions for virtual PC).

 

On a working Vista installation I used disk management to shrink the vista partition about 30MB, however I would consider shrinking it enough to store the images on it as well. On a FAT32 partition ghost will split the image files into 2 or 4GB pieces but that won't matter.  Since my free space was so small I had to choose FAT.

So in disk management I made the free space a 30MB FAT primary partition.

Note that I have vista on one partition, I also install my Windows 7 installs on one partition without the SRP.

 

I end up with one virtual hard drive having 2 partitions. Vista on NTFS, DOS will be on the small FAT one.

 

I boot the drive with a Windows 98SE boot disk and do a: SYS C:

(I had already checked that it didn't see the NTFS partition and lettered the small FAT one as C)

 

Then I boot back into Vista, it boots right up since I have not changed the active partitions yet.

I go to the D drive (DOS) partition, delete drvspace.bin and make a folder called Dos so I can keep everything tidy.

In the Dos folder I add: Mouse.com, ghost.exe, choice.com, edit.com, mbr.exe (the dos version) and mbr32.exe (the windows version I renamed)

I also make and add 2 .bat files for that folder

 

BootDOS.bat

contains:

D:\DOS\mbr32.exe 0 1 /a /reboot

 

Boot7.bat

contains:

mbr 0 0 /a /reboot

 

Back in the root of the D drive I make an autoexec.bat file with this:

 

@echo off
PROMPT $P$G
path=C:\;C:\DOS
MOUSE.COM

CHOICE /C:123 /T:1,15 Press 1 for Restore, 2 for Win7, 3 for DOS
IF ERRORLEVEL 3 GOTO DOS
IF ERRORLEVEL 2 GOTO WIN7
IF ERRORLEVEL 1 GOTO RESTORE

:RESTORE
echo Restore System
REM Put your Ghost command here
REM boot7.bat
GOTO END

:DOS
echo Your in DOS
GOTO END

:WIN7
boot7.bat

:END

 

 

You see that I didn't put in the ghost.exe commands. I didn't actually test that part.

 

Right clicking on the BootDOS.bat file and selecting "run as administrator"  reboots the system into DOS.

To make it a scheduled task you may not have to run the batch file, just put that one line command in.

 

When the system boots to DOS I get 3 choices:

1) will do the restore and it will default to this selection after 15 seconds.

2) Boots into Win7 (Vista) without doing anything

3) drops into DOS (use this to make or update the image, just type: ghost)

 

I added edit.com cause I had to make a few changes to get it to work.  I actually added a bunch of other DOS tools but didn't end up needing any.

 

Thanks Brian :)

Dave