Ghost Solution Suite

 View Only
Expand all | Collapse all

Bootable USB drive, where the ghost image starts automatically

  • 1.  Bootable USB drive, where the ghost image starts automatically

    Posted Aug 27, 2010 02:27 AM

    Hello,

    I'm used to creating bootable ghost images on DVD's using:

    @echo off
    Rem – scan for a file in the root of the DVD called IMAGE.GHO and set system variable %DVD%
    for %%f in (C D E F G H I J K L M N O P Q R S T U V W X Y Z ) do if exist %%f:\IMAGE.GHO set DVD=%%f:
    x:
    cd \ghost
    Ghost32 -clone,mode=restore,src=%DVD%\IMAGE.GHO,dst=1 –sure

    But I need to do the same operation from a USB drive,

    I'm using ghost solution suite 2.5 with build 11.5.1.2266, and using the Ghost boot wizard selecting WinPE.

    Thanks, 



  • 2.  RE: Bootable USB drive, where the ghost image starts automatically

    Posted Aug 27, 2010 04:01 AM
    It's not entirely clear what you are asking here.
    You can do the same from a USB drive as from a DVD.
    I'm also unsure whether your DVD solution is using WinPE or DOS.

    Basically, if you are using DOS on the DVD and want to use WinPE on the USB hard drive, then you can either try your existing command script with WinPE, or instead use VBScript/WMI to cycle through the drive letters and find where your USB drive is mounted. WMI can also help you identify the target machine and automatically choose which ghost image to deploy
    WinPE also supports HTA so you can create quite a complex control program with a UI should you wish to do so.
    One thing you should also code for, and that is to do some checking that the target drive is not the USB device, because if for any reason the machine HD has failed, you don't want to accidentally deploy the image to your USB drive. Unlike a DVD, the USB drive is not read only!


  • 3.  RE: Bootable USB drive, where the ghost image starts automatically

    Posted Aug 27, 2010 04:30 AM

    Thankyou for your answer,

    I'm using WinPE.

    The process i use for DVD is with the Ghost boot wizard, and then when I get to the I modify the start.bat code with:



    @echo off
    Rem – scan for a file in the root of the DVD called IMAGE.GHO and set system variable %DVD%
    for %%f in (C D E F G H I J K L M N O P Q R S T U V W X Y Z ) do if exist %%f:\IMAGE.GHO set DVD=%%f:
    x:
    cd \ghost
    Ghost32 -clone,mode=restore,src=%DVD%\IMAGE.GHO,dst=1 –sure


    What I need to do is the same but with a USB drive, instead of using a DVD drive to deploy the image.

    When doing this on a DVD the image is automatically deployed to the destination drive.  But with the USB drive the ghost image isn't found.

    I hope this made sense,

    Thanks in advance,


  • 4.  RE: Bootable USB drive, where the ghost image starts automatically

    Posted Aug 27, 2010 05:49 AM
    Is your filename in upper case on the USB drive - ie IMAGE.GHO and not Image.gho, for example?
    I'm just trying to think of what possible differences might exist between a DVD boot environment and a USB drive boot environment.
    Presumably the command script just bombs out with an error and leaves you at the command prompt in WinPE.
    Can you then find the drive letter that the USB drive is mounted on? Can you find the IMAGE.GHO file in the root?

    Also, are you able to try a different manufacturer's USB drive?  Im pretty sure I've seen problems with one or two makes of USB drive and booting to WinPE, and it might be a hardware compatibility issue that you are encountering rather than anything amiss in your script.


  • 5.  RE: Bootable USB drive, where the ghost image starts automatically

    Posted Aug 27, 2010 09:48 AM

    Hi, I'm encountering a similar problem with making an automatic booting usb flash drive with ghost. There are two main issues that I'm encountering.

    1. referencing the .gho file to be restored. The bootable usb drive can be any drive letter. On two identical laptops it shows differently as G and H


    I've tried this method:

    start ghost32.exe -clone,mode=load,src=H:\image.gho,dst=1 -sure


    this one

    if exist e:\image.gho x:\ghost\ghost32.exe -clone,mode=restore,src=e:\image.gho,dst=1
    if exist f:\image.gho x:\ghost\ghost32.exe -clone,mode=restore,src=f:\image.gho,dst=1
    if exist g:\image.gho x:\ghost\ghost32.exe -clone,mode=restore,src=g:\image.gho,dst=1
    if exist h:\image.gho x:\ghost\ghost32.exe -clone,mode=restore,src=h:\image.gho,dst=1


    and a modified version of shaun72s

    Rem – scan for a file in the root of the DVD called IMAGE.GHO and set system variable %USB%
    for %%f in (E F G H I J K L M N O P Q R S T U V W X Y Z ) do if exist %%f:\IMAGE.GHO set USB=%%f:
    x:
    cd \ghost
    Ghost32 -clone,mode=restore,src=%USB%\IMAGE.GHO,dst=1 –sure


    Once the first version worked, but now it doesn't. Other times it can't find the file, or just drops to a command prompt.


    2. After editing the start.bat file (in the ghost folder) and then booting it still seem to pickup previous settings.
    Last time I tried Istart.bat contained:

    start ghost32.exe -clone,mode=load,src=H:\image.gho,dst=1 -sure

    the error was
    cannot open image file h:\ghost\image.gho



    Is there anyway to reference the dirve letter for the usb flash drive? That works correctly?

    Which file do I edit in place of the start.bat


    Paul


  • 6.  RE: Bootable USB drive, where the ghost image starts automatically

    Posted Aug 27, 2010 10:01 AM

    Tried two usb flash drives from different manufacturers


  • 7.  RE: Bootable USB drive, where the ghost image starts automatically

    Posted Aug 27, 2010 01:23 PM
    There could be a number of causes here, so I would recommend a step by step approach to troubleshooting this.
    Configure start.bat so that it just drops you to the WinPE command prompt.
    Then identify the drive letter that the USB drive or USB key is mounted on, and verify that the image.gho file can be listed and is reported with the correct size. If using a USB flash drive, bear in mind that these are formatted with FAT32 by default so the maximum ghost file size is 2Gb per file. NTFS USB hard disks can support any size GHO file.

    Next, check that you can view and access the C: drive correctly from WinPE. If you have a SATA hard disk using a chipset that is not natively supported by WinPE V2 then you will not be able to view the drive and will need to add the correct driver to WinPE so that the SATA drive gets mounted properly.

    Then run the ghost32.exe commands from the command line and check that the image is restored to the C: drive correctly.

    If all this works OK, then there may be a timing issue to allow for. The initial boot from the USB device is handled by the BIOS, but as WinPE boots up, it has to load the USB driver so that the USB device is readable by WinPE. If start.bat is getting executed during the WinPE boot phase before the WinPE USB subsystem is fully initialized, then the code might be erroring out for that reason.
    If you need to add in a delay in start.bat then you can adopt the ping method as this works pretty well:
    cmd.exe /c ping -n NumberOfSecondsDelay 127.0.0.1>nul

    Basically, if it works when you do it manually from the command line but fails when automated then timing is likely to be the issue.  CDROM/DVD drives are much slower than USB hard disks or flash keys so are less likely to exhibit timing issues.


  • 8.  RE: Bootable USB drive, where the ghost image starts automatically

    Posted Sep 06, 2010 11:41 AM
    Right I've finally got it working. There were two main issues that I encountered.

    1. I could only edit the start.bat through the 'Ghost boot wizard'. If I tried to manually edit the start.bat file, the changes would show in the file but when it ran from the USB drive it only ever used the settings that were originally created in the boot wizard.

    2. The drive letter of the USB drive would vary between G: and H:. I used the following script in the 'Ghost boot wizard' to pick a drive. Replacing the section below 'START.BAT:'


    --------------------------------------------------------------------------------------------
    set path=%path%;x:\ghost
     
    x:
    cd \ghost
    rem --- This will create primary OS drive configuration ---
    ghost32.exe /setosdrives /blind >> x:\ghost\startlog.txt
    if exist f:\image.gho x:\ghost\ghost32.exe -clone,mode=restore,src=f:\image.gho,dst=1 -sure -rb
    if exist g:\image.gho x:\ghost\ghost32.exe -clone,mode=restore,src=g:\image.gho,dst=1 -sure -rb
    if exist h:\image.gho x:\ghost\ghost32.exe -clone,mode=restore,src=h:\image.gho,dst=1 -sure -rb
    if exist i:\image.gho x:\ghost\ghost32.exe -clone,mode=restore,src=i:\image.gho,dst=1 -sure –rb

    --------------------------------------------------------------------------------------------

    Where my ghost image file is 'image.gho' and is copied into the root of the USB drive.





  • 9.  RE: Bootable USB drive, where the ghost image starts automatically

    Posted Sep 06, 2010 01:43 PM
    WinPE runs entirely from memory - during boot, the boot.wim file is mounted as a virtual hard disk which is usually given the drive letter X:
    Start.bat is part of the wim file, so when you edit it in memory, you are just editing the running copy in memory; the original copy in the WinPE boot media is unchanged.
    To make changes to the boot.wim file, it has to be "mounted" as a virtual file system, edited, the changes then need to be committed, and finally the wim file needs to be unmounted. The Ghost boot wizard automates this process for you.

    If you are interested in the manual creation process of a WinPE boot environment, have a look at the following article:
    Adventures with WinPE Symantec Connect


  • 10.  RE: Bootable USB drive, where the ghost image starts automatically

    Posted Sep 10, 2010 09:38 AM

    Sorry for the delay, I've been out of the office for a while,

    Clic, I've tried the solution that worked for you but this doesn't work on my PC (Dell inspiron Mini 1012)?

    set path=%path%;x:\ghost
     
    x:
    cd \ghost
    rem --- This will create primary OS drive configuration ---
    ghost32.exe /setosdrives /blind >> x:\ghost\startlog.txt
    if exist f:\image.gho x:\ghost\ghost32.exe -clone,mode=restore,src=f:\image.gho,dst=1 -sure
    if exist g:\image.gho x:\ghost\ghost32.exe -clone,mode=restore,src=g:\image.gho,dst=1 -sure
    if exist h:\image.gho x:\ghost\ghost32.exe -clone,mode=restore,src=h:\image.gho,dst=1 -sure
    if exist i:\image.gho x:\ghost\ghost32.exe -clone,mode=restore,src=i:\image.gho,dst=1 -sure

    I removed the -rb from the command lines so the PC doesn't reboot automatically apart from that it's the same.

    My USB stick is detected as G: when using gdisk32 but for some reason it's not working?

    I also tried

    Rem – scan for a file in the root of the DVD called IMAGE.GHO and set system variable %USB%
    for %%f in (E F G H I J K L M N O P Q R S T U V W X Y Z ) do if exist %%f:\IMAGE.GHO set USB=%%f:
    x:
    cd \ghost
    Ghost32 -clone,mode=restore,src=%USB%\IMAGE.GHO,dst=1 –sure

    which you modified, this time the USB drive was detected a D: ? Maybe this one didn't work because it starts at E and the drive was detected as D.

    at the command prompt if i type manually:

    "ghost32 -clone,mode=restore,src=d:\image.gho,dst=1 -sure"

    ghost runs as expected, the problem is just getting it to run automatically.  I'll try adding D to the: for %%f in (E F G H......

    Then let you know if it works,



  • 11.  RE: Bootable USB drive, where the ghost image starts automatically

    Posted Sep 10, 2010 02:58 PM

    Just a thought - the setting dst=1 - is this correct where your boot system is WinPE?

    It may be affected by whether the main hard disk in the system is formatted or not, for example.



  • 12.  RE: Bootable USB drive, where the ghost image starts automatically

    Posted Sep 20, 2010 07:55 AM

    Finally found the (silly) problem,

    I don't know why I didn't see it before, but the original one works, well sort of, the -sure switch was killing the script as the – before sure is a long – and not the short -.  :-/

    Rem – scan for a file in the root of the DVD called IMAGE.GHO and set system variable %USB%
    for %%f in (E F G H I J K L M N O P Q R S T U V W X Y Z ) do if exist %%f:\IMAGE.GHO set USB=%%f:
    x:
    cd \ghost
    Ghost32 -clone,mode=restore,src=%USB%\IMAGE.GHO,dst=1 –sure

    The result of the when the start.bat was launched was a ü

    Ghost32 -clone,mode=restore,src=%USB%\IMAGE.GHO,dst=1 üsure

    and abviously causing the script to fail.

    Below it the corrected version with the correct - which worked for me.

    Rem – scan for a file in the root of the DVD called IMAGE.GHO and set system variable %USB%
    for %%f in (E F G H I J K L M N O P Q R S T U V W X Y Z ) do if exist %%f:\IMAGE.GHO set USB=%%f:
    x:
    cd \ghost
    Ghost32 -clone,mode=restore,src=%USB%\IMAGE.GHO,dst=1 -sure

     

    Thanks again for you help.