Donnerstag, 14. Oktober 2010

Automatisches Backup auf eine Netzwerkfreigabe mit CloneZilla

0. Laden des Tools von http://www.pendrivelinux.com/boot-multiple-iso-from-usb-multiboot-usb/

1. Herunterladen der CloneZilla ISO unter: http://clonezilla.org/ (Alternative Version)

2. Herunterladen der Memtest ISO von http://www.memtest.org/

3. USB-Stick einstecken, Tool (MultiBootISOs-X.X.X.X.exe) unter Windows starten
Formatieren des Sticks auswählen und die Memtest Datei.
Und das Programm laufen lassen.

4. ggf. die CloneZilla ISO Datei entpacken mit z.B: 7zip (http://www.7-zip.org/)
in das Verzeichnis clonezilla auf dem USB-Stick

5. anpassen der Datei: menu.lst auf folgenden Inhalt


default 0

timeout 5

color NORMAL HIGHLIGHT HELPTEXT HEADING

splashimage=/splash.xpm.gz

foreground=FFFFFF

background=000000





title Boot Clonezilla (AUTOBACKUP /dev/sda)

find --set-root /clonezilla/live/initrd1.img

kernel /clonezilla/live/vmlinuz1 boot=live live-config noswap nolocales edd=on nomodeset ocs_live_run="/live/image/clonezilla/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 live-media-path=/clonezilla/live

initrd /clonezilla/live/initrd1.img





title Boot Clonezilla (AUTOBACKUP /dev/hda)

find --set-root /clonezilla/live/initrd1.img

kernel /clonezilla/live/vmlinuz1 boot=live live-config noswap nolocales edd=on nomodeset ocs_live_run="/live/image/clonezilla/custom-ocs-hda" 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 live-media-path=/clonezilla/live

initrd /clonezilla/live/initrd1.img





title Boot Clonezilla

find --set-root /clonezilla/live/initrd1.img

kernel /clonezilla/live/vmlinuz1 boot=live live-config noswap nolocales edd=on nomodeset ocs_live_run='ocs-live-general' ocs_live_extra_param='' ocs_live_keymap='de' ocs_live_batch='no' ocs_lang='en' vga=788 ip=frommedia nosplash live-media-path=/clonezilla/live toram=filesystem.squashfs

initrd /clonezilla/live/initrd1.img





# Suggested by Erhan Sohail

title Boot First Hard Drive (HDD)

map (hd0) (hd1)

map (hd1) (hd0)

map --hook

chainloader (hd0)+1

rootnoverify (hd0)



title Restart

reboot



title Shutdown

halt



6. erstellen der 2 Dateien: custom-ocs und custom-ocs-hda im Verzeichnis clonezilla auf dem USB-Stick

mit folgendem Inhalt:

#!/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 -t cifs -o username=USERNAME,password=PASSWORD //SERVERNAME/SHARE /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 "#########################################################################################"



bzw. die Zeile

/opt/drbl/sbin/ocs-sr -b -q -j2 -z1 -i 0 -p reboot savedisk "CLIENTNAME_`date +%H%M%S_%d%m%Y`" "hda"

in der Datei: custom-ocs-hda anpassen


ACHTUNG: es müssen folgende Zeilen angepasst werden:

mount -t cifs -o username=USERNAME,password=PASSWORD //SERVERNAME/SHARE /home/partimag

ersetzen in z.B.

mount -t cifs -o username=backup,password=backup4client //10.1.1.250/backup /home/partimag


/opt/drbl/sbin/ocs-sr -b -q -j2 -z1 -i 0 -p reboot savedisk "CLIENTNAME_`date +%H%M%S_%d%m%Y`" "sda"

ersetzen in z.B.

/opt/drbl/sbin/ocs-sr -b -q -j2 -z1 -i 0 -p reboot savedisk "CLI01_`date +%H%M%S_%d%m%Y`" "sda"


Das wars....

1 Kommentar:

  1. Hallo,
    ich bin auf diesen Artikel gestoßen, da ich momentan ein ähnliches Thema habe und nun automatisieren wollte.

    Ich habe das Skript gebaut und in meinen Stick mit Clonezilla integriert. Die aktuellste alternate Version wohl gemerkt.
    Was dann passiert, ist dass beim Durchlauf am Ende nur /bin/bash^M: bad Interpreter erscheint.

    Hast Du hier eine Idee?

    Ein manuelles Backup auf das Share funktioniert problemlos.

    AntwortenLöschen