[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[seul-edu] Signal Ground : Stupid dd Tricks (or, Why We Didn't buy Norton Ghost)

I just saw this, and remembered that some folks were asking about
this sort of thing a while ago.  Please visit the website for a nice
article about using standard Linux utilities to duplicate an
expensive Windows-world commercial utility.


Doug Loss                 God is a comedian playing
Data Network Coordinator  to an audience too afraid
Bloomsburg University     to laugh.
dloss@bloomu.edu                Voltaire

Title: Signal Ground : Stupid dd Tricks (or, Why We Didn't buy Norton Ghost)
Signal Ground
About Us


Other Linux Links
- Slashdot
- Linux Weekly News
- kernel.org

Recent News
Big Blue's Power4 Processor In-Depth
October 17, 2000

Compaq Test Drive Program
October 17, 2000

AMD About to Release 1.2GHz Athlon and 800MHz Duron
October 16, 2000

Sun Releases Star Office to Open Source
October 14, 2000

Transmeta based Sony: Longer Battery Life, Lower Performance
October 13, 2000

Corel's Govt. Filing Hints At Microsoft's Linux Strategy
October 13, 2000

Linux to run on IBM's Entire eServer Line
October 10, 2000

Transmeta Crusoe Equiped Laptops Coming Soon
October 8, 2000

Linux Version Convergence Will Emerge
October 6, 2000

Torvalds Says 2.4 Kernel By Years End
October 6, 2000

CNET Article on Linux 2.4 SMP
October 5, 2000

Debian/ARM on an iPAQ
October 5, 2000

Intel Cancels Timna Processor and Delays Pentium 4
October 1, 2000

Slashdot Gets Hacked
October 1, 2000

LinuxPlanet Makes Us Laugh
September 28, 2000

Search Options
Stupid dd Tricks (or, Why We Didn't buy Norton Ghost)
October 18, 2000 8:39:17.000 Software
The company that employs Tom and me builds big pieces of food processing machinery that cost upwards of $400K. Each machine includes an embedded PCs running -- and I cringe -- NT 4. While the company's legacy currently dictates NT, those of us at the lower levels of the totem pole work to wedge Linux in wherever we can. What follows is a short story of a successful insertion that turned out to be (gasp!) financially beneficial to the company, too.

The Scenario

Anybody who's ever had the ... errr... pleasure... of installing Windows NT knows that it takes a long time to simply install the basic OS, vendor-specific drivers, service packs, etc. I once counted the number of reboots necessary for a full installation, and it was upwards of 6. While perhaps some Microsoft masochists take a sick pride in wasting a perfectly good hour and a half, our production folks soon grew tired of the process -- since every single machine we ship has to have NT installed from the ground up.

Permit me a short tangent: While typing this article, I asked my wife how to spell "masochist". She was in the middle of an attempted spelling when the phone rang. I answered, and after a typical 2 second delay, the quiet voice of one of those annoying telemarketers could be heard. The conversation went something like this:

Ken: Hello?
Lady: *Pause* ... Hi, may I speak to Mr. or Mrs...
Ken (interrupting): No, but I have a question for you. Do you know how to spell "masochist"? M-A-S-O-C-H-I-S-T, does that sound correct?
Lady: I really don't have any idea, sir.
Ken: Okay, thank you. Goodbye. *Click!*

And now, back to your regularly scheduled article.

In the face of this installer boredom, somebody suggested that we consider using Norton Ghost to do the installations. The promise was intriguing. Do one of these painstaking procedures, then duplicate the raw contents of the drive off to an image on some external medium, and then use that image to create duplicated drives in a matter of minutes.

So it was requested that Tom look into this. He did, and found that Ghost works well; it does exactly what we wanted it to. You boot off of a floppy (while the image medium is in another drive), and Ghost does the rest.

The problem lies in Ghost's licensing. If you want to install in a situation like ours, you have to purchase a Value-Added Reseller (VAR) license from Symantec. And, every time you create a drive, you have to pay them about 17 dollars. When you also figure in the time needed to keep track of those licenses, that adds up in a hurry.

Software licensing issues always come as a bit of a shock to me, since I've been living in an open-source world for some time now. And I've taken to using this moment of surprise as an opportunity to say, "how could I use Linux to do the same task?" Sometimes, a dim flickering of a light comes on.

It finally occurred to me that we could use Linux and a couple of simple tools (dd, gzip, and a shell script) to do the same thing as Ghost -- at least as far as our purposes go. Here's what we did:

Install Linux on a Removable Disk
You could use whatever you want, but we have an abundance of Fujitsu 230MB magneto-optical drives at our company. It's easy to install on these, because you can treat them like any other fixed disk. We skipped the swap partition, because this little Linux system wouldn't have very heavy demands put on its VM system.

We installed Red Hat simply because we had it on hand. Slackware would have been a much better choice for a tiny system like this, since the "no frills" Red Hat install was still over 100MB. Whatever you use, trim it down as much as you can. I found a number of RPMs that I was able to remove from the Red Hat install, and I got it down to a somewhat more reasonable 70MB.

There's no reason why you need to start any of the common services, either. Just boot it up and give me a prompt, please.

Prepare the System
If you've just finished a fresh installation, you should be good to go. If, on the other hand, you're making an image of a hard disk that's been in use for a while, you'll want to use something like DOS's SCANDISK to move everything to the front of the partition. SCANDISK calls this a "full optimization".

Copy off the Master Boot Record (MBR)
Boot up your Linux-on-Removable system and execute the following command:

dd if=/dev/hda of=hda.mbr bs=512 count=1

Replace the "hda" with the device you're trying to make an image of. This command rips the first 512 bytes off of the hard disk, which gives you the partition table and the entry point for the bootloader.

Create a Compressed Disk Image
You should have a good idea of how much data is on this partition. If not, mount it and use df -h to figure it out. Then, execute the following command:

dd if=/dev/hda1 bs=1M count=150 | gzip > hda1-image.gz

Again, replace the "hda1" with the partition that you're duplicating. Also, replace the "150" with the number of Used megabytes on the partition. This process will take a while; it copies all of the data off of the partition and puts it in a compressed image. When we were done, the compressed image was about a 55 MB in size.

Write a Restoration Script
We wrote a quick little script to make life easier for the folks who will be using our utility. It needs to do a couple of things: copy the MBR to the new disk, format the DOS partition, and then uncompress the image as it copies it to the partition.

Our script looks like this:


echo && echo
echo "This program will copy the system disk image to the first hard"
echo "drive attached to the system. This will DESTROY ALL DATA on the drive."
echo -n "Do you want to continue (Y/N)? "
read ans

if test "$ans" != "Y" -a "$ans" != "y";
then exit 0;

echo -n "Writing disk image... "

dd if=hda.mbr of=/dev/hda >& /dev/null
mkdosfs /dev/hda1 >& /dev/null
zcat hda1-image.gz | dd of=/dev/hda1 >& /dev/null

echo "done!"
echo "The computer will now reboot".

You get the idea. It is left as a exercise to the reader to get this to run automatically at boot.

The Results?

We showed our little program to management, and they were impressed. We were able to create disk images almost as quickly as Norton Ghost, and we did it all in an afternoon using entirely free software. The rest is history.

-- Ken Treis

Recent Articles
Stupid dd Tricks (or, Why We Didn't buy Norton Ghost)
October 18, 2000

Tux and the Sistene Chapel T-Shirt
October 14, 2000

Book Review: Linux Hardware Handbook
October 10, 2000

Review: Enterasys Networks RoamAbout (Wireless Ethernet)
October 1, 2000

Running Linux on the AOpen AX3S Pro Motherboard
September 21, 2000

Feature: About Signal Ground
September 12, 2000

Linux Hardware Support Survey Part 1: Motherboards
August 31, 2000

Book Review: Running Linux
August 28, 2000

Going Linux, Part 3: Choosing a Modem for Linux
August 11, 2000

Editorial: Transmeta's x86 Compatibility
July 13, 2000

Soyo SY-6VCA/7VCA Motherboard Reviews
July 8, 2000

The Linux Victory? Q2 SPECWeb99 Results
July 5, 2000

SMP: What's in it for You?
June 29, 2000

Signal Ground Rebuttal: Paul Thurrott Editorial
June 19, 2000

Going Linux, Part 2: Caldera OpenLinux eDesktop 2.4
June 12, 2000

It's like distributed.net, but you get paid.

Back to Signal Ground

Generated with Swazoo/Hydrogen