Sonntag, 19. Juni 2011

Clonezilla: Automatisches Backup auf ext. USB Festplatte

CloneZilla BootCD/ISO anpassen um ein Automatisches Backup
auf eine USB-Festplatte machen zu können.

Downloaden der ISO z.B. clonezilla-live-20110530-natty.iso
http://clonezilla.org/downloads/alternative/iso-zip-files.php

Öffnen der ISO-Datei: clonezilla-live-20110530-natty.iso mit ISOMaster (http://www.littlesvr.ca/isomaster/)

1. Erstellen eines Verzeichnises "custom" in der ROOT des ISOs

2. Erstellen des Scripts "ocs-clientname.sh" für das Backup
in diesem Beispiel wird eine ext. USB-Festplatte
mittels uuid gemountet und nach /home/partimag gemountet

Das Script erzeuget ein Verzeichnis clientname_HHMMSSTTMMJJJJ in das das Backup geschrieben wird.


Script für /dev/sda

##!/bin/bash
# Author: Steven Shiau
# 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 /dev/disk/by-uuid/9a467114-d745-4b53-b1ab-f70ca1918d0d /home/partimag

echo "#######################################after mounting, now showing mounts###########"
mount
echo "#########################################################################################"
echo "# 3. backing up sda"
/opt/drbl/sbin/ocs-sr -b -q -j2 -z1 -i 0 -p reboot savedisk "clientname_`date +%H%M%S_%d%m%Y`" "sda"
echo "#########################################################################################"



Script für /dev/hda

##!/bin/bash
# Author: Steven Shiau
# 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 /dev/disk/by-uuid/9a467114-d745-4b53-b1ab-f70ca1918d0d /home/partimag

echo "#######################################after mounting, now showing mounts###########"
mount
echo "#########################################################################################"
echo "# 3. backing up hda"
/opt/drbl/sbin/ocs-sr -b -q -j2 -z1 -i 0 -p reboot savedisk "clientname_`date +%H%M%S_%d%m%Y`" "hda"
echo "#########################################################################################"



Wichtig ist das das Script: "ocs-clientname.sh" mittels chmod 755 ausführbar gemacht wird.
oder per ISOMaster mit change Permissions rwx-r-x-r-x


Wie findet man die uuid einer Partiton herraus ?

Booten mit der CloneZilla ISO/CD

Enter Commandline

$ sudo su -

# tune2fs -l /dev/sdbX | grep "Filesystem UUID:"

z.B.

# tune2fs -l /dev/sdb1 | grep "Filesystem UUID:"


3. Anpassung / Erstellung der Datei: isolinux/isolinux.cfg

# Since no network setting in the squashfs image, therefore if ip=frommedia, the network is disabled. That's what we want.
label Clonezilla clientname
# MENU HIDE
MENU LABEL Autobackup CLIENTNAME
# MENU PASSWD
kernel /live/vmlinuz
append initrd=/live/initrd.img boot=live hostname=natty config quiet noswap nolocales edd=on nomodeset ocs_live_run="/live/image/custom/ocs-clientname.sh" 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" video=uvesafb:mode_option=800x600-16 ip=frommedia
nosplash
TEXT HELP
* Clonezilla live version: 20110530-natty. (C) 2003-2011, NCHC, Taiwan
* Disclaimer: Clonezilla comes with ABSOLUTELY NO WARRANTY
ENDTEXT


4. die Orginale Datei: /isolinux/isolinux.cfg entfernen
und die selbst erstellte Datei einfügen

5. Speichern als neues ISO
ggf. auf CD-ROM brennen

Keine Kommentare:

Kommentar veröffentlichen