Clonezilla

The Free and Open Source Software for Disk Imaging and Cloning
Step-by-step docs

Use your own script and run it on Clonezilla live

This doc describes how to use your own script and run it on clonezilla live

  • First, prepare your own program, say, a script "custom-ocs". A sample script file /usr/share/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). More examples are available in /usr/share/drbl/samples/, you can refer to them.
    //NOTE//
    • If you edit the script on MS windows, you have to convert the format to Unix format. You can use the command "dos2unix" to convert it to UNIX format. If you do not convert the format, your script won't work on Unix/Linux system.
    • Remember to add shebang line (#!/bin/bash) in your script to avoid a "Exec format error" issue.
  • Boot Clonezilla live, enter command prompt, and run "sudo su -" to become root.
  • Mount a working space as /home/partimag. You can use the command "prep-ocsroot" to help you to do that, or use mount command to mount that. E.g. run "mount /dev/sda1 /home/partimag" to use /dev/sda1 as the working dir.
  • Copy the custom-ocs to dir /home/partimag.
  • cd /home/partimag
  • Run the follow on Clonezilla live command prompt:
  • ocs-iso -g en_US.UTF-8 -k NONE -s -m ./custom-ocs
    to create the iso file for CD/DVD. or
    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 "ocs-iso -h" or "ocs-live-dev -h" to get more info.