Clonezilla 再生龍

自由與開放原始碼的硬碟備份,還原對拷軟體
Clonezilla logo Clonezilla live 文件集 Clonezilla logo
Print all this session
Customized script with PXE : 使用自己shell script來跑Clonezilla live
  1. 將shell script放在PXE主機,然後用戶端PXE開機後自動執行
將shell script放在PXE主機,然後用戶端PXE開機後自動執行
本例中,我們假設:(1) PXE主機的IP address是192.168.120.254; (2)客製化的shell script名稱是custom-ocs-2,放置在PXE主機的tftpd根目錄下(舉例而言,若你的PXE伺服器是DRBL主機,路徑是/tftpboot/nbi_img/)
此時,在PXE主機上的PXE設定檔,內容類似:

------------------------
label Clonezilla Live
MENU DEFAULT
# MENU HIDE
MENU LABEL Clonezilla Live
# MENU PASSWD
kernel vmlinuz1
append initrd=initrd1.img boot=live union=overlay username=user config components quiet noswap edd=on nomodeset enforcing=0 noeject vga=788 fetch=tftp://192.168.120.254/filesystem.squashfs ocs_prerun="busybox tftp -g -r custom-ocs-2 -l /tmp/custom-ocs-2 192.168.120.254" ocs_live_run="bash /tmp/custom-ocs-2" keyboard-layouts=NONE ocs_live_batch="no" locales="en_US.UTF-8" nolocales
TEXT HELP
Boot Clonezilla live via network
ENDTEXT

------------------------
而shell script檔custom-ocs-2內容類似:

------------------------
#!/bin/bash
. /usr/share/drbl/sbin/drbl-conf-functions
. /usr/share/drbl/sbin/ocs-functions
. /etc/ocs/ocs-live.conf

# Load language file
ask_and_load_lang_set en_US.UTF-8

# 1. Mount the clonezilla image home.
# Types: local_dev, ssh_server, samba_server, nfs_server
prep-ocsroot -t nfs_server

# 2. Restore the image
if mountpoint /home/partimag/ &>/dev/null; then
  ocs-sr -l en_US.UTF-8 -c -p choose restoredisk ask_user ask_user
else
  [ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE
  echo "Fail to find the Clonezilla image home /home/partimag!"
  echo "Program terminated!"
  [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
fi
------------------------

//注意// Shell script記得在第一行加#!/bin/bash,以避免這個"Exec format error"的問題.

有關Clonezilla live更多的開機參數,請參考這個文件

Print this page

Last modified: March 26 2022 03:45:14.