Firstly, thanks again to Gavin Spurgeon for his assistance with getting this solution working smoothly.
Two days ago I wrote an article about setting up PXE network booting. This is very useful when it comes to quick provisioning with Kickstarts or other utilities.
You can find my article here if you’d like to run through setting up PXE in your environment.
In this article, I’ll be covering for those Windows users amongst you, how to use CloneZilla (Open Source alternative to Symantec Ghost) combined with PXE to quickly deploy your company Standard Operating Environments (SOE’s).
I’ll be relying on you having already deployed a PXE server similar to my former article, as we will be using that as a baseline.
Lets start with a bit of background. For starters, some of you may be asking “What is CloneZilla?”
Many of you will remember spending hours and hours over the years making Symantec Ghost boot floppy disks and CD’s etc. Spending all of your time searching for network drivers to work with your brand new workstations that have just arrived. Basically CloneZilla is a free open source alternative to Ghost, however it works with practically everything. No more searching for disk and network drivers and the headaches associated with making boot disks.
In short, CloneZilla is Ghost, but its free, works and basically just lets you turn that frown upside down.
You can turn CloneZilla into a bootable CD, USB stick or as we are about to do, PXE boot it.
To set up a completely bulk standard network boot version of the usual CD version of CloneZilla, you will need to download the .zip version from your local mirror.
I have used the version below in my own environment.
In my former article, I asked you to create an images folder inside of /var/lib/tftpboot to store your PXE boot environments. I have created a “clonezilla” folder in which I have extracted the contents of the CloneZilla zip file.
Once you have extracted the zip file to /var/lib/tftpboot/images/clonezilla/, add the below text to the very end of your /var/lib/tftpboot/pxelinux.cfg/default file
Note: Make sure you change the IP address to your own IP or FQDN for your environment. In my scenario, my TFTP server is 10.0.0.10.
LABEL Clonezilla MENU LABEL Clonezilla KERNEL images/clonezilla/live/vmlinuz APPEND initrd=images/clonezilla/live/initrd.img boot=live config noswap nolocales edd=on nomodeset ocs_live_run="ocs-live-general" ocs_live_extra_param="" ocs_live_keymap="NONE" ocs_live_batch="no" ocs_lang="en_US.UTF-8" vga=788 nosplash noprompt ocs_prerun="" fetch=tftp://10.0.0.10/images/clonezilla/live/filesystem.squashfs
Once you have saved the above to your default file, you will be able to boot any network boot capable computer and boot straight into CloneZilla.
This is very handy for those who use CloneZilla very regularly as using CD/DVD media for this can be rather tedious.
If you’d like to take things futher, you can add another menu item to your PXE menu to automatically deploy an exiting SOE image.
For example,
I have created a sysprep’d Windows 7 CloneZilla image, and I deploy it by selecting the menu item called “Windows 7 Image deployment”.
You will need to have the image you wish to restore saved on a network accessible location.
Add the below text to your “default” file in /var/lib/tftpboot/pxelinux.cfg
LABEL Windows 7 Image deployment MENU LABEL Windows 7 Image deployment KERNEL images/clonezilla/live/vmlinuz APPEND initrd=images/clonezilla/ive/initrd.img boot=live config noswap nolocales edd=on nomodeset ocs_live_run="/opt/drbl/sbin/ocs-sr --batch -g auto -e1 auto -e2 -r -j2 -p reboot restoredisk Windows7_x86_64_Sysprep sda" ocs_live_extra_param="" ocs_live_keymap="NONE" ocs_live_batch="yes" ocs_lang="en_US.UTF-8" vga=788 nosplash noprompt ocs_prerun="mount -t nfs 10.0.0.1:/exports/clonezilla /home/partimag" fetch=tftp://10.0.0.10/images/clonezilla/live/filesystem.squashfs
If you look on the APPEND line, I am mounting an NFS location of 10.0.0.1:/exports/clonezilla which is where I have saved my image to.
My image is called “Windows7_x86_64_Sysprep” and I am deploying this image to the device “sda”.
If you would like to connect to a Windows 2008 R2 file server for accessing your images,
change
ocs_prerun="mount -t nfs 10.0.0.1:/exports/clonezilla /home/partimag"
to
ocs_prerun="mount -t cifs -o user=myuser@domain.com,password=mypassword //servername/sharename /home/partimag"
Its as simple as that. If you wish to deploy more images, just continue to add more menu items to your PXE menu list.
Happy cloning!
Hi, This is a great article and we did this to our existing PXE environment but it doesn’t work.
Here is our initrd file…
append initrd=clonezilla/initrd.img boot=live config noswap nolocales edd=on nomodeset ocs_live_run=”ocs-live-general” ocs_live_extra_param=”” keyboard-layouts=”” ocs_live_batch=”no” locales=”” vga=788 nosplash noprompt fetch=tftp://our.tftp.ser.ver/clonezilla/filesystem.squashfs
Here is what happens…
– loading vmlinuz……………
– loading initrd.img…………..
then a blank screen… Is there something in this command that could be causing this behavior? I would like to narrow it down but don’t know how to yet.
Any thoughts on how to get the Clonezilla Live menu just as we do when booting with the usb stick? That is what I’d like to see here to start…
thanks!
Steve
Hi Steve
Here are two copies from my working implementation.
Native CloneZilla boot just like CD/USB
LABEL Clonezilla-live
MENU LABEL Clonezilla Live (Ramdisk)
KERNEL images/clonezilla/i686/live/vmlinuz
APPEND initrd=images/clonezilla/i686/live/initrd.img boot=live config noswap nolocales edd=on nomodeset ocs_live_run=”ocs-live-general” ocs_live_extra_param=”” ocs_live_keymap=”NONE” ocs_live_batch=”no” ocs_lang=”en_US.UTF-8″ vga=788 nosplash noprompt ocs_prerun=”” fetch=tftp://10.0.0.10/images/clonezilla/i686/live/filesystem.squashfs
Native CloneZilla boot with auto-connect to NFS storage for /home/partimag
LABEL Clonezilla-live
MENU LABEL Clonezilla Live (Ramdisk)
KERNEL images/clonezilla/i686/live/vmlinuz
APPEND initrd=images/clonezilla/i686/live/initrd.img boot=live config noswap nolocales edd=on nomodeset ocs_live_run=”ocs-live-general” ocs_live_extra_param=”” ocs_live_keymap=”NONE” ocs_live_batch=”no” ocs_lang=”en_US.UTF-8″ vga=788 nosplash noprompt ocs_prerun=”mount -t nfs 10.0.0.1:/exports/clonezilla /home/partimag” fetch=tftp://10.0.0.10/images/clonezilla/i686/live/filesystem.squashfs
I’d also mention, that even if I have an error, I have output on the screen to indicate where it fails. I’ve never seen a blank screen after loading initrd before to be honest.
Hope this helps.
Dale
Hi,
Thanks for you greate guide.
I follow exactly your instruction with the same default file and the same clonzilla version, all of my tries and up after:
“waiting for ethernet card(s) up… if this fails, maybe the etheernet card is not supported by the kernel 3.2.0-2-686-pae?
Done.”
on that point it stuck.
(i tried it on 3 different PC and virtual PC all the same behavior).
can you please help me with that?
Thanks,
Orgad
Hi Orgad
Your best chance is to verify the type of network card being used in your machines you’ve used. I have seen what you are experiencing before, and in my case it turned out that the kernel modules for that network card was not available in the kernel that was used in that version of CloneZilla.
Hope this helps identify your issue.
Dale
Maybe your NIC requires non-free Binary Blobs. This is the case for e.g. Broadcom NICs. You can stick with the alternative branch in such a case as this contains non-free Firmware: http://clonezilla.org/downloads/download.php?branch=alternative
Outstanding write up. For those fighting with the tftp fetch stalling on filesystem.squashfs try fetching that file from a web server. I changed mine to fetch=http://$webserver_IP/filesystem.squashfs and any flavor works now.
Hi Reggie,
That is definitely good to point out, yes people can use any network based protocol they like here (ftp,http etc).
I haven’t experienced timeouts in any of my environments, but its good to know http resolved your issue.
Dale
Man, i really want to thank you for your article, you really, more than you can imagine, helped-me a lot. Thank you so mucth. Regards from Brasil.
Very helpful writeup. I am attempting to perform a mostly-automated installation, and am trying the example you gave towards the end of your article. Namely, starting from here:
“If you’d like to take things futher, you can add another menu item to your PXE menu to automatically deploy an exiting SOE image…
Add the below text to your “default” file in /var/lib/tftpboot/pxelinux.cfg…”
But… part of the text you say to enter includes this:
“ocs_live_run=”/opt/drbl/sbin/ocs-sr –batch -g auto -e1 auto -e2 -r -j2 -p reboot restoredisk Windows7_x86_64_Sysprep sda” ”
DRBL…. it sounds like there’s a sizable step missing here, regarding installing and configuring a DRBL server on the linux box. This isn’t something I’m wanting to put on mine, as I already have a full pxe/tftp/ipxe implementation. Is installing/configuring DRBL a requirement here? Any advice on what that APPEND line should look like if I’m simply wanting to utilise my existing pxe/tftp server setup?
Thanks!
Ryan