You must have heard about Norton Ghost, which makes a snapshot of a hard disk allowing you to restore your system in case of a crash. However, Norton Ghost is a commercial tool that costs a lot of money. 'Ghost for Linux' is a free and open source equivalent of this tool. It allows you to create your disk image either on a different hard disk or via FTP on another machine.
This is a mini-distro of Linux and its kernel includes support for Parallel ATA and Serial ATA IDE drives. In our environment, we were not able to use it with SCSI drives. It comes with support for most common network cards.
It runs from a bootable CD and gives you a simple menu-based interface to navigate. We have given an ISO image of this distro on this month's PCQEssential CD. You may use Nero or other CD burning software to transfer this to a CD.
Before booting with it, make sure you have a secondary hard disk installed on the machine you want to ghost, with either Windows or Linux partitions. The tool creates an image of the active Linux partitions on the second hard disk. Now to use this tool, just boot your PC or server with the CD you created. At the login prompt, give the username as 'g4l' and execute the following command.
This will give you a blue-colored menu system showing four options-RAW mode, File mode, Utilities and Show Help.
In RAW mode you can create or restore ghost images locally or through FTP server.
The File mode lets you create or restore ghost images based on the partition that you want.
Utilities section offers various tools such as System Info, HD Parm, zero-tool, dd_rescue and parted. Here System Info gives you information about the connected hard disk, HD Parm lets you set the hard drives into 32-bit UDMA/66, zero-tool creates free space on partitions, dd_rescue makes a clone of a damaged hard drive to another drive, and parted allows you to play with your partition table.
Now let's see how we can create or restore images from your local hard disk or via FTP.
With a local hard disk
To create the ghost image of a Linux machine on another drive, just select RAW Mode> Local use>Pick Device. Here you need to select the source drive or partition (hda, hda1, hda2) that you want to take a snapshot of.
Now from the same menu, select 'File Config' and give a name for the snapshot image file. If you have a large volume of data and want to split the image into multiple image files, then select 'Toggle split' and choose 'splitting on'.
The RAW disk image can be huge in size, because it's a clone of your entire hard disk. To overcome this problem, you can compress the RAW image into gzip or gzip2 formats. For this, select 'Toggle Compression' and choose the compression format that you want.
Finally, select 'Backup Drive/Partition to local drive' and you will be prompted to select the destination drive that you want to use for storing the image file on (hdb, hdb1, hdb2). After setting it up, you will be shown a summary of configurations you have chosen. Select 'Yes' to confirm the selections. Ghost for Linux will then start the imaging process.
To restore the drive from the created image, just choose the source drive from the 'Pick Device' option, where you have stored the image. Set the image file name that you want to restore from 'File Config' option and choose the compression selected earlier from the 'Toggle Compression' option. Sadly, the utility has no way of browsing to and selecting the image file. Thus, you must know and provide the complete path to it yourself. Now select 'Restore Drive/Partition from local Drive' and in a few minutes your drive will be restored as it is.
Using an FTP server
As discussed above, Ghost for Linux also allows you to back up and restore the hard drive images on an FTP server. While this consumes both time and bandwidth, the advantage is that you do not need to spend for an extra hard disk for storing images. To back up your machine onto an FTP server, first configure an FTP server and create a virtual folder named 'img'. Set its permissions on this folder for Read and Write, for anonymous users.
On the Linux machine, boot off the 'Ghost for Linux' CD and perform the steps mentioned in the Usage section. Now, select RAW Mode>Network Use>Pick Device, here choose the network card detected by Ghost for Linux. From the same menu, select 'Config Device' and give a static IP to this machine according to your subnet. Now select 'Config FTP' and here give the IP address of your FTP server. Next, you need to set the image file name that will be created on the FTP server.
To do so select 'Config File name'. If you want to compress the image file, then select 'Toggle Compression' and set the compression parameter same like we did while taking snapshot on a local disk. Finally, select 'Backup Drive/Partition to FTP server' and you will be prompted to select the source drive that you want to take a snapshot of. Now, from the list select hard drive or partition (hda, hda1, hda2) and it will start the imaging process.
To restore from this FTP image, keep all the FTP settings as it is and select 'Restore Drive/Partition to FTP server'.
You will be asked to select the drive on which you want to restore the ghost image. Select the drive or partition (hdb, hdb1.hdb2). Now it will show you a template of the configuration that you have made for FTP restoration. Next click on OK to start the restoration process.
Ghost for Linux tool would be very helpful for system administrators, in situations when they have to deploy base Linux server frequently. The administrators just need to create an image of a base Linux or UNIX server and the same image will then be used to deploy multiple Linux servers simultaneously in one go via an FTP server.