Multiple Custom-ocs with Multiple Operating Systems using GRUB

Note: Puppy Linux was used for Gparted, install Grub, and editing scripts



#1. Create multiple partitions using Gparted




#2. Install Operating System




#3. Install CloneZilla to “sda5”





Title CloneZilla

root (hd0,4)

kernel /live-hd/vmlinuz1 boot=live union=aufs vga=791 ip=frommedia live-media-path=/live-hd bootfrom=/dev/sda5 toram

initrd /live-hd/initrd1.img

boot






#4. Creating multiple custom-ocs to automate restore, and creating images




#!/bin/bash

# Author: Steven Shiau <steven _at_ stevenshiau org>

# License: GPL

# Ref: http://sourceforge.net/forum/forum.php?thread_id=1759263&forum_id=394751

# In this example, it will allow your user to use clonezilla live to choose

# (1) backup the image of /dev/hda1 (or /dev/sda1) to /dev/hda5 (or /dev/sda5)

# (2) restore image in /dev/hda5 (or /dev/sda5) to /dev/hda1 (or /dev/sda1)

# Here we assume the filesystems are ntfs.


# 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.

#

# IF NEEDED TO MOUNT FOR NTFS USE "ntfs-3g" instead of "mount"


# 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". For Chinese, use "tw.UTF-8"

ask_and_load_lang_set en_US.UTF-8

#

# 1. Mount the CloneZilla image

mkdir -p /home/partimag/

mount /dev/sda5 /home/partimag/



/opt/drbl/sbin/ocs-sr -b -g auto -e1 auto -e2 -c -j2 -k -p reboot restoreparts "XP-restore" "sda1"



Under the /opt/drbl/sbin/ --- make sure the file name is call “Vista-restore” and the image points to the “sda2” drive. For example: /opt/drbl/sbin/ocs-sr -b -g auto -e1 auto -e2 -c -j2 -k -p reboot restoreparts "Vista-restore" "sda2"



title Restore XP Image

root (hd0,4)

kernel /live-hd/vmlinuz1 boot=live union=aufs ip=frommedia live-media-path=/live-hd vga=791 toram bootfrom=/dev/sda5 noprompt noprompt ocs_live_run="/live/image/live-hd/XPrestore" ocs_live_extra_param="" ocs_live_keymap="NONE" ocs_live_batch="yes" ocs_lang="en_US.UTF-8" vga=791 nolocales

initrd /live-hd/initrd1.img

boot

#

title Restore Vista Image

root (hd0,4)

kernel /live-hd/vmlinuz1 boot=live union=aufs ip=frommedia live-media-path=/live-hd vga=791 toram bootfrom=/dev/sda5 noprompt noprompt ocs_live_run="/live/image/live-hd/VistaRestore" ocs_live_extra_param="" ocs_live_keymap="NONE" ocs_live_batch="yes" ocs_lang="en_US.UTF-8" vga=791 nolocales

initrd /live-hd/initrd1.img

boot



Edit your script file by editing the /opt/drbl/sbin/ section like this: Note: make sure you copy these scripts also into the “live-hd” along with the other two scripts.


mkdir -p /home/partimag/

mount /dev/sda5 /home/partimag/


/opt/drbl/sbin/ocs-sr -q -c -j2 -z1 -i 2000 -p reboot saveparts "customXP" "sda1"






mkdir -p /home/partimag/

mount /dev/sda5 /home/partimag/


/opt/drbl/sbin/ocs-sr -q -c -j2 -z1 -i 2000 -p reboot saveparts "customVista" "sda1"



title Create XP Image

root (hd0,4)

kernel /live-hd/vmlinuz1 boot=live union=aufs ip=frommedia live-media-path=/live-hd vga=791 toram bootfrom=/dev/sda5 noprompt noprompt ocs_live_run="/live/image/live-hd/XPcreate" ocs_live_extra_param="" ocs_live_keymap="NONE" ocs_live_batch="yes" ocs_lang="en_US.UTF-8" vga=791 nolocales

initrd /live-hd/initrd1.img

boot

#

title Create Vista Image

root (hd0,4)

kernel /live-hd/vmlinuz1 boot=live union=aufs ip=frommedia live-media-path=/live-hd vga=791 toram bootfrom=/dev/sda5 noprompt noprompt ocs_live_run="/live/image/live-hd/Vistacreate" ocs_live_extra_param="" ocs_live_keymap="NONE" ocs_live_batch="yes" ocs_lang="en_US.UTF-8" vga=791 nolocales

initrd /live-hd/initrd1.img

boot




This procedure can be created many times over as along as your hard-drive is big enough to hold several CloneZilla images. The size of the harddrive for this procedure was 150 gigs on a Dell laptop. Currenly I have Xp 32/64 bit and Vista 32/64 bit images along with custom images stored on one hard drive. Below is a photo of my Grub menu where you can select either Cloning type process and will be fully automated.