HOWTO - Starting
clonezilla in batchmode from local hard drive with a custom-ocs (automated
backup of hard drive)
The goal of the game is to install a multiple boot system
with GRUB, that gives the option to boot clonezilla live from hard drive in
batch mode.
The taken backup will be saved on a samba share in the local
network. After completion the system reboots.
In this example, debian lenny is installed in sda1, partion
sda2 is used for swapping, sda3 and sda5 will home clonezilla.
The ãstep by stepÒ-guide:
Disk
Drive: /dev/sda
Size: 5368709120 bytes, 5368 MB
Heads: 255 Sectors
per Track: 63 Cylinders:
652
Name
Flags Part
Type FS
Type
[Label]
Size (MB)
------------------------------------------------------------------------------------------------------
sda1
Boot
Primary
Linux ext3
3002,23
sda2
Primary
Linux swap / Solaris
1003,49
sda3
Primary
Linux ext3
501,75
sda5
Logical
Linux ext3
855,43
title
Clonezilla live on harddrive sda3 Jaunty
root
(hd0,2)
kernel /live-hd/vmlinuz1
boot=live union=aufs live-media-path=/live-hd vga=788 toram bootfrom=/dev/sda3
vga=791
initrd /live-hd/initrd1.img
boot
title
Clonezilla live batch on harddrive sda5
root
(hd0,4)
kernel /live-hd/vmlinuz1
boot=live union=aufs live-media-path=/live-hd vga=788 toram bootfrom=/dev/sda5
noprompt noprompt ocs_live_run="custom-ocs"
ocs_live_extra_param=""
ocs_live_keymap="/usr/share/keymaps/i386/qwertz/de-latin1-nodeadkeys.kmap.gz"
ocs_live_batch="yes" ocs_lang="en_US.UTF-8" vga=791
nolocales
initrd /live-hd/initrd1.img
boot
#!/bin/bash
# Author: Steven Shiau
<steven _at_ stevenshiau org>
# License: GPL
# When this script is ready,
you can run
# /opt/drbl/sbin/ocs-iso -g
en -k NONE -s -m ./custom-ocs
# to create the iso file for
CD/DVD. or
#
/opt/drbl/sbin/ocs-live-dev -g en -k NONE -s -c -m ./custom-ocs
# to create the zip file for
USB flash drive.
# Begin of the scripts:
# Load DRBL setting and
functions
if [ ! -f
"/opt/drbl/sbin/drbl-conf-functions" ]; then
echo "Unable to find
/opt/drbl/sbin/drbl-conf-functions! Program terminated!"
exit 1
fi
. /opt/drbl/sbin/drbl-conf-functions
.
/opt/drbl/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.
echo
"#########################################################################################"
echo "# 1. Configure
network"
dhclient
echo
"#########################################################################################"
echo "# 2. Mount the
clonezilla image home"
mkdir /home/partimag
mount -t cifs -o
username=user01,password=passw0rd //servername/archiv /home/partimag
echo
"#######################################after mounting, now showing
mounts###########"
mount
echo
"#########################################################################################"
echo "# 3. backing up
sda3 "
/opt/drbl/sbin/ocs-sr -b -q
-j2 -z1 -i 0 -p reboot savedisk "IMAGE" "sda"
echo
"#########################################################################################"
ocs-live-dev -g
en_US.UTF-8 -k /usr/share/keymaps/i386/qwertz/de-latin1-nodeadkeys.kmap.gz -j
./clonezilla-live-1.2.1-39.iso -x noprompt -t -s -c -m ./custom-ocs-1
Creating clonezilla Live
without any clonezilla image embedded...
The output file name is:
clonezilla-live-20090222.zip.
Estimated necessary space
size in target dev: 96 MB
Copying the system files
to working dir... This might take a few minutes... done!
Copying kernel, initrd,
etc...
Trying to find the boot
params from template live cd...
Adding syslinux menus for
Clonezilla live...
Preparing syslinux.exe,
syslinux, makeboot.bat and makeboot.sh...
Downloading
http://free.nchc.org.tw/syslinux/syslinux-3.72.tar.bz2...
Extracting files...
syslinux-3.72/linux/syslinux
syslinux-3.72/win32/syslinux.exe
syslinux-3.72/mbr/mbr.bin
adding: Clonezilla-Live-Version (stored
0%)
adding: COPYING (stored 0%)
adding: home/ (stored 0%)
adding: home/partimag/ (stored 0%)
adding: live/ (stored 0%)
.
.
.
adding: utils/mbr/ (stored 0%)
adding: utils/mbr/mbr.bin (stored 0%)
The created release file
is clonezilla-live-20090222.zip. You can extract all the files into your
pendrive, and run makeboot.bat from pendrive in MS windows.
Warning: DO NOT RUN
makeboot.bat from your local hard drive!! It is intended to be run from your
USB device.
Cleaning tmp dirs...
Done!
Screenshot of the batch mode while saving sda3.