Clonezilla logo Clonezilla Live - Single machine clone system without installation
Single machine clone system without installation
Clonezilla live is used to clone single machine without installation

[Copyright] [Authors] [About] [How to make] [How to use] [Accounts and management] [Advanced modes] [Acknowledgment]

2008/Jul/22


1.Copyright

This copyright is preserved for the author and publisher. Anyone is permitted to copy and distribute verbatim copies of this document under the terms of the GNU FDL Free Documentation License. If you do make any distribution or modification of the document, please add your name to the authors list.

We recommend this document principally for works whose purpose is instruction or reference. The author and publisher will not take any responsibility if there is any damage caused by this document.


2. Authors

Steven Shiau (steven _at_ nchc org tw)
K. L. Huang (klhaung _at_ gmail com)
H. T. Wang (c00wht00 _at_ nchc org tw)
Ceasar Sun (ceasar _at_ nchc org tw)
Jazz Wang (jazz _at_ nchc org tw)
Thomas Tsai (thomas _at_ nchc org tw)

3. About Clonezilla Live

Clonezilla server edition is used to clone many computers simultaneously. It is an extremely useful tool, however, it does have several limitations. In order to use it, you must first prepare a DRBL server AND the machine to be cloned must boot from a network (e.g. PXE/Etherboot). To address these limitations, the Free Software Lab at the NCHC has combined Debian Live with Clonezilla to produce "Clonezilla Live," a new software that can be used to easily clone individual machines. The primary benefit of Clonezilla Live is that it eliminates the need to set up a DRBL server ahead of time and the need for the computer being cloned to boot from a network. Clonezilla Live can be used to clone individual computers using a CD/DVD or USB flash drive. Though the image size is limited by the boot media's storage capacity, this problem can be eliminated by using a network filesystem such as sshfs or samba.

4. How to make Clonezilla Live ?

