Video Screencast Help

Cannot automate restore with a spanned image file

Created: 24 Oct 2012 | 4 comments

Hoping to get some help here as Symantec's own support system failed me again.

I'm trying to automate recovery using MS-DOS and Ghost 11.0.1(Part of GSS 2.0). We need to be able to boot from a flash drive and restore the image from that drive. I currently have the system booting from the drive and into ghost. The recovery starts, but stalls when looking for the next file in the span. I'm using the following switches:

-clone,mode=restore,src="c:\image\rad.gho",dst=2 -sure

The Image files all are located in the directory "C:\Image" with File names of RAD.GHO, RAD001.GHS and so on. After selecting the first span (RAD001.GHS) the system will find the rest of the spans by itself(there are 5 files total, 4 spans and the parent .GHO). When Ghostcasting the same image, ghost runs just fine.

Comments 4 CommentsJump to latest comment

EdT's picture

Have you checked that the flash drive is booting as the C: drive in all cases?  That is not my experience when working with different Lenovo models, for example, as some would boot the flash drive as A: and some would boot the flash drive as C:

Of course, if you already have a valid hard disk that the bios is allocating as drive C:, your flash drive may well be booting as a different drive letter.

My solution was to add some logic to the autoexec.bat that would check each drive letter starting at A: for a specific flag file that I had placed in the root of the flash drive, and then run an appropriate Ghost.exe command line argument that correctly specified the src location.

If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.

ApolloAudio's picture

This was my first thought. Every time I boot from the USB, it defaults to the c: drive. The script can find the first image in the file using the path provided in the switch, and when it prompts for the next span, it defaults to the correct directory. Are there flags in the image spans themselves that point to the next file by name?

ICHCB's picture

I am not sure if the following will work in DOS it is what I use in win pe from a usb drive and it has resolved the issues I had with drive letters changing around for my source.  In all of my cases the destination was always drive 1 so I didn't bother using a flag file for that.   In my ghost image I have a boot.txt to find the restored image drive, you won't need that since you are not using deploy anywhere and you will also need to change the folder it is looking for as you don't have the Windrivers folder on your usb but you can just as easily put a usb.txt on the root of it and then change the first variable from Windrivers to usb.txt.

Also you can drop the set os blind lines and make sure you change the ghost32 to just ghost.  My .gho files are in the data folder.

rem --- finding USB drive
for %%f in (C D E F G H I J K L M N O P Q R S) do if exist %%f:\Windrivers set USB=%%f:

set path=%path%;%USB%\ghost

cd \ghost

rem --- This will create primary OS drive configuration ---
ghost32.exe /setosdrives /blind >>%USB%\ghost\startlog.txt

rem --- Ghost Command to restore image.gho
Ghost32 -clone,mode=restore,src=%USB%\data\image.gho,dst=1 -batch -fx

rem --- Windows variable
for %%f in (C D E F G H I J K L M N O P Q R S) do if exist %%f:\Windrivers set USB=%%f:
for %%f in (C D E F G H I J K L M N O P Q R S) do if exist %%f:\boot.txt set BOOT=%%f:

rem --- DeployAnywhere command
ghdplyaw32.exe /target=%BOOT%\Windows /DDB=%USB%\WINDRIVERS

rem --- Win PE reboot command
wpeutil reboot

If you find this post helpful please give it a thumbs up!
If you find that this solves your problem please mark it as the solution! 

EdT's picture

Try changing the current directory to C:\image before you run Ghost.exe, (using the full path to the exe), to ensure that the operating system's current working directory is correct for all the image files before you start.  You could also try including C:\image in the "PATH" environment variable. Obviously if you are adding code to check the drive letter first, then you would need to amend the PATH statement and any change directory commands to use the correct drive letter.

If your issue has been solved, please use the "Mark as Solution" link on the most relevant thread.