DRBL 企鵝龍

Diskless Remote Boot in Linux
DRBL logo DRBL/Clonezilla進階使用 DRBL logo
Print all this session
Clonezilla : 有關Clonezilla的進階使用說明
  1. Clonezilla live與Clonezilla SE (Server Edition)原理與架構介紹
  2. Clonezilla box mode介紹
  3. Unicast, multicast, broadcast clone介紹與注意事項
  4. 利用virtualbox來做Clonezilla開發與測試環境
  5. PXE開啟Clonezilla live作法
  6. 我要怎麼自己從無到有做一個Clonezilla live ?
  7. 客製化Clonezilla live製作
  8. 有沒有可能把Clonezilla Live放到硬碟中來執行?
  9. 利用Clonezilla live作為Clonezilla SE用戶端的作業系統
  10. 使用Clonezilla live的開機參數來預先植入相關指令與動作
客製化Clonezilla live製作
Clonezilla內含幾個例子來自己做一個客製化的Clonezilla live,檔案有:
  1. /usr/share/drbl/samples/custom-ocs: 讓使用者可以選擇
    • 將印象檔從/dev/hda1(或者/dev/sda1)備份到/dev/hda5(或者/dev/sda5)
    • 將印象檔從/dev/hda5(或者/dev/sda5)還原到/dev/hda1(或者/dev/sda1)
  2. /usr/share/drbl/samples/custom-ocs-1: 掛載網路芳鄰的印象檔伺服器,然後選擇印象檔來還原。

這裡我們以/usr/share/drbl/samples/custom-ocs-1為例:
### BEGIN ###
#!/bin/bash
# Author: Steven Shiau 
# License: GPL
#
# In this example, it will allow your user to use clonezilla live to choose 
# (1) A samba server as clonezilla home image where images exist.
# (2) Choose an image to restore to disk.

# When this script is ready, you can run
# ocs-iso -g en_US.UTF-8 -k NONE -s -m ./custom-ocs-1
# to create the iso file for CD/DVD. or
# ocs-live-dev -g en_US.UTF-8 -k NONE -s -c -m ./custom-ocs-1
# to create the zip file for USB flash drive.

# Begin of the scripts:
# Load DRBL setting and functions
DRBL_SCRIPT_PATH="${DRBL_SCRIPT_PATH:-/usr/share/drbl}"

. $DRBL_SCRIPT_PATH/sbin/drbl-conf-functions
. /etc/drbl/drbl-ocs.conf
. $DRBL_SCRIPT_PATH/sbin/ocs-functions

# load the setting for clonezilla live.
[ -e /etc/ocs/ocs-live.conf ] && . /etc/ocs/ocs-live.conf
# Load language files. For English, use "en_US.UTF-8". For Traditional Chinese, use "zh_TW.UTF-8"
ask_and_load_lang_set en_US.UTF-8

# The above is almost necessary, it is recommended to include them in your own custom-ocs.
# From here, you can write your own scripts.

# 1. Configure network
# If you are sure there is a DHCP server, you can use "dhclient -v eth0" instead of ocs-live-netcfg.
ocs-live-netcfg

# 2. Mount the clonezilla image home. Available types:
# local_dev, ssh_server, samba_server, nfs_server
prep-ocsroot -t samba_server

# 3. Restore the image
if mountpoint $ocsroot &>/dev/null; then
  ocs-sr -g auto -e1 auto -e2 -c -r -j2 -p choose restoredisk "ask_user" "ask_user"
else
  [ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE
  echo "Fail to find the Clonezilla image home $ocsroot!"
  echo "Program terminated!"
  [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
fi

#
umount $ocsroot &>/dev/null
### END ###

有了這個客製化的程式,我們就可以產生一個自己客製化的Clonezilla live。依照上例,我們改成不是掛載samba伺服器,而是ssh伺服器:
  • cp /usr/share/drbl/samples/custom-ocs-1 custom-ocs-1
  • gedit custom-ocs-1
    將"prep-ocsroot -t samba_server"改成"prep-ocsroot -t ssh_server"
  • 下載要使用的Clonezilla live的版本,例如我們要這個修改後的custom-ocs-1結合Clonezilla live 20130409-quantal-i386,就下載clonezilla-live-20130409-quantal-i386.iso:
    wget http://free.nchc.org.tw/clonezilla-live/alternative/testing/20130409-quantal/clonezilla-live-20130409-quantal-i386.iso
  • 確認clonezilla程式的版本號碼(非clonezilla live版本)>= 3.3.32-drbl1。
  • 產生CD/DVD用的iso檔案,檔名是clonezilla-live-mine.iso:
    ocs-iso -g zh_TW.UTF-8 -k NONE -s -m ./custom-ocs-1 -j clonezilla-live-20130409-quantal-i386.iso -i mine
  • 產生USB隨身碟用的zip檔案, 檔名是clonezilla-live-mine.zip:
    ocs-live-dev -g zh_TW.UTF-8 -k NONE -s -c -m ./custom-ocs-1 -j clonezilla-live-20130409-quantal-i386.iso -i mine
Print this page

Last modified: November 16 2018 09:16:38.