To make Clonezilla live, the basic steps are to download pre-build Clonezilla Live then put it in a boot media (CD or USB flash drive). Two types of files are available, iso and zip. The former one is for CD, the latter is for USB flash drive. Before downloading it, you may refer to this change log: stable branch, testing branch, experimental branch. Besides, the known issues: stable branch, testing branch, experimental branch.
  • An ISO file for CD/DVD can be downloaded here: stable, testing, experimental.
    After it's downloaded, it can be burned to a CD/DVD. It can then be used to boot the machine you want to clone. Now you may continue to follow this to use Clonezilla live.
  • A zip file for USB flash drive can be downloaded here: stable, testing, experimental.
    After the zip file is downloaded, you can make it bootable in a MS Windows or GNU/Linux computer by the following steps (This method only works for the file system in USB flash drive is FAT format. For other file system, you can try to use grub or other bootloader):
    • Extract files and make USB flash drive bootable under MS windows
        Choice 1 (Use GUI program in MS windows):
          Download this file to help you to create this Live USB flash drive. Just install the program in MS windows, then you can follow the GUI to create the Clonezilla live.
        Choice 2 (Manually):
          (PS: The following description is modified from: http://www.pendrivelinux.com/2007/01/02/all-in-one-usb-dsl. Thanks to PDLA from http://pendrivelinux.com)
          *****************************
          WARNING! WARNING! WARNING!
          *****************************
          WARNING!: ***DO NOT RUN*** makeboot.bat from your local hard drive! It should only be run from your USB flash drive. Executing it incorrectly could cause your MS windows not to boot!!!
          1. Download the HP-USB Format tool and format your flash drive using the Fat or Fat32 option. This program can be used to format USB devices that won't boot properly when formatted with MS windows format tool.
          2. Extract all the contents of the clonezilla-live-usb.zip to your "flash drive." Keep the directory architecture, for example, makeboot.bat should be in the USB flash drive's top directory (e.g. G:\makeboot.bat).
          3. Browse to your "flash drive" and click the makeboot.bat. WARNING! Makeboot.bat must be run from your USB flash drive. Executing it incorrectly could cause your MS windows not to boot.
          4. Follow the on-screen instructions.
    • Extract files and make USB flash drive bootable under GNU/Linux
      1. Insert your USB flash drive into the USB port on your Linux machine and wait a few seconds. Next, run the command "dmesg" to query the device name of the USB flash drive. Let's say, for example, that you find it is /dev/sdb1. In this example, we assume /dev/sdb1 has FAT filesystem, and it is automatically mounted in dir /media/usb/. If it's not automatically mounted, manually mount it by "mkdir -p /media/usb; mount /dev/sdb1 /media/usb/".
      2. Unzip all the files, and copy them into your USB flash drive (You can make it by the command like: "unzip clonezilla-live-1.0.10-8.zip -d /media/usb/"). Keep the directory architecture, for example, makeboot.bat should be in the USB flash drive's top directory (e.g. /media/usb/makeboot.bat).
      3. Make sure syslinux 3.60 or later is installed in your GNU/Linux system, if not, install it. If you use version earlier than 3.60, the created USB flash drive won't be able to boot. Then you can run something like: "syslinux -s /dev/sdb1" to make your USB flash drive bootable. WARNING! Executing it incorrectly could cause your GNU/Linux not to boot. Confirm the command before you run it.
      4. Some of USB flash drive does not contain any booting program in the MBR. If so, it won't be able to boot. You can run "cat /usr/lib/syslinux/mbr.bin > /dev/sdb" (/usr/lib/syslinux/mbr.bin comes with package syslinux). The path of the mbr.bin depends on the GNU/Linux distributions. WARNING! Executing it incorrectly could cause your GNU/Linux not to boot. Confirm the command before you run it.
      5. If your USB flash drive is not able to boot, check (1) Is there any partition in your flash drive ? It must contain 1 partition at least. (2) The partition must be marked as "bootable" in the partition table. (3) The partition must be on the cylinder boundary.
Now you may continue with the next step to use Clonezilla live.

5. How to use Clonezilla live ?

Once you have the bootable Clonezilla Live CD/DVD or USB flash drive, you can boot it in the machine you want to clone. Remember to use the Clonezilla live CD or USB flash drive to boot the machine. For example, if you have Clonezilla Live in USB flash drive, you have to boot it via USB device (Ex. USB-HDD or USB-ZIP). If necessary, you can set the first boot priority in the BIOS as USB-HDD or USB-ZIP so that it can boot Clonezilla Live from your USB flash drive.
  • Here is a screenshot of Clonezilla Live boot menu:
    Clonezilla Live boot menu

    The first choice illustrates the "Clonezilla Live" boot menu. This is the default mode for Clonezilla Live. It will default to framebuffer mode with a resolution of 800X600. This will allow you to clone in an English or Traditional Chinese environment.
    The 2nd choice, "Clonezilla live (To RAM. Boot media can be removed later), is the same function with the 1st one except when Clonezilla live booting finishes, all the necessary files are copied to memory. Therefore you can remove the boot media (CD or USB flash drive) then.
    If you do not need a Traditional Chinese environment or if your computer experiences problems in the framebuffer mode, you can choose the 3rd one "Clonezilla Live (no framebuffer)" to clone in the English environment.
    The 4th choice, "Clonezilla live (failsafe mode)", is for something goes wrong when you are not be able to boot your machine, such as ACPI of your machine is not supported in the kernel.
    If you want to boot local OS in your harddrive, you can choose the 5th one "Local operating system in harddrive (if available)". This is an extra function in the boot media that has nothing to do with Clonezilla Live.
    The 6th choice, "FreeDOS", allows you to boot your machine into Free DOS. This is an extra function in the boot media that has nothing to do with Clonezilla Live.
    The 7th choice, "Memory test using Memtest86+," is for memory testing using Memtest86+. This is an extra function in the boot media that has nothing to do with Clonezilla Live.
    The 8th choice, "Network boot via etherboot," is used to perform a network boot via Etherboot. If your computer does not have a PXE network, you can use this to do boot from a network. This is an extra function in the boot media that has nothing to do with Clonezilla Live.
  • After language and keymap are chosen, first you will be prompted to assign the image repository, which can be local disk, ssh server, nfs server, samba server (network neighborhood) or any file system you can mount as /home/partimag. Once the repository is ready, you can proceed to save or restore the image. Just follow the on-screen instructions. Two main screenshots about Clonezilla live:
    Clonezilla Live prepare ocsroot menu

    ///Note/// The image name of Clonezilla is actually a directory name. For example, if you give the image name as 2007-05-NOVISTA, all the info will be saved as in the directory /home/partimag/2007-05-NOVISTA/. Inside that directory, MBR, partition table and partition files will be stored. Therefore when you want to restore an image, remember to mount the /home/partimag as the right device or path. i.e. the directory 2007-05-NOVISTA must be in the clonezilla home directory (Ex. /home/partimag)

    Clonezilla Live ocs-sr menu
  • Here is a video that outlines the above steps. Click to play it (Flash Player plugin required) or you can download this mpeg4 file to watch it. To save disk space and bandwidth, we skipped the duplicate frames. This also enables the video to play more quickly.

  • [Expert mode] If you want to MANUALLY mount clonezilla image home (/home/partimag), follow this:
    1. Run "sudo su -" to become root.
    2. You must prepare another writable device or space and mount it as /home/partimag (Note! If your boot media is writable, such as USB flash drive or you choose to use To RAM option, the existing /home/partimag is linked to /live_media/home/partimag, You have to remove that file and create a directory /home/partimag as a mount point by "rm -f /home/partimag; mkdir -p /home/partimag).
      Ex. If you want to use Clonezilla to save /dev/hda and put the image in /dev/hdb1, then you have to mount /dev/hdb1 as /home/partimag by "mount -t auto /dev/hdb1 /home/partimag". If the file system of /dev/hdb1 is ntfs, you have to use "ntfs-3g /dev/hdb1 /home/partimag" to mount it so that it's writable. Remember, sshfs and smbfs are also supported. For example, using sshfs, you can mount your remote ssh server:
      sshfs ACCOUNT@SSH_SERVER:/ABSOLUTE_PATH /home/partimag
      i.e. if you want to mount your ssh server 192.168.100.254 with directory /work/pool, run it like this:
      sshfs root@192.168.100.254:/work/pool /home/partimag
      If you want to mount your samba server 192.168.200.254 with directory /work/smb, run it like this:
      mount -t cifs -o username=your_user_name //192.168.200.254/work/smb /home/partimag
      ///NOTE/// In the above command, do NOT use smbfs in Linux, use cifs, since cifs has better compatibility with MS windows file sharing. Clonezilla live will FAIL to save a correct image when you use smbfs!
    3. If you want to use a terminal with Traditional Chinese support, run "tw-bterm"
    4. Run "ocs-live" to use Clonezilla, then follow the on-screen instructions.

6. Accounts and management

In Clonezilla live, two accounts are available: (1) account "casper" with sudo privilege, password is "live", (2) administration account "root", no password. Therefore you can not login as root, the only way to get root privilege is to login as casper, and run "sudo su -" to become root. Note, for old clonezilla live (naming is clonezilla-live-2007XXXX), root's password is "drbllive".
For better security, it is recommended to change the passwords of casper and root by command "passwd" before you allow remote access. When Clonezilla live boots, the ssh service is NOT automatically started, and the setting in /etc/hosts.deny does NOT block any connection. If you want to remotely ssh login into your Clonezilla live, you have to start ssh service by "/etc/init.d/ssh start".

7. Advanced modes

Two advanced modes are available:
Mode 1: Create your own recovery CD or USB flash drive.
Mode 2: Use your own script and run it on clonezilla live.
  • Mode 1: Create your own recovery CD or USB flash drive:
  • First, use the prebuild Clonezilla live to save an Clonezilla image, or you can save the image on DRBL/Clonezilla server). Once the image is ready, you can create your own recovery CD/USB flash drive:
    • To create a Clonezilla Live ISO file with a built-in image used to restore. For example, let's say you want to create a CD/DVD ISO file in which an existing image "sarge-image" will be inserted in. If you use Clonezilla live to boot into shell mode, you have to mount the clonezilla image home (maybe source is from ssh server, nfs server or samba server) as /home/partimag first, and run "cd /home/partimag" to change working dir so that you have a writable dir later. If you are using Clonezilla server, the clonezilla images normally already exist in the directory /home/partimag. Now you can run the following to create a Clonezilla live iso file:
        /opt/drbl/sbin/ocs-iso sarge-image
      This command will create the ISO file clonezilla-live-sarge-image.iso which can then be burned to a CD or DVD.
      If you want to create an ISO file with built-in pre-settings, such as keyboard layout, so that it can run in batch mode, you can create it like:
        /opt/drbl/sbin/ocs-iso -g en_US.UTF-8 -t -k NONE -e "-g auto -b -c restoredisk sarge-image hda" sarge-image
      In this command, the clonezilla image "sarge-image" will be put into the ISO file. When you put the ISO in the CD/DVD and boot the CD/DVD, it will run in batch mode (-t), in English environment (-g en_US.UTF-8), do NOT change the keyboard layout (-k NONE), and ocs-sr will run with parameters "-g auto -b -c restoredisk sarge-image hda" to restore image "sarge-image" into disk hda (-e "-g auto -b -c restoredisk sarge-image hda"). The parameters used in "-e" will be run by ocs-sr when cloning, so you can run "/opt/drbl/sbin/ocs-sr --help" to check all of them. The above command will create an ISO file "clonezilla-live-sarge-image.iso", and it will allow you to boot and run in batch mode.
      If you need to insert more than one image, run the following command:
        /opt/drbl/sbin/ocs-iso sarge-image etch-image
      ///Note/// Due to the limitations of program mkisofs , ocs-iso can not process an image file larger than 4.5 GB. For this reason, if your image is larger than 4.5 GB, ocs-iso will refuse to process it.
      For more parameters of ocs-iso, run "/opt/drbl/sbin/ocs-iso --help".
    • To create Clonezilla Live in an USB flash drive with image built-in. For example, you want to create a USB flash drive in which an image sarge-image existing in the Clonezilla server will be inserted:
      • Insert your USB flash drive into the USB port on your Clonezilla server and wait a few seconds. Next, run the command "dmesg" to query the device name of the USB flash drive. Let's say, for example, that you find it is /dev/sdb1. If GNU/Linux mounts the USB flash drive automatically, you must unmount it. You can run "df -h" to check to see if it was mounted automatically and, if it was, run something like "unmount /dev/sdb1" to unmount it or you can use your mouse to right-click on the device to unmount it in Gnome/KDE.
      • The USB flash drive partition must be formatted. If it is not, for example, for /dev/sdb1, you can run:
        mkfs.vfat -F 32 /dev/sdb1
        or
        mkfs.ext3 /dev/sdb1
        to format it.
        WARNING!!! The above command will delete all existing data in your device! Be sure to backup important data first. Also, be aware that any typo could cause your server not to boot or cause data loss.
      • Run
        /opt/drbl/sbin/ocs-live-dev -d /dev/sdb1 sarge-image
        WARNING!!! Make sure the device name /dev/XXX is the one you want. An incorrect device name could cause you to lose data in your server.
        Taking the above steps will create a bootable Clonezilla Live USB flash drive with image sarge-image built-in. For more ocs-live-dev parameters, run "/opt/drbl/sbin/ocs-live-dev --help".
        If you want to create a batch-mode Clonezilla live usb flash drive, such as. pre-set the keyboard layout, so that it can be used to boot and run in unattended mode, you can create it like:
        /opt/drbl/sbin/ocs-live-dev -d /dev/sdb1 -g en_US.UTF-8 -t -k NONE -e "-g auto -b -c restoredisk sarge-image hda" sarge-image
        WARNING!!! Make sure the device name /dev/XXX is the one you want. An incorrect device name could cause you to lose data in your server.
        In the above command, the clonezilla image "sarge-image" will be put in the USB flash drive. This USB flash drive will boot and run in batch mode (-t), in English environment (-g en_US.UTF-8), do NOT change the keyboard layout (-k NONE), and ocs-sr will run with parameters "-g auto -b -c restoredisk sarge-image hda" to restore image "sarge-image" into disk hda (-e "-g auto -b -c restoredisk sarge-image hda"). The parameters used in "-e" will be run by ocs-sr when cloning, so you can run "/opt/drbl/sbin/ocs-sr --help" to check all of them. The above command will create an USB flash drive, and it will allow you to boot and run in batch mode.

    Video about the process to use a recovery CD to restore an image: In this video, you will be prompted with a menu that lets you restore the image when using the Clonezilla Live with image built-in. Here is a video that shows how to do this. Click to play it (Flash Player plugin required) or you can download this mpeg4 file to watch it. To save disk space and bandwidth, we skipped the duplicate frames. This also enables the video to play more quickly.

  • Mode 2: Use your own script and run it on clonezilla live.
    • You can write a script, say "custom-ocs", to do that. A sample script file /opt/drbl/samples/custom-ocs, which allows user to use clonezilla live to choose (1) backup the image of /dev/hda1 (or /dev/sda1) to /dev/hda5 (or /dev/sda5) (2) restore image in /dev/hda5 (or /dev/sda5) to /dev/hda1 (or /dev/sda1), can be found when you are running clonezilla live (version 1.0.3-20 or later) or in DRBL server (version 1.7.12-1 or later).
    • When this script is ready, you can run
    • /opt/drbl/sbin/ocs-iso -g en_US.UTF-8 -k NONE -s -m ./custom-ocs
      to create the iso file for CD/DVD. or
      /opt/drbl/sbin/ocs-live-dev -g en_US.UTF-8 -k NONE -s -c -m ./custom-ocs
      to create the zip file for USB flash drive.
    • In the above examples, "-g en_US.UTF-8" means the language will be English, "-k NONE" means won't change the keyboard layout (default is US keyboard). For other options, please run "/opt/drbl/sbin/ocs-iso -h" or "/opt/drbl/sbin/ocs-live-dev -h" to get more info.

8. Acknowledgment

The authors would like to thank Mr. Jr-Jung Lin from Taipei County, Mr. Wei-Ji Hsiao from Huallien County and all others who helped put together this project for their time, effort, contribution and input.