Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

There are lots of tools like FoG, G4L, PING, CloneZilla, etc. which allow you to boot from a CD/USB-key and follow some on-screen menus to backup your hard disk to an FTP server, SSH server, or file-share on some other machine.

But [to reduce any possibility of human error when this task is done many times] is it possible to create a customised boot-disk which automatically stores a copy of your HDD image to a specified location?

share|improve this question
Most OSs have the ability to run a script at boot-time, so what you want to do should be possible. – martineau Nov 28 '12 at 12:36
I did precisely this with Ghost for a older system I had. Ghost had a command line interface, so it was possible to write a startup BAT file to do everything automatically. (But it's been so long I've even forgotten what the startup BAT file is named. And this was on a diskette. I'm not sure you can SYS a CD.) – Daniel R Hicks Nov 28 '12 at 13:37
Here's how it was done a few Windows versions back: – Daniel R Hicks Nov 28 '12 at 13:41

You could customize a Clonezilla live image to do whatever you want, for example, automate the image to always backup your HDD into a specific partition without all the steps that you must type before execute the task.

For example, everytime you execute a task with Clonezilla live, it tells your something like it just before you type "Y" to confirm the task:

Next time you can run this command directly: 
/opt/drb1/sbin/ocs-sr -g auto -e1 auto -e2 -c -r -j2 -p true restoreddisk Monimage-img sda

It could be used by you to automate it into your custom Clonezilla live DVD:

Use your own script and run it on Clonezilla live

This doc describes how to use your own script and run it on clonezilla live

First, prepare your own program, say, a script "custom-ocs". A sample script file /opt/drbl/samples/custom-ocs, which allows 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), can be found when you are running clonezilla live (version 1.0.3-20 or later) or in DRBL server (version 1.7.12-1 or later). More examples are available in /opt/drbl/samples/custom-ocs, you can refer to them.

If you edit the script on MS windows, you have to convert the format to Unix format. You can use the command "dos2unix" to convert it to UNIX format. If you do not convert the format, your script won't work on Unix/Linux system.

Remember to add shebang line (#!/bin/bash) in your script to avoid a "Exec format error" issue. Boot Clonezilla live, enter command prompt, and run "sudo su -" to become root. Mount a working space as /home/partimag. You can use the command "prep-ocsroot" to help you to do that, or use mount command to mount that. E.g. run "mount /dev/sda1 /home/partimag" to use /dev/sda1 as the working dir.

Copy the custom-ocs to dir /home/partimag.

cd /home/partimag

Run the follow on Clonezilla live command prompt:

/opt/drbl/sbin/ocs-iso -g en_US.UTF-8 -k NONE -s -m ./custom-ocs

to create the iso file for CD/DVD. or /opt/drbl/sbin/ocs-live-dev -g en_US.UTF-8 -k NONE -s -c -m ./custom-ocs to create the zip file for USB flash drive.

In the above examples, "-g en_US.UTF-8" means the language will be English, "-k NONE" means won't change the keyboard layout (default is US keyboard). For other options, please run "/opt/drbl/sbin/ocs-iso -h" or "/opt/drbl/sbin/ocs-live-dev -h" to get more info.

share|improve this answer
Where can you find these "examples in /opt/drbl/samples/custom-ocs" -- that directory doesn't exist on the clonezilla live-CD. – OJW Nov 29 '12 at 11:26
I already did it, but it was a long time ago, I can't remember but take a look at another reference: – Diogo Nov 29 '12 at 11:29
up vote 0 down vote accepted

There's a good guide to creating a bootable custom Linux distribution here:

(including the actual scripts required to compile .iso files from a directory structure where you can edit the final system which will be on the Live CD)

Doing the "ghosting a hard-disk" part is then just a case of running dd (e.g. from /etc/rc.d) and storing the output in a file somewhere, like:

dd if=/dev/sda bs=1M | gzip -c | ssh fileserver "cat > remotefile.img.gz"
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.