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
Sda1: NTFS = XP
Sda2: NTFS = Vista
Sda4: logical drive Ext3 = CloneZilla Images
Sda5: logical drive Ext3 = CloneZilla with costom-ocs
#2. Install Operating System
Install XP on “sda1”
After full installation is complete, install GRUB on the MBR so that grub is now the official boot-loader. Note: I use puppy linux to install grub because it has a nice gui menu for clean installations. And make sure you point too “sda5” where the grub folder will be created.
Run CloneZilla from USB or Cd-Rom drive and “Saveparts” from “sda1” to “sda4” and name the file “XP-restore”.
Go back into “Gparted” and delete XP from “sda1” and reformat “sda1” as NTFS again. Note: reason why we remove XP from partition is so that when you install Vista, Vista will not install its own dual boot manager. Remember, GRUB is our multi-boot loader NOT Windows.
Now install Vista on “sda2”
After full Vista installation is complete, you will notice GRUB does not show up as your boot-loader. Don’t panic, boot back into puppy linux and restore Grub to the MBR. Note: in terminal type grub. In the grub console type root (hd0,4) then type setup (hd0) then quit. This will restore GRUB.
Run CloneZilla from USB or Cd-Rom drive and “Saveparts” from “sda2” to “sda4” and name the file “Vista-restore”.
After CloneZilla has completed creating the Vista image, go back into CloneZilla and “restoreparts” of XP back onto “sda1”.
Now that XP has been restored to “sda1” reboot your computer and GRUB will now be able to boot from XP or Vista.
#3. Install CloneZilla to “sda5”
Download CloneZilla zip folder and unzip the files to “sda5”
Rename the “live” folder to “live-hd”
Go to your menu.lst file which is located on your “sda5” drive under /boot/grub/menu.lst and edit the grub menu as followed.
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
Reboot your computer and CloneZilla will now appear as part of the boot options in GRUB.
#4. Creating multiple custom-ocs to automate restore, and creating images
Create a script that RESTORES your images like this one and name it “XPrestore”
#!/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"
Create a second script like this one and name it “VistaRestore”
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"
Now insert these two scripts by copying the files to the “live-hd” folder.
Go back into Grub and edit your menu.lst file to add Restore operating system options to the menu.
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
Create another script that CREATES your images and name it “XPcreate”
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"
Do the same for Vista and name the script “Vistacreate”
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"
Edit your menu.lst file and add the following
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
To restore your Created custom images, just follow the first section on how to restore images and just name the scripts and custom created image file accordingly.
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.