Join our Discord Server
Ajeet Raina Ajeet Singh Raina is a former Docker Captain, Community Leader and Arm Ambassador. He is a founder of Collabnix blogging site and has authored more than 570+ blogs on Docker, Kubernetes and Cloud-Native Technology. He runs a community Slack of 8900+ members and discord server close to 2200+ members. You can follow him on Twitter(@ajeetsraina).

Fog – An Open Source Cloning Solution

6 min read

If you are a system admin who is still sticking to Clonezilla, you must probably look out to try FOG – a very fast and easy to deploy cloning solution. Compared to Clonezilla, Fog imaging process usually takes less than few minutes. With the current release, fog includes the ability and support for Linux and multiboot resizable imaging too. However,FOG can be used to image Windows XP, Vista, Windows 7 and Window 8 PCs using PXE, PartClone, and a Web GUI to tie it together.

foggu

I had one of my friend who runs cyber cafe business and keen on deploying the similar configuration on all the 50 Windows machine. I visited his cyber cafe in the inauguration day where I came up with the idea of cloning and rescue suite. I decided to help him out with the implementation of Fog – really a great tool.

  1. Installing Ubuntu 12.04.1

As a pre-requisite, install Ubuntu 12.04.1 on the physical machine.

Ensure Ubuntu Desktop packages are selected to be installed.

  1. Installing Fog Cloning Solution
  2. Open Firefox
    2. Go tohttp://www.fogproject.org and download FOG.
    3. Open Terminal Applications->Accessories->Terminal
    4. cd Desktop (Remember Linux is case sensitive)
    5. tar -xvzf fog*
    6. cd fog*
    7. cd bin
    8. sudo ./installfog.sh
    9. Select opt 2 Enter
    10. N Enter
    11. Default IP Enter
    12. You dont need to set up a router IP but I will in case I ever use the server for DHCP.
    13. Set up a DNS IP, just accept the default.
    14. No do not change the default network interface.(you may not get this prompt if you have 1 nic)
    15. I will not be using FOG for DHCP. (will require changing my current DHCP server.)
    16. Note your IP settings and continue.
    17. Enter to Acknowledge.
    18. (I like to notify the FOG group, they have made a great product and deserve my feedback, choice is yours here)
    19. gksu gedit /var/www/fog/commons/config.php and put your mysql password you typed during install in “MYSQL_PASSWORD”, “<passwordhere>” save and close. It has been noted that you also should change the MYSQL password here while you are at it /opt/fog/service/etc/config.php.
    20. Browse to http://localhost/fog/management
    21. Click install!
    22. Click to log in. You can now reach this webpage from anywhere on the network where your server is installed by using it’s ip address. eg http://192.168.0.100/fog/managementI would reccomend putting an A record in your DNS called FOGSERVER this will make things easier to remember.

default: fog/password

Creating an Image in FOG

  The following instructions walk administrators through the process of configuring a computer for image creation in FOG.

Create Image in FOG

Log into the FOG management console

  1. FOG management console URL or address is:

http://ip address/fog/management

  1. Click the Image Management icon
  2. Click New Image button in the left section of screen
  3. Enter the following Information
  4. Image Name: Use clear concise name
  5. Consider keeping name short and model or OS specific
  6. Image Description: Enter clear concise description
  7. Storage Group: Default
  8. Image File: Will automatically be entered. You may edit if you want
  9. Image Type
  10. Windows XP = Single Partition (NTFS Only, Resizable)
  11. Windows Vista/7 = Multiple Partition Image – Single Disk (Not Resizable)
  12. Click Add

Inventory Machine

  1. Boot host machine to FOG pxe boot menu
  2. Select Perform Full Host Registration and Inventory
  3. Enter the computer Host Name and press enter
  4. Leave IP Address field blank and press enter
  5. Press the ? and press enter to get the list of Image ID’s
  6. Enter the Image ID number
  7. Press the ? and press enter to get the list of Operating System ID’s
  8. Enter the Operating System ID number
  9. Choose Y or N to add to Active Directory
  10. NOTE: XP choose Y, Vista/7 choose N
  11. Leave Primary User field blank and press enter
  12. Leave both Asset #’s blank unless you utilize
  13. Select N as you do not want to Image this machine and press enter
  14. Enter “fog” and press enter
  15. Load machine with all software and drivers you need.
  16. Windows XP you need an image for each model
  17. Windows Vista & Windows 7 you can use the same image for any model but hard drive size can cause issues.

**DO NOT Activate Windows in Vista or 7**

Optional 

It is a good idea to change the default boot order to enable the network boot to be your first boot item. It is not required, however. All brands have a slightly different way of doing this. Check your manufacturer’s manual for assistance figuring out how to boot into the BIOS to make this change.

  1. Ensure all Windows Updates are Current
  2. Make sure all service packs are current
  3. Make sure current with .NET framework
  4. Install the FOG Client
  5. Enter the IP address of your FOG server
  6. Leave all other options checked
  7. Windows XP continue to STEP 13
  8. Windows Vista & Windows 7 continue to STEP 25

 

 Windows XP

  1. Install the Windows XP Service Pack 2 Support Tools
  2. http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=49ae8576-9bb9-4126-9761-ba8011fabf38
  3. Download Windows XP Service Pack 3 Deployment Tools
  4. http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=673a1019-8e3e-4be0-ac31-70dd21b5afa7
  5. Open the deploy.cab file
  6. Select all files within
  7. Right Click and select Extract
  8. Select the following destination
  9. C:\Windows\System32\Sysprep
  10. NOTE: If the Sysprep folder doesn’t exist you need to create it
  11. Double Click the setupmgr.exe file in the C:\Windows\System32\Sysprep folder
  12. Click Next
  13. Select Modify Existing
  14. Click Browse Button
  15. Go to the C:\Windows\System32\Sysprep folder if not already there
  16. Click the drop down menu in the “Files of type” field
  17. Select Sysprep Inf Files (*.inf)
  18. Select the sysprep.inf file
  19. Click Open
  20. Click Next
  1. Make sure “Sysprep setup” is selected
  2. Click Next
  3. Select “Windows XP Professional”
  4. Click Next
  5. Select “Yes, fully automate the installation” if you use the same product key for all machines. If not select “No, do not fully automate the installation”
  6. Click Next
  7. Change the following settings:
  8. Name and Organization
  9. Time Zone

