Menu

PXE Booting automation

drewish
2009-11-24
2013-04-05
  • drewish

    drewish - 2009-11-24

    Hello guys,

    I'm wanting to PXE boot clonezilla live and automate the backup and recovery options. I found some older documents of this same question but the links under the documentation don't really explain what I need.

    Current pxelinux.cfg:

    label Clonezilla
    MENU LABEL Clonezilla
    KERNEL pub/clone/live/vmlinuz1
    APPEND initrd=pub/clone/initrd1.img boot=live union=aufs nolocales vga=788 fetch=http://192.168.x.x/pub/clone/live/filesystem.squashfs ocs_live_keymap="NONE" ocs_live_batch="yes" ocs_lang="en_US.UTF-8" ocs_prerun="mount -t nfs 192.168.x.x:/tftpboot/image /home/partimag" ocs_live_run="screen ocs-sr -g auto -e1 auto -e2 -b -j2 -p reboot restoredisk i386-partclone sda"

    The PXE options do get passed, but when the nfs option is loaded it freezes saying make sure /home/partimag is a directory. I drop into the shell and the only thing under /home is the account user.  Am I missing something? I tried to add prerun and liverun to do sudo –I and to mkdir –p /home/partimag but the directory is never created.

    The next thing I did was use unsquashfs to open the filesystem.squashfs then I created the directory and ran mksquashfs and moved it to the bootable directory. But that caused quite a few errors and I’m not too clear why (tried to start using nfs user/pass and not mounting). There were no errors logged for nfs and the mount command from above does work if you manually type it in.

    Links used:
    http://clonezilla.org/clonezilla-live/doc/fine-print.php?path=./08_Screen_session_with_PXE/00-pxe-setting.doc#00-pxe-setting.doc
    http://clonezilla.org/clonezilla-live/doc/fine-print.php?path=./99_Misc/00_live-initramfs-manual.doc#00_live-initramfs-manual.doc

    Is it possible to automate recovery and backup by passing all the values via pxelinux.cfg file, or do I have to create the custom scripts? I also couldn’t find anything in the pxe docs for the backup option the only examples given were the “restoredisk”, so is there a backup command such as “savedisk”?

     
  • Devlin7

    Devlin7 - 2009-11-25

    Check out "Log into a network share automatically", I am having the same sort of issues. My theory is that /home/partimage is not actually created until after the custom script completes, meaning that you can't automatically mount /home/partimag.

     
  • drewish

    drewish - 2009-11-25

    I believe you are absolutely correct. I checked out the post and that did help me to narrow down the search for sure. I do know now the only problem with full automation is the mount.

    The custom script you are talking about is the bash script that is loaded at boot time correct? I found custom ocs script doc somewhere under the cz live doc but i haven't tried them. If i figure out anything ill make an update

     
  • drewish

    drewish - 2009-11-26

    devlin7 thanks again. I pretty much cleared all the pxe stuff out and followed the load custom bash script. So our main goal would pretty much be the same.

    I know the bash script works, because i can boot up clonezilla and download the script with the busybox tftp. Once it's downloaded and ran the backup/restore is fully automated using nfs network storage, I just can’t get the script to load when booting. I did run into this though:
    http://clonezilla.org/clonezilla-live/customized-clonezilla-live.php

    And it shows creating for ISO/usb zip. Not sure if that would help you, but I’m about to try it out and see how it goes

     
  • Devlin7

    Devlin7 - 2009-11-26

    if my custom-ocs only contains the following
    sudo mount -t cifs //10.0.0.3/images -o username=clonezilla,password=clonezilla2010 /home/partimag

    This fails at boot time. My custom-ocs file is created and contains the above. In theory, if I run sh custom-ocs it should mount my drive but it doesn't. So what is different from me entering the same command at the prompt?

     
  • drewish

    drewish - 2009-11-27

    Well i finally got mine to work flawlessly.

    Devlin i would say you need to make sure the clonezilla image is the latest stable and that the script is not being executed with the prerun option and live_run. That seemed to be my problem but i updated the iso and boot options and the bash script was loaded perfectly. The ubuntu testing version kills the script for some reason but default debian works fine.

     
  • Devlin7

    Devlin7 - 2009-11-27

    Well Done Andish!

    Is there any chance I can see your pxe.cfg file?

    Are you able to post the contents of your scripts?
    i WASTED ANOTHER COUPLE OF HOURS ON THIS TODAY, DRIVING ME NUTS :-)
    I can see that it will do what I want, I just don't know how.

    Anyway congrats!

     
  • Steven Shiau

    Steven Shiau - 2009-11-27

    devlin7,

    If you still have problem about that, please summary your need, post your pxe config file, and the errors you have… , as details as possible.

    I will do my best to solve the problem for you.

    Steven.

     
  • drewish

    drewish - 2009-11-27

    devlin I know steven will know exactly whats up but here is my PXE file:

    label 1
    kernel pub/clone/live/vmlinuz1
    append initrd=pub/clone/live/initrd1.img boot=live union=aufs noswap noprompt vga=768 ip=frommedia fetch=http://x.x.x.x/pub/clone/live/filesystem.squashfs ocs_prerun="busybox tftp -g -l /tmp/cloneauto -r clone x.x.x.x" ocs_live_run="sudo bash /tmp/cloneauto" ocs_live_keymap="NONE" ocs_live_batch="yes" ocs_lang="en_US.UTF-8" nolocales

    and in my bash script i am not running any commands with sudo, only the main bash script is run with sudo.

    I also made sure to go re-downloaded the latest debian stable version of CZ, like i mentioned the ubuntu boots fine but clonezilla kills the bash script saying "not run by cz".

    Hope this helps you to get it working, but the clonezilla-live-1.2.2-31.iso should handle the pxe boot options with no problems. In my bash script besides have the mount option i went ahead and add the ocs-sr command for savedisk or restoredisk.

     
  • Devlin7

    Devlin7 - 2009-11-29

    Hi Andish / Steven,

    It seems that I am doing everything correctly. I did try the stable Karmic version but couldn't get past the kernel panic on boot. I get exactly the same thing with the prerelease/ unstable version.

    I am open to suggestions.  

     
  • Devlin7

    Devlin7 - 2009-11-29

    I just need to confirm something. When I setup CLonezilla on my Microsoft RIS/WDS server I copied all the LIVE files and all the syslinux files into the PXE boot folder. Is there anything else required?

     
  • Devlin7

    Devlin7 - 2009-11-29

    Infact, ignore the previous question my setup mirrors that described in one of your HOW-TO docs.

     
  • Devlin7

    Devlin7 - 2009-11-29

    My Default looks like this
    label WGHS Cloning Tool
    MENU DEFAULT
    #MENU HIDE
    MENU LABEL Dual Boot Windows7 - Ubuntu for Compucon
    # MENU PASSWD
    kernel vmlinuz1
    append initrd=initrd1.img boot=live union=aufs noswap noprompt vga=788 ip=frommedia fetch=tftp://10.0.0.3/filesystem.squashfs ocs_prerun="busybox tftp -g -b 10240 -r Compucon-ocs -l /opt/drbl/sbin/Compucon-ocs 10.0.0.3" ocs_live_run="sudo bash /opt/drbl/sbin/Compucon-ocs" ocs_live_keymap="NONE" ocs_live_batch="no" ocs_lang="en_US.UTF-8" nolocales
    TEXT HELP
    *When boot is complete select options 2 and run sudo /clone?
    ENDTEXT

    My Compucon-ocs looks like this
    mount -t cifs //10.0.0.3/images /home/partimag -o user=wghs/clonezilla%clonezilla201
    sudo /opt/drbl/sbin/ocs-sr -g auto -e1 auto -e2 -c -r -j2 -p true restoredisk "Compucon_W7_Linux" "sda"

     
  • Devlin7

    Devlin7 - 2009-11-30

    Well it took a little while but I got there in the end.

    IT seems you can't use a Windows editor to create the ocs file. Wordpad adds a ^M to the end of each line. I could see this when I used vi to edit the ocs file. I edited the ocs files using gedit and Clonezilla behaves as it should. I couldn't understand why when my OCS file echo'ed the commands to another file it would work but when I tried to run them directly it wouldn't. At least now I know.

    Thanks Steven and Andish for your help.

     
  • Steven Shiau

    Steven Shiau - 2009-12-01

    Oops… Yes. If you edit the UNIX script file on MS windows, you have to use the command "dos2unix" to convert the script file to UNIX format…

    Steven.

     

Log in to post a comment.

MongoDB Logo MongoDB