Clonezilla

The Free and Open Source Software for Disk Imaging and Cloning
Preseed options to do job after booting

In this example: Preseed some options to do restoring job after booting
  1. The scenario
  2. The options to be preseeded

[Back to 'Clonezilla Live Doc']

  • The scenario     ^TOP^
  •  By modifying the boot parameters in syslinux/syslinux.cfg (for live USB) or syslinux/isolinux.cfg (for CD), you can preseed most of the options so that Clonezilla live can do the job for you with less interactive steps, or it's possible to make it run in an unattended mode.
    In this example, we want to preseed the language, keymap, mounting the image repository, then choose the image of partition, and restore it to the partition.

  • The options to be preseeded     ^TOP^
  •  By refering to the doc about the boot parameters of Clonezilla live, the options we want to preseed are:
    1. Preseed the language as English:
      • locales="en_US.UTF-8"
    2. Preseed the keymap as no change:
      • keyboard-layouts=NONE
    3. Preseed the mounting of image repository. The image is located in the 2nd partition on first disk (/dev/sda4), under the dir "/Backup". The boot parameters we want to preseed are:
      • ocs_prerun="mount /dev/sda4 /mnt"
      • ocs_prerun1="mount --bind /mnt/Backup /home/partimag/

      //NOTE// Here we have to mount that in 2 steps. If the image is on the top dir (/) on /dev/sda4, then the 2nd step (ocs_prerun1) is _not_ required.

      If you want to user the image on a network file serer, e.g. samba file server, you can make it like:

      • ocs_prerun1="dhclient -v eth0"
      • ocs_prerun2="sleep 2"
      • ocs_prerun3="mount -t cifs -o user=$ACCOUNT,password=$PASSWD //$SAMBA_SERVER_IP/$PATH_TO_IMAGE /home/partimag" (Replace $ACCOUNT, $PASSWD, $SAMBA_SERVER_IP, $PATH_TO_IMAGE with appropriate values, like: "mount -t cifs -o user=administrator,password=apple //192.168.1.3/images2/clonezilla /home/partimag").
      • ocs_prerun4="sleep 2"
        Here we assume a DHCP server existing on the network, if you want to configure static IP address, you can use netowrking configuration utils, e.g. "ifconfig" and "rute" to make that.
      For images on a ssh server, you can put ocs_prerun3 as:
      • ocs_prerun3="sshfs $SSH_ACCOUNT@$SSH_SRV:"$SSHFS_DIR" /home/partimag/" (Replace $SSH_ACCOUNT, $SSH_SRV, AND $SSHFS_DIR with appropriate values, like: "sshfs chopin@192.168.100.254:/home/chopin /home/partimag". You can get more info about sshfs by reading its manual).
    4. Preseed the restoring job. We want to let user to choose the image to restore to /dev/sda1. The boot parameter about this is ocs_live_run:
      • ocs_live_run="ocs-sr -g auto -e1 auto -e2 -c -r -j2 -k -p true restoreparts ask_user sda1"

      //NOTE// This command can be easily got by running the interactive mode of Clonezilla live, then Clonezilla live will show you the command in green, as shown here. The word "ask_user" is a preserved word for the image or the destination disk/partition. When "ask_user" is used, Clonezilla live will show a dialog to let user to choose that.

    5. Then the syslinux.cfg or isolinux.cfg is:

      ---------------------------------------------
      label Clonezilla live
      MENU DEFAULT
      # MENU HIDE
      MENU LABEL Clonezilla live (Default settings, VGA 800x600)
      # MENU PASSWD
      kernel /live/vmlinuz
      append initrd=/live/initrd.img boot=live config noswap nolocales edd=on nomodeset noprompt ocs_prerun="mount /dev/sda4 /mnt" ocs_prerun1="mount --bind /mnt/Backup /home/partimag/ ocs_live_run="ocs-sr -g auto -e1 auto -e2 -c -r -j2 -k -p true restoreparts ask_user sda1" ocs_live_extra_param="" keyboard-layouts=NONE ocs_live_batch="no" locales="en_US.UTF-8" vga=788 ip= nosplash
      TEXT HELP
      * Clonezilla live version: 2.2.2-37-i686-pae. (C) 2003-2014, NCHC, Taiwan
      * Disclaimer: Clonezilla comes with ABSOLUTELY NO WARRANTY
      ENDTEXT

      ---------------------------------------------

    6. Now with the modified Clonezilla live, when you boot it, it will ask you the image and ask you to confirm twice, then do the job.

    PS.

    1. The fils in the Clonezilla live iso file are read-only, therefore it's easier to modify the files on USB. If you want to convert the live USB files as an iso file, you can refer to this. Remember, for live CD booting, you have to modify the syslinux/isolinux.cfg.
    2. Some hints about unattended mode could be found here.

[Back to 'Clonezilla Live Doc']

Clonezilla project. All Rights Reserved. Anyone is permitted to copy and distribute verbatim copies of this document under the terms of the GNU FDL Free Documentation License.