iii. Product Key

  1. Computer name
  2. Set to Automatically generate computer names (FOG will rename for you)
  3. Administrator Password
  4. Click File
  5. Click Save
  6. The save location should be C:\Windows\System32\Sysprep
  7. Click OK
  8. Close the Setup Manager program
  9. Run Disk Cleanup
  10. Select all items
  11. Click the More Options Tab
  12. Under the “System Restore and Shadow Copies” section click the Clean Up button
  13. Click OK
  14. Click the Delete Files button
  15. Run Disk Defragment Tool
  16. Run the defragmenting tool and ensure there is not more than 5%-10% fragmentation
  17. 1%-2% is ideal
  18. When ready to Sysprep the machine ensure you have installed all programs you want on the machine and removed everything you do not.

NOTE: You cannot turn the machine back on after SYSPREP’ing until after you have taken the image.

  1. When ready to sysprep the machine proceed to step 12.
  2. Navigate to C:\Windows\System32\Sysprep
  3. Double Click the Sysprep.exe file
  4. When the Sysprep program appears choose the following settings
  5. Options section
  6. Check “Use Mini-Setup”
  7. Shutdown Mode: “Shut down”
  8. Click Reseal button
  1. The machine will sysprep and then shut down
  2. Continue to STEP 37

**Leave the machine OFF until instructed otherwise**

Windows Vista & Windows 7

Windows Vista & Windows 7 do not have the Support Tools XP does. These instructions will cover this difference along with different SYSPREP steps.

Retrieving NETDOM.exe Instructions

You will need to perform STEP 6 in the Windows XP instructions on a Windows XP machine. You only need to do this one time.

Once installed navigate to C:\Program Files\Support Tools

Locate the NETDOM.exe file and copy

On a flash drive or network share you manage create a folder called “Support Tools”

Paste the NETDOM.exe file into the new Support Tools folder

  1. Copy the “Support Tools” folder (see “Retrieving NETDOM.exe Instructions”)
  2. Navigate to C:\Program Files
  3. Paste Support Tools folder into Program Files folder
  4. Path will be C:\Program Files\Support Tools
  5. NETDOM.exe will be inside the Support Tools folder
  6. Run Disc Cleanup Utility
  7. Check all items
  8. Click More Options tab
  9. In the System Restore and Shadow Copies section click Clean Up
  10. Click Delete button
  11. Click OK
  12. Click Delete Files button
  13. Run Disc Defragmenter Utility
  14. You can choose to simply Analyze the disc first. Your disc must be less than 15% fragmented. If it is higher then defragment it.
  15. I recommend defraging it anyway to get it as low as possible

**Ensure you are prepared to SYSPREP this machine as you will have to repeat the following steps if you have to boot the machine after SYSPREP’ing**

Optional

Past versions of FOG required Vista and 7 images to have the following three commands run immediately before continuing to STEP 23

Run CMD.exe as Administrator

bcdedit /set {bootmgr} device boot

bcdedit /set {default} device boot

bcdedit /set {default} osdevice boot

**It is not required to run these commands**

  1. Copy the unattend.xml file to the following location:
  2. c:\windows\system32\sysprep
  3. Run CMD.exe as Administrator
  4. Run the following command:
  5. cd c:\windows\system32\sysprep
  6. Now run the following command to sysprep the drive:
  7. sysprep /generalize /oobe /shutdown /unattend:c:\windows\system32\sysprep\unattend.xml
  8. SYSPREP will take a few moments to run
  9. The machine will shut down when done
  10. Continue to STEP 37

**Leave the machine OFF until instructed otherwise**

 

Uploading the Image

Choosing shutdown after task completion ensures you don’t begin unpacking your sysprep’ed machine by booting to Windows should the image upload fails.

  1. Log into the FOG Management Console
  2. Click the Task Management icon
  3. Click List All Hosts
  4. Locate the host you Inventoried in the Inventory Machine section of these instructions
  5. Click the Upload arrow for the indicated host
  6. Add a check to the following option
  7. Shutdown after task completion?
  8. Click Upload Image
  9. Ensure the host machine PXE boots and not to the hard drive

**NOTE: If the machine begins to boot to Windows for any amount of time you will need to SYSPREP again if your image has not been uploaded successfully

Test Image

  1. When the image has been uploaded test it on a different machine
  2. Ensure you use the same make and model if using a Windows XP machine
  3. Vista and Windows 7 machines are not model or brand specific but you may run into driver issues. You will need to address those issues either prior to upload or after.

46. Test as many possible scenarios prior to implementing your image to production

Have Queries? Join https://launchpass.com/collabnix

Ajeet Raina Ajeet Singh Raina is a former Docker Captain, Community Leader and Arm Ambassador. He is a founder of Collabnix blogging site and has authored more than 570+ blogs on Docker, Kubernetes and Cloud-Native Technology. He runs a community Slack of 8900+ members and discord server close to 2200+ members. You can follow him on Twitter(@ajeetsraina).
Join our Discord Server