Menu

Need help in batch clonezilla live from hdd

Help
stefan s
2009-02-20
2013-04-05
  • stefan s

    stefan s - 2009-02-20

    Hello!

    I really love to do my backups with cloenzilla.But now I am stuck in my project.
    The goal of it lies in an automatic backup of the hard disk.

    Clonezilla is installed in an ext3-partition on it. It boots perfectly by grub into gui-mode, backups are well done with it.

    The next step, after creating a custom-ocs, that mounts a samba-share and finally does an backup with reboot, succesfully works on a CD, too. The Server boots by CD and does automatically the backup job and reboots, too. Perferct!

    But, if I install clonezilla live on hard disk with the zip-file, the batch mode does not function.

    Here is my command to create the zip-file:
    ---------------------------------------------------------------------------------------------------------------------------
    ocs-live-dev -t -g en-US.UTF-8 -k none -j /home/user/clonezilla-live-20090130-jaunty.iso -s -c -m /home/partimag/custom-ocs-smb-backup
    ---------------------------------------------------------------------------------------------------------------------------

    The custom-ocs "custom-ocs-smb-backup" looks like this:
    ---------------------------------------------------------------------------------------------------------------------------
    #!/bin/bash
    # Author: Steven Shiau <steven _at_ nchc org tw>
    # License: GPL
    # 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
    # 1. Configure network
    dhclient
    # 2. Mount the clonezilla image home
    #prep-ocsroot -t samba_server
    mkdir -p /home/partimag
    mount -t cifs -o username=backup,password=backup //server/share /home/partimag
    cd /home/partimag/pc10030
    ls -alsh
    # 3. create the image
    /opt/drbl/sbin/ocs-sr -l en_US.UTF-8 -b -c -q -j2 -z2 -i 2000 -p reboot savedisk "server1" "sda"
    ---------------------------------------------------------------------------------------------------------------------------

    Finally, I tried a second way: I edited the menue.lst of grub. I put ocs_* commands in it, but only the keyboard, the language and the network was configured. I don`t know how to mount samba share and start the backup. 

    In both situation I am stuck, can you please help me?

    Sincerely

    Stefan

     
    • Steven Shiau

      Steven Shiau - 2009-02-23

      Stefan,
      What's the error message or how it does not work ? Please give more info so it's easier to do something for you.
      BTW, you might need to use your "custom-ocs-smb-backup" and the boot parameters on grub config file both.

      Steven.

       
    • stefan s

      stefan s - 2009-02-23

      Steven,
      thank you very much for your answer. I will now try to explain more precisely, what i have tested. (I changed the name of the custom-ocs script and now I use clonezilla-live-1.2.1-39.iso).

      Okay: much text, logs, commands, scripts, ....
      -------------------------------------------------------------------------------------------
      --> the filesystems

      debian:/home/partimag# df -ha
      Filesystem            Size  Used Avail Use% Mounted on
      tmpfs                 126M     0  126M   0% /lib/init/rw
      proc                     0     0     0   -  /proc
      sysfs                    0     0     0   -  /sys
      procbususb               0     0     0   -  /proc/bus/usb
      udev                   10M   96K   10M   1% /dev
      tmpfs                 126M  4.0K  126M   1% /dev/shm
      devpts                   0     0     0   -  /dev/pts
      rootfs                126M  6.6M  119M   6% /
      /dev/sda5             803M  406M  357M  54% /live/image
      tmpfs                 126M  6.6M  119M   6% /live/cow
      tmpfs                 126M     0  126M   0% /live
      fusectl                  0     0     0   -  /sys/fs/fuse/connections
      /dev/sda1             2.8G  714M  2.0G  27% /mnt
      /dev/sda5             803M  406M  357M  54% /live/image/home/partimag
      -------------------------------------------------------------------------------------------
      --> the grub-entry

      debian:/home/partimag# tail -n 7 /mnt/boot/grub/menu.lst

      title           Clonezilla live 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 ocs_live_batch="yes"
      initrd /live-hd/initrd1.img
      boot
      -------------------------------------------------------------------------------------------
      --> the used custom script "custom-ocs-1"

      #!/bin/bash
      # Author: Steven Shiau <steven _at_ nchc org tw>
      # 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=stefan,password=totengeil //192.168.2.179/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 saveparts "IMAGE" "sda3"
      echo "#########################################################################################"

      -------------------------------------------------------------------------------------------
      -> creating the zip-file with custom ocs script

      debian:/home/partimag# ocs-live-dev -g en_US.UTF-8 -k /usr/share/keymaps/i386/qwertz/de-latin1-nodeadkeys.kmap.gz -j download/clonezilla-live-1.2.1-39.iso -x noprompt -t -s -c -m download/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: live/freedos.img (stored 0%)
        adding: live/vmlinuz1 (stored 0%)
        adding: live/gpxe.lkn (stored 0%)
        adding: live/initrd1.img (stored 0%)
        adding: live/memtest (stored 0%)
        adding: live/eb.zli (stored 0%)
        adding: live/filesystem.squashfs (stored 0%)
        adding: packages.txt (stored 0%)
        adding: parameters.txt (stored 0%)
        adding: pkg/ (stored 0%)
        adding: pkg/custom-ocs (stored 0%)
        adding: syslinux/ (stored 0%)
        adding: syslinux/memdisk (stored 0%)
        adding: syslinux/ocswp.png (stored 0%)
        adding: syslinux/syslinux.cfg (stored 0%)
        adding: syslinux/menu.c32 (stored 0%)
        adding: syslinux/vesamenu.c32 (stored 0%)
        adding: syslinux/chain.c32 (stored 0%)
        adding: syslinux/drblwp.png (stored 0%)
        adding: utils/ (stored 0%)
        adding: utils/README.txt (stored 0%)
        adding: utils/linux/ (stored 0%)
        adding: utils/linux/VERSION.txt (stored 0%)
        adding: utils/linux/syslinux (stored 0%)
        adding: utils/linux/makeboot.sh (stored 0%)
        adding: utils/win32/ (stored 0%)
        adding: utils/win32/VERSION.txt (stored 0%)
        adding: utils/win32/syslinux.exe (stored 0%)
        adding: utils/win32/makeboot.bat (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!

      -------------------------------------------------------------------------------------------

      --> extracting the zip-file in /dev/sda5

      debian:/home/partimag# unzip clonezilla-live-20090222.zip -d .
      Archive:  clonezilla-live-20090222.zip
      extracting: ./Clonezilla-Live-Version 
      extracting: ./COPYING              
         creating: ./home/
         creating: ./home/partimag/
         creating: ./live/
      extracting: ./live/freedos.img     
      extracting: ./live/vmlinuz1        
      extracting: ./live/gpxe.lkn        
      extracting: ./live/initrd1.img     
      extracting: ./live/memtest         
      extracting: ./live/eb.zli          
      extracting: ./live/filesystem.squashfs 
      extracting: ./packages.txt         
      extracting: ./parameters.txt       
         creating: ./pkg/
      extracting: ./pkg/custom-ocs       
         creating: ./syslinux/
      extracting: ./syslinux/memdisk     
      extracting: ./syslinux/ocswp.png   
      extracting: ./syslinux/syslinux.cfg 
      extracting: ./syslinux/menu.c32    
      extracting: ./syslinux/vesamenu.c32 
      extracting: ./syslinux/chain.c32   
      extracting: ./syslinux/drblwp.png  
         creating: ./utils/
      extracting: ./utils/README.txt     
         creating: ./utils/linux/
      extracting: ./utils/linux/VERSION.txt 
      extracting: ./utils/linux/syslinux 
      extracting: ./utils/linux/makeboot.sh 
         creating: ./utils/win32/
      extracting: ./utils/win32/VERSION.txt 
      extracting: ./utils/win32/syslinux.exe 
      extracting: ./utils/win32/makeboot.bat 
         creating: ./utils/mbr/
      extracting: ./utils/mbr/mbr.bin    

      -------------------------------------------------------------------------------------------
      --> changing the name of directory

      debian:/home/partimag# mv live/ live-hd

      -------------------------------------------------------------------------------------------

      to the point: :-)

      1.
      the system boots up by grub. the network interface is configured by dhcp, but instead of the batch-mode the interactive gui-mode starts with the language option. :-(
      2.
      booting up with "ocs_debug", dhcp okay, prompt arrives, the script "/live/image/pkg/custom-ocs" can be started manually - the backup process starts, success!

      -------------------------------------------------------------------------------------------
      debian:/home/user# /live/image/pkg/custom-ocs
      #########################################################################################
      # 1. Configure network

      Internet Systems Consortium DHCP Client V3.1.1
      Copyright 2004-2008 Internet Systems Consortium.
      All rights reserved.
      For info, please visit http://www.isc.org/sw/dhcp/

      Listening on LPF/eth0/00:0c:29:13:0b:3b
      Sending on   LPF/eth0/00:0c:29:13:0b:3b
      Sending on   Socket/fallback
      DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 3
      DHCPOFFER from 192.168.2.1
      DHCPREQUEST on eth0 to 255.255.255.255 port 67
      DHCPACK from 192.168.2.1
      bound to 192.168.2.113 -- renewal in 912151556 seconds.
      #########################################################################################
      # 2. Mount the clonezilla image home
      mkdir: cannot create directory `/home/partimag': File exists
      #######################################after mounting, now showing mounts###########
      tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
      proc on /proc type proc (rw,noexec,nosuid,nodev)
      sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
      procbususb on /proc/bus/usb type usbfs (rw)
      udev on /dev type tmpfs (rw,mode=0755)
      tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
      devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=620)
      rootfs on / type rootfs (rw)
      /dev/sda5 on /live/image type ext3 (ro,noatime,errors=continue,data=ordered)
      tmpfs on /live/cow type tmpfs (rw,noatime,mode=755)
      tmpfs on /live type tmpfs (rw)
      fusectl on /sys/fs/fuse/connections type fusectl (rw)
      //192.168.2.179/archiv on /home/partimag type cifs (rw,mand)
      #########################################################################################
      # 3. taking the backup
      Setting the TERM as xterm-color
      clonezilla image dir: /home/partimag
      *****************************************************.
      *****************************************************.
      Collecting the disk info in this machine...
      Selected device [sda3] found!
      The selected devices: sda3
      clonezilla image dir: /home/partimag
      *****************************************************.
      *****************************************************.
      Activating the partition info in /proc... done!
      Selected device [sda3] found!
      The selected devices: sda3
      Getting /dev/sda3 info...
      Shutting down the Logical Volume Manager
      Finished Shutting down the Logical Volume Manager
      Checking the integrity of partition table in the disk /dev/sda...
      Reading the partition table for /dev/sda...RETVAL=0
      *****************************************************.
      The first partition of disk /dev/sda starts at 63.
      Saving the hidden data between MBR (1st sector, i.e. 512 bytes) and 1st partition, which might be useful for some recovery tool, by:
      dd if=/dev/sda of=/home/partimag/IMAGE/sda-hidden-data-after-mbr skip=1 bs=512 count=62
      62+0 records in
      62+0 records out
      31744 bytes (32 kB) copied, 0.00866478 s, 3.7 MB/s
      *****************************************************.
      done!
      Saving the MBR data for sda...
      1+0 records in
      1+0 records out
      512 bytes (512 B) copied, 0.000932191 s, 549 kB/s
      *****************************************************.
      *****************************************************.
      Starting saving /dev/sda3 as /home/partimag/IMAGE/sda3.XXX...

      Steve, what could I am doing wrong? Why does the script does not start automatically?

      I hope, that my post isn`t declared as spam?! ;-)

      best wishes from germany
      Stefan

       
      • Steven Shiau

        Steven Shiau - 2009-02-24

        Stepan,
        You have to refer to the file /syslinux/syslinux.cfg, and use those boot parameters on your grub config.
        i.e.
        --------------------
        title Clonezilla live 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 ocs_live_batch="yes"   ocs_live_keymap=... ocs_live_run=... ocs_lang=... ....
        initrd /live-hd/initrd1.img
        boot
        --------------------
        i.e. Some required boot parameters are missing. If you assign them as boot parameters, clonezilla won't ask. If not, Clonezilla asks about them.

        For more info, please check:
        http://clonezilla.org/clonezilla-live/doc/fine-print.php?path=./99_Misc/00_live-initramfs-manual.doc#00_live-initramfs-manual.doc

        Steven.

         
    • stefan s

      stefan s - 2009-02-24

      hi steven,
      thx for pointing to syslinux.cfg ! following section in menu.lst works like a charm!

      ----------------------------------------------------------------------------------------------------------------------------------------------------------------
      title           Clonezilla live batch on harddrive sda5 2
      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

      ----------------------------------------------------------------------------------------------------------------------------------------------------------------

      best support by you.
      thx a lot!

      are you interested in me writing a little howto for your website?

      stefan

       
      • Steven Shiau

        Steven Shiau - 2009-02-25

        Stefan,
        Nice to know it's working there.
        Yes, please write a howto and share that with others.
        Thanks.

        Steven.

         
    • stefan s

      stefan s - 2009-03-07

      hi steven,
      i have problems sending you my little howto by email.

      steven nchc org tw:
      Connected_to_140.110.96.44_but_connection_died._(#4.4.2)/I'm_not_going_to_try_again;_this_message_has_been_in_the_queue_too_long./

      greetings
      stefan

       
    • stefan s

      stefan s - 2009-03-07

      hi steven,
      i have problems sending you my little howto by email.

      steven nchc org tw:
      Connected_to_140.110.96.44_but_connection_died._(#4.4.2)/I'm_not_going_to_try_again;_this_message_has_been_in_the_queue_too_long./

      greetings
      stefan

       
      • Steven Shiau

        Steven Shiau - 2009-03-07

        My other email addresses:
        jhshiau _at_ yahoo com
        steven_shiau _at_ users sourceforge net

        Steven.

         

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.