Customize your Clonezilla Live CD

01-01-2010 | Remy van Elst


Table of Contents


At work we need to image laptops. We do that with clonezilla.
But some people think the clonezilla menu is to hard. So A colleague and I made a script to do it in 2 steps (mount and enter image name).
But that had to be integrated in to the clonezilla live CD.
That is a pain to do if you're on a windows vista PC.
But it worked, and I wanted to share it with the rest of the world.
Our script to backup can be found at the bottom of the page.
But how do I get that script on to the live USB?

This is how I do it:

mkdir rw.fs  
mkdir clonscript  
(above is only required once).  
mount -t unionfs -o dirs=rw.fs=rw:/mnt=ro unionfs clonscript  
cd clonscript  
mkdir clondir1  
copy the scripts, or nano them.  
(To launch a clonezilla script as root, make a launcher script, and put this in it:  
*#!/bin/sh  
sudo su -c /path/to/script/you/just/made.sh*  
cd ../../  
umount clonscript  
mksquashfs ./rw.fs ./filesystem.squashfs

Now the 2 filesystems are being put together.
The next time, mount it again, make a new directory (say clondir2) and
cp all the scripts from clondir1 into clondir2, and edit them from there.
Also change your root launch script to the new dir.

Now edit the isolinux/isolinux.cfg file. To start a script as root,
make a link to it as described earlier. Here is my setup:

* label RESTORE  
# MENU DEFAULT  
# MENU HIDE  
MENU LABEL RESTORE  
# MENU PASSWD  
kernel /live/vmlinuz1  
append initrd=/live/initrd1.img boot=live union=aufs  
hostname=jaunty edd=on nolocales ocs_live_run="/path/to/your/root/launcher/script.sh"  
ocs_live_extra_param="" ocs_live_keymap="NONE" ocs_live_batch="no"  
ocs_lang="" noprompt mode_option=800x600 toram=filesystem.squashfs  
ip=frommedia  
TEXT HELP  
TEST RESTORE  
ENDTEXT  
*  

Note this part: ocs_live_run="/path/to/your/root/launcher/script.sh". Change that every time you make a change to the script. (For every change to the script you make you must make a new directory and change your root launcher script. This is because your merging a read only file system. And read only cannot be overwritten.) Now make an ISO of it again. (At work I need to use the tool
folder2iso which can be downloaded here.

after you made the ISO, unetbootin it to USB or burn it to CD.

You can remove the USB stick or CD when clonezilla is imaging, because this boot script loads it into the ram.

If this can be done with less work, please post it in a comment, I
hate this way... (first start fcking vista, then virtualbox a mint,
then share a folder, then mount and edit, then folder2iso and at last
unetbootin...)... And thanks to the people of clonezilla for making such a wonderfull alternative to ghost and acronis ^.^

Example Backup Script
#!/bin/sh  
dhclient  
echo "###############################"  
echo "# Script made by Remy & David #"  
echo "###############################"  
echo  
echo  
echo Voer nu het wachtwoord van de laptop in   
echo  
mount -t cifs -o username="daniel" //192.168.1.2/image /home/partimag  
echo  
echo  
echo "Er komt nu een lijst met images"  
echo "IMAGES: "  
ls -n /home/partimag  
echo  
echo -n "Voer de naam van het image in(schoon#): "; read NAME;  
/opt/drbl/sbin/ocs-sr -q -c -z1 -p true saveparts "$NAME" "sda2"

Tags: bash, clonezilla, imaging, live-cd,