最後更新: 2020-07-28





In order to make Clonezilla more automatic, clonezilla have reserved some words for "IMAGENAME" and "DEVICENAME".

 * reserved names have special meanings

For image name:

  • "ask_user"
  • "autoname"
  • "autohostname"
  • "autoproductname"

For device name:

  • "all"
  • "ask_user"


ocs-sr will automatically find the non-busy (unmounted) device as the device name,

e.g. sda, sdb... (for "savedisk"/"restoredisk" mode), and sda1, sdb1... (for "saveparts"/"restoreparts" mode).


In the restoring mode, when "ask_user" is used in the "DEVICENAME"




Start GUI

# VGA Console(tty1)


Custome Clonezilla live iso


mkdir /home/partimag/zip2iso

cd /home/partimag/zip2iso/

# 拿出 ISO 內的 File

# boot on clonezilla

cp -a /run/live/medium/* ./


# On anther OS

unzip clonezilla-live-2.5.5-38-amd6.iso -d  ./

# Rebuild ISO (Full CLI)

xorriso -as mkisofs -R -r -J -joliet-long -l -iso-level 3 \
-no-emul-boot -boot-load-size 4 -boot-info-table -partition_offset 16\
-A 'Clonezilla live CD' \
-b syslinux/isolinux.bin -c syslinux/ \
-eltorito-alt-boot --efi-boot boot/grub/efi.img \
-isohybrid-mbr /usr/lib/ISOLINUX/isohdpfx.bin -isohybrid-gpt-basdat -isohybrid-apm-hfsplus ./  \
> /home/partimag/clonezilla-live.iso

# 簡化 CLI

xorriso -as mkisofs -R -r -J -joliet-long -l -iso-level 3 \
-no-emul-boot -boot-load-size 4 -boot-info-table -partition_offset 16 \
-A 'Clonezilla live CD' \
-b syslinux/isolinux.bin -c syslinux/ ./  \
> /home/partimag/clonezilla-live.iso


Boot Options


Boot parameters in syslinux/syslinux.cfg (for live USB) or syslinux/isolinux.cfg (for CD)

Clonezilla live is based on Debian live with clonezilla installed. Therefore there are 2 kinds of boot parameters:

1. Boot parameters from Debian live-boot and live-config.




# In Clonezilla live a patched live-initramfs is used, which is different from the original live-initramfs so that you can assign DNS server, too.


2. Boot parameters specially for Clonezilla. ("ocs_*")



It will be used only when ocs_live_run=ocs-live-restore (not for ocs-live-general or any other), then it will be passed to ocs-sr



To fetch tarall/zip/sh files from http(s), ftp, tftp, and local URL then extract to /opt/ in the Clonezilla live environment


ocs_preload="mount -t cifs // /tmp/cifs -o user=administrator,password=yourpasswd"

ocs_preload="mount -t nfs /tmp/nfs -o ro"


ssh service will be turned on when booting.

ocs_prerun, ocs_prerun1, ocs_prerun2...

It is intended for running a command before an operation of saving/restoring an image or cloning disk/partition is started.


ocs_prerun="df -h"

ocs_postrun, ocs_postrun1, ocs_postrun2...

It is intended for running a command after an operation of saving/restoring an image or cloning disk/partition has been completed.

E.g. ocs_postrun="/live/image/"


This boot parameter has higher priority than the action assigned by option "-p" in ocs-sr, and "-pa" in ocs-onthefly.

The value for ocs_overwrite_postaction is: [choose|reboot|poweroff]-on-[restoredisk|restoreparts|savedisk|saveparts|clone]


User Password


(1) account "user" with sudo privilege, password is "live"

append initrd=/live/initrd.img ... usercrypted=bkuQxLqLRuDW6

echo YOUR_PASSWORD | mkpasswd -s


echo YOUR_PASSWD | mkpasswd -m sha-256 -s




It contains the components that configure a live system during the boot process

live-config is only activated if 'boot=live' is used as a boot parameter.

Additionally, live-config needs to be told which components to run through the 'live-config.components' parameter or

which components to not run through the 'live-config.nocomponents' parameter.





1. To clone local sda to local sdb, run

ocs-onthefly -f sda -t sdb

2. To clone sda (in machine A with IP to sda (in machine B) via network,

# In machine A, boot it into DRBL client mode, then run

# -a, --server             Specify the running machine is in network clone server.   

ocs-onthefly -a -f sda

# Then in machine B, boot it into DRBL client mode, too. Then run

# -s, --source-IP IP       Specify the source IP address (used in target client machine)

ocs-onthefly --source-IP -t sda




sr = save restore


ocs-sr [OPTION] {savedisk|saveparts|restoredisk|restoreparts} IMAGE_NAME DEVICE



ocs-sr -q2 -c -j2 -z1p -i 4096 -sfsck -scs -senc -p command savedisk c8-20200727 vda

-q2, --use-partclone

Use partclone to save partition(s) (i.e. partclone > partimage > dd)

-c, --confirm

Wait for confirmation before saving or restoring


-z0, --no-compress

-z1p, --smp-gzip-compress 

Compress using parallel gzip program (pigz) when saving:

-z2p, --smp-bzip2-compress

Compress using parallel bzip2 program (lbzip2) when saving:

faster and smallest image file, good for multi-core or multi-CPU machine

 -z5p, --smp-xz-compress 

Compress using parallel xz when saving: slow but smallest image file, faster decompression than bzip2.

-z6p, --smp-lzip-compress 

Compress using parallel lzip when saving: slow but smallest image file, faster decompression than bzip2

-z8p, --lz4mt-compress

Compress using lz4mt when saving.

-z9p, --zstdmt-compress

Compress using zstdmt when saving.

-i, --image-size SIZE 

Set the size in MB to split the partition image file into multiple volumes files.

-j2, --clone-hidden-data 

Use dd to clone the image of the data between MBR (1st sector, i.e. 512 bytes) and 1st partition, which might be useful for some recovery tool.

-sfsck, --skip-fsck-src-part

Skip running fsck on the source file system before saving it.

-scs, --skip-check-restorable

By default Clonezilla will check the image if restorable after it is created.


Skip encrypting the image with passphrase

-p, --postaction [choose|poweroff|reboot|command|CMD]

When save/restoration finishes, choose action in the client, poweroff, reboot (default)

-gm, --gen-md5sum   Generate the MD5 checksum for the image.

------------------ 共用設定 ------------------

-nogui, --nogui      Do not show GUI (TUI) of Partclone or Partimage, use text only

-x, --interactive     Interactive mode to save or restore.



ocs-sr -l 0 -c -scr -j2 --iui restoredisk c8-20200727 sda

-l, --language INDEX Set the language to be shown by index number:

  • [0|en_US.UTF-8]: English,
  • [2|zh_TW.UTF-8]: Traditional Chinese (UTF-8, Unicode) - Taiwan
  • [a|ask]: Prompt to ask the language index

-c, --confirm

Wait for confirmation before saving or restoring

-b, -batch, --batch     

(DANGEROUS!) Run program in batch mode, i.e. without any prompt or wait for pressing enter key.

-g, --grub-install GRUB_PARTITION    

Install grub in the MBR of the disk containing partition GRUB_PARTITION with root grub directory in the same GRUB_PARTITION when restoration finishes,
GRUB_PARTITION can be one of "/dev/sda1", "/dev/sda2"... or "auto" ("auto" will let clonezilla detect the grub root partition automatically).
If "auto" is assigned, it will work if grub partition and root partition are not in the same partition.

-scr, --skip-check-restorable-r

By default Clonezilla will check the image if restorable before restoring.

-r, --resize-partition

Resize the partition when restoration finishes, this will resize the file system size to fit

the partition size. It is normally used when when a small partition image is restored to a larger partition.

-t, --no-restore-mbr

Do NOT restore the MBR (Mater Boot Record) when restoring image.

-k, --no-fdisk, --no-create-partition

Do NOT create partition in target harddisk. Default is to create the partition table.

If this option is set, you must make sure there is an existing partition table in the current restored harddisk.

-cm, --check-md5sum

Check the MD5 checksum for the image.

To use this option, you must enable -gm|--gen-md5sum option when the image is saved.

Note! It might take a lot of time to check if the image size is large.


Skip updating initramfs file(s) on the restored GNU/Linux.

-j2, --clone-hidden-data 

Use dd to clone the image of the data between MBR (1st sector, i.e. 512 bytes) and 1st partition, which might be useful for some recovery tool.




Create Recovery CD(ocs-iso) / USB flash drive(ocs-live-dev)

# Help

  • ocs-iso -h
  • ocs-live-dev -h

# Mount a working space(clonezilla image home)

mount /dev/sdb1 /home/partimag

# First

cd /home/partimag

# create clonezilla-live-c8-20200727.iso

ocs-iso c8-20200727

# create an ISO file with built-in pre-settings

ocs-iso -g en_US.UTF-8 -t -k NONE c8-20200727

-g, --ocs-live-language LANGUAGE

Assign the language when using clonezilla live, available languages are en_US.UTF-8, zh_TW.UTF-8

-t, --ocs-live-batch 

Set clonezilla live to run in batch mode, usually it's for restoring.

If this mode is set, some dialog question will be ignored.

-k, --ocs-live-keymap KEYBOARD_LAYOUT c8-20200727

Assign the keyboard layout when using clonezilla live.

"-k NONE"

means won't change the keyboard layout (default is US keyboard).

Custom Program

ocs-iso -g en_US.UTF-8 -k NONE -s -m ./custom-ocs

-m, --custom-ocs  PATH/custom-ocs  Use the customized ocs program 'custom-ocs' instead of the default one.

A sample script file /usr/share/drbl/samples/custom-ocs

Custom Pure ISO

-s, --skip-image

Do not include any clonezilla image. The is used to created a live CD with DRBL/Clonezilla programs only.

"-e" will be run by ocs-sr when cloning

With ocs-sr

ocs-iso -g en_US.UTF-8 -t -k NONE -e "..." c8-20200727