Ghost 4 Linux complete guide to imaging

About a month ago I was given 65 new Dell Optiplex 745’s to replace my 6 year old desktops in my training environment. This presented a multitude of problems for me.


  1. Our imaging software ran off of a floppy disk.
  2. It was DOS based, and I hate DOS
  3. It couldn’t detect SATA drives (you would not believe how mad I was when I finally solved the floppy problem just to run into this).

As usual, I’m dumped into this with no support of note and a limited time frame. Not to mention all of my normal duties. So what do I do? The same thing I do whenever I have an insurmountable obstacle… Turn to Linux.

Ghost 4 Linux is a CD based distro designed with imaging in mind. It’s really useful and all that, blah blah blah. This post isn’t about extolling its many virtues. This post is to teach you how to use it. More accurately, this post is to teach my coworkers at our other sites to replicate my setup. I’ve included below the document I sent to them so they could get up and running with Windows 2003 servers.


Ghost 4 Linux instructions

Ghost 4 Linux is natively a CD based distribution; however it can be easily modified to run from a network boot. These instructions assume you are using a Windows 2003 Server for DHCP.

One-Time Network Setup:

  1. Get the ISO image from
  2. Burn the image to a CD. (If you don’t want to network boot, stop here, you’re done)
  3. Copy all files from the CD to a folder called “TFTP” on a server (I use my primary DHCP server, you’ll see why in a moment).
  4. Download syslinux from
  5. Copy the file “pxelinux.0” from the zip to the TFTP folder.
  6. Create a folder in the TFTP folder called “pxelinux.cfg”
  7. Copy the isolinux.cfg file from the TFTP folder in to the “pxelinux.cfg” folder.
  8. Rename isolinux.cfg in the “pxelinux.cfg” folder to “default”. (This step ensures that our file becomes a catch-all. Using this method, it is possible to have different boot images based on the MAC of the requesting machine.)
  9. Edit “default” and change the TIMEOUT variable to 100 (10 seconds) and the ONTIMEOUT variable to “bzImage20.1” (the kernel with the best support for our hardware). Move “MENU DEFAULT” from “bzImageb” to “bzImage20.1”. This allows for unattended network booting. (You’ll need a UNIX capable text editor to view the “default” configuration file. Notepad will not read it properly. Try
  10. Open the DHCP control panel on your primary DHCP server (you’ll need to do this on the secondary as well).
  11. Expand the “Scope” folder. Right click on “Scope Options” and select “Configure Options”.
  12. Put a check mark in “013 Boot File Size” and enter “0x1a”.
  13. Put a check mark in “043 Vendor Specific Info” and enter “01 04 00 00 00 00 ff” under the Binary Value column.
  14. Open a command window and type the following (substitute your own DHCP server name):
    server \\server_name
    add optiondef 60 ClassID String 0
    set optionvalue 60 STRING PXEClient
  15. Put a check mark in “066 Boot Server Host Name” and enter the IP address of the server.
  16. Put a check mark in “067 Bootfile Name” and enter “pxelinux.0”.
  17. Copy “tftpd.exe” from “C:\WINDOWS\system32\dllcache\” (it’s there, show hidden and system files) to “C:\WINDOWS\system32\” on the DHCP server.
  18. On the DHCP server, type “sc create tftpd binpath= c:\WINDOWS\system32\tftpd.exe”.
  19. Open the services console from MMC.
  20. Start the new tftpd service.
  21. Run regedit.
  22. Browse to “HKEY_LOCAL_MACHINE\system\currentControlSet\services\tftpd”
  23. Add a subkey called “parameters” to the tftpd folder.
  24. Add a string value “Directory” to the “parameters” key.
  25. Give “Directory” the path location where your boot image file is located. (C:\TFTP).
  26. Repeat steps 10-16 for your secondary DHCP server (If applicable).
  27. Take a break.
  28. On any server with plenty of free space available, you’ll need to set up the IIS FTP service with a folder and anonymous read/write access. Remember the IP of this server.

Client setup:

  1. Boot a machine that’s already configured with the proper partition scheme for all your images (partitions must not change sizes; this requires extra work and takes longer to image).
  2. Press F2 during boot to enter setup.
  3. Expand “Onboard Devices”.
  4. Go to “Integrated NIC”.
  5. Change from “On” to “On w/PXE”.
  6. Save and Exit.
  7. Press F12 during boot to enter the boot menu.
  8. Select “Onboard Network Controller”
  9. The machine should get an address from DHCP then load the bootsplash.
  10. Either scroll down to option “F” and press Enter, or just wait 10 seconds. (If the splash screen does not appear, something is wrong with the DHCP configuration, contact me).
  11. After the kernel loads (takes about 20 seconds), a new splash screen will appear. Press Enter 3 times and it will load a prompt. (This is a fully functional linux shell, but all we want is the ghost program).
  12. Make a note of the IP given and type “g4l”.
  13. Press Enter to skip the warning screen.
  14. You’re now in the ghost program. For our first image, we’ll use “RAW Mode”, so select it.
  15. Choose “Network Use” (Click ‘n’ Clone can be used if you just want to copy one drive to another).
  16. Choose option “D: Config FTP”.
  17. Enter the IP address of the server from step 28 above.
  18. Choose option “F: Config Filename”.
  19. Press Enter and type the file name you wish to use (I use “sda” for “Serial Disk Alpha”).
  20. Choose option “H: Backup”
  21. Press Space to select “(X) sda” (This is the first serial hard drive attached. “sda1” is the first partition on sda. “sda5” is the first logical drive on sda.)
  22. Press Enter.
  23. Press Enter again to confirm and backup will begin. (This can take a couple hours if the disk has lots of data, see “tips” below to speed it up.)

Once the backup is complete, you can restore the partition table to all the machines. This only needs to be done once for each machine. After this we’ll be using “File Mode” to only copy the data.

Tip 1: RAW mode is capable of a bit-for-bit backup, thus even deleted files are stored in the image! To help with speed and image size, there’s a tool on the cd called “blank6”. All it does is make files of all zeroes until it fills the drive, then deletes them. This makes the image easier to compress.

Tip 2: When running g4l, you can skip steps 16-19 above by typing “g4l sda” to run g4l. This sets the IP of the FTP server to “” and the image file name to “sda”. Saves time and also works when restoring (see steps 4-7 below).

Restoring the partition table:

  1. Boot to g4l and run it.
  2. Choose “RAW Mode”.
  3. Choose “Network Use”.
  4. Choose option “D: Config FTP”.
  5. Enter the IP of the FTP server where the “sda” image is located.
  6. Choose option “F: Config filename”.
  7. Scroll to “sda” and press Space to select, then Enter.
  8. Choose option “I: Restore”
  9. Press Space to select “sda”, then press Enter.
  10. Press Enter to confirm.
  11. Repeat for each machine needing the partition table.

Again, this only needs to be done once per machine, but can take some time. Any number of machines can be imaged in this way simultaneously.

File mode imaging

Now that we have our partition table on the hard drive we can do a file mode image. This is the fast one you’ll use for day-to-day imaging. File mode can be done over the network, or to a partition on the drive. I use network because it’s actually faster, since the system doesn’t have to read and write to two different places on the disk simultaneously.

File mode Server (backup and restore):

  1. Boot into g4l as before (Make note of the IP address before typing “g4l”!!!).
  2. Choose “File Mode”.
  3. Choose “Select partition”.
  4. Scroll down to “sda7” assuming we’re using the same partition scheme. Otherwise, find the one you store images on.
  5. Press Space to select and Enter to confirm.
  6. Press Enter at the dialog specifying mount information.
  7. Select “Launch server”.
  8. Press Enter to continue.
  9. The server is now running.

Only one server is needed for up to 20 clients imaging simultaneously.

File mode Client (backup):

  1. Boot into g4l.
  2. Choose “File Mode”.
  3. Choose “Launch client”.
  4. Use Up/Down to select the partition to be imaged.
  5. Press Right or Tab to move to the “Image file…” field.
  6. Enter “/mnt/local/filename”. (“/mnt/local/” is something you will need to memorize, sorry.) For the filename, I use “hdc” for the helpdesk C drive (sda1), “hdd” for the helpdesk D drive (sda5), and xp for the clean XP image (sda1).
  7. Press Down to select “Save partition into a new image file” and press Space to ensure it is selected.
  8. Press Down until you reach “[ ] Connect to server” and press Space to select it.
  9. Press Down and enter the IP address recorded in step 1 of the server set up.
  10. Press F5.
  11. Press F5 again to use the default options.
  12. Enter a description (e.g. “Helpdesk C Drive”) and press Enter.
  13. Press Enter on the NTFS warning.
  14. A summary will appear. Press Enter again.
  15. Image saving will commence. When complete, the system can be rebooted.

File mode Client (restore):

  1. Boot into g4l.
  2. Choose “File Mode”.
  3. Choose “Launch client”.
  4. Use Up/Down to select the partition to be imaged. (sda1 is C, sda5 is D if you’re using the same scheme as me).
  5. Press Right or Tab to move to the “Image file…” field.
  6. Enter “/mnt/local/filename.000”. IMPORTANT! The “.000” gets appended to every file mode backup. This serves two purposes… One, the file can be spanned to account for the 2GB file size limit in FAT32. Two, you can’t accidentally overwrite your image if you forget to select “Restore” in the next step (it will create a file called “imagename.000.000” instead).
  7. Press Down to highlight “Restore a partition from an image file” and Space to select it.
  8. Press Down to highlight “[ ] Connect to Server” and press Space to select it.
  9. Press Down and enter the IP address recorded in step 1 of the server set up.
  10. Press F5. The description of the image will appear (e.g. “Helpdesk C Drive”).
  11. Press Enter, then F5 again to select the default options.
  12. Press Enter 3 times to confirm the dialogs, restoration will begin.

I am currently working on rewriting g4l to have each of these steps done relatively automatically. All one would have to do is select what you want to do, then g4l will take care of the rest, but I’m not there yet. After I do that, this will be as easy as “enter the IP and select an image”. But it may be a few weeks before I get to that point.

Let me know if you have any trouble.

3 thoughts on “Ghost 4 Linux complete guide to imaging”

  1. Looks good, using some features that I have not used.
    I generally use Linux servers for storing the images and vsftpd as the server.
    I’ve also used the front-end script options to help those users that would have less knowledge. With the latest version, there are options to have multiple scripts, and even have them in user directories.
    Not clear if you are backing up mostly NTFS partitions or a various set of partitions. The NTFSCLONE option on the g4l menu only copies the files, so it is fast.
    The client option you have mentioned is using partimage.

    Thanks again for putting out the information.

  2. Phenomenal! I had to re-image 65 HP Compaq desktops loaded with Vista to an XP pro OS. I set up a Debian server and a small network and imaged three at a time. (that is all I had room for). It did take a good while but it was faster than loading DVDs, one at a time. Nice work.

  3. This guide is brilliant.
    I can’t thank you enough….. however I am looking for some help.. beg beg

    I have sucessfully built this configuration using Server 2003, DHCP Server, IIS and anon FTP service. I have followed all of the PXE options and it works!!

    However, for newer laptops and desktops that use the intel 1000 e1000e network cards the driver is not supported in the kernal, so although it PXE boots you have no IP address when typing ifconfig.

    I have tried adding a newer kernal than 3.36 but when the client PXE boots the VGA is messed up.

    Can you advise me how to use a newer kernal like 3.82 and using G4L 0.33 instead of G4L 0.22 ??

    I will hail you as my king forever if you can give me some guidance.



    djtristanbuckley[at no spam]hotmail[dot]com

Leave a Reply