|
| Thu, Dec 04th | home | browse | articles | contact | chat | submit | faq | newsletter | about | stats | scoop | 08:01 UTC |
|
login « register « recover password « |
| [Article] | add comment | [Article] |
When you have over a hundred computers to install, you really start to scratch your head and think that it would be nice not to do the same installation a hundred times. When I faced this problem, I looked at computer cloning as a solution. I did not want to spend big bucks on commercial software like Norton Ghost. I know that some people might be skeptical about using Open Source software, but I gave partimage a try and found it to work very nicely. Copyright notice: All reader-contributed material on freshmeat.net is the property and responsibility of its author; for reprint rights, please contact the author directly. Because you have to boot a different OS in order to clone the one on the hard drive, I downloaded System Rescue CD. The only problem with it was that it does not boot with SATA hard drives. There is a known bug listed in the project bug list. If you need to clone SATA hard drives, you can use an installation of Linux with partimage on a separate HDD. Experienced Linux users might point out that there is also the venerable dd command, which makes a bit-by-bit copy of the given partition. The drawback of dd is that the images created are much larger than ones created with partimage, because partimage saves only used portions of the drive. Case studyI would like to use the following example to show how to clone a Linux installation to a different computer. First, I have to note that the new computer where you will put a copy of the drive image needs to have a motherboard with the same architecture as the original one. Otherwise, Linux will not boot. Now, let's start. I have a computer with Fedora Core 2 Linux installed on an IDE drive with the following partitions:
I would like to create images of these partitions and use them to make an exact duplicate on a drive of the same size in another computer. Part 1: Make an HDD Image of the Installation
I connect another HDD as a secondary master, where I will put hard drive
images of the first disk, and boot using System Rescue CD. During
booting, it asks for a keyboard to use, then offers the
Under temp1, we can make a directory to store our images.
Now, it's time to save the Master Boot Record and Partition Table information of the /dev/hda drive.
I use the .mbr extension just to show that this is a Master Boot Record.
.pt is for Partition Table. Now, we're ready to run partimage to save the contents of the /dev/hda1, /dev/hda2, and /dev/hda4 partitions. We do not need to image the swap partition, as it can be created after applying the partition table information to a new drive. To save a partition, I use the following command:
This will create a compressed file of the first partition and, if it is larger than 700 MB, split it into multiple 700 MB files which end with 000, 001, ..., ###. 700 Mb is just enough to put one file on a CD, if you ever want to backup your installation. After executing the above command, I type a description of the image and hit F5 to continue.
I will not explain each flag I use in a command, since you can view them
by running Repeat the above command for the /dev/hda2 and /dev/hda4 partitions, and a copy of the first hard drive is done.
Part 2: Restore the Image to a New Drive on a Different Computer
The new computer can have an HDD of the same size or larger. Images we
made in the first part of the tutorial cannot be applied to a smaller
HDD than the one we made a copy from. Connect an HDD with images as a
secondary master and boot with System Rescue CD. When you get to the
Now, we can restore the master boot record on the new drive.
Before we can run partimage, we also need to apply partition table information to the new drive.
Now, everything is ready for partimage. Use the following command to restore the image to the new drive:
After you hit enter, partimage will display information about the image. You can verify that this is the right image for this partition and click F5 to continue. After it's done, repeat the above command for the remaining partitions:
Now, all that's left is to make swap on the /dev/hda3 partition.
This will create a default swap structure and will use the whole /dev/hda3 partition for it. Restoration of the installation is complete. We can shut down and disconnect the second HDD. I had one case in which the GRUB loader would not load after restoration. If this happens to you, get a Fedora Core 2 Installation CD and boot into Linux rescue. After that, you can use chroot to switch to the installation on the HDD and restore grub by running grub-install /dev/hda. This will fix the boot loader, and Linux should load nicely after that. This process can be used for Windows installations, as well. If you would like to look at other ways to do it for Windows systems, there is a very nice tutorial on cloning Windows XP installations using Norton Ghost, HDClone, and Ranish Partition Manager. ConclusionI hope you enjoyed reading how I cloned a Linux installation. Please drop me a note if you have a comment or suggestion, or would like to add something new. Author's bio: Vlad Setchin currently works as a Systems Designer and Administrator for both Linux and Windows platforms. His main interest as an IT professional is in development of software compatible across multiple platforms. He and his wife Anastassiya are both originally from Kazakhstan (a former Republic of the Soviet Union) and now live in Victoria, Australia. T-Shirts and Fame! We're eager to find people interested in writing articles on software-related topics. We're flexible on length, style, and topic, so long as you know what you're talking about and back up your opinions with facts. Anyone who writes an article gets a t-shirt from ThinkGeek in addition to 15 minutes of fame. If you think you'd like to try your hand at it, let jeff.covey@freshmeat.net know what you'd like to write about. [Comments are disabled]
[»]
Simple correction we have to add "swapon" to use the swap file
[»]
I hate to advocate using the best tool for the job... But Norton Ghost 9 is all of $60 MSRP, and even the basic version includes support for storing images on a network share for cloning from an image. I use it for all my workstations at work, both Windows and Linux, and it includes all the dynamic resizing features you could want.
[»]
Re: I hate to advocate using the best tool for the job...
--
[»]
imaNgine About a year ago, while I was working with a small foundation we hit a
problem with the disk cloning that was used from start: bpbatch (free, but
closed source bpbatch). Workstations
were mostly Win98 machines (probably best suited for educational software)
connected to a server. The cloning program ran in a PXE environment.
To solve those problems, I created a network bootable diskimage running
Linux, added a bash script which could create a master image on the server
or retrieve it to be cloned on a machine similar to the master (remember
the workstations were MS Windows based).
On the server a dhcp daemon should be running, as well as NFS.
User intervention was possible, and some feedback was given using a dialog interface. Because dialog was too difficult to handle for our interns, I also created a graphical interface using nano-X and TinyWidgets which used the same syntax as curses-dialog. All this is available under the GPL: schoolLAN-imaNgine-5.2.0-1.i386.rpm containing everything you need. Source for TinyWidgets, which had some modifications, and the new dialog will take some time beacuse of an unfortunate hard disk crash. At least most of the source survived in a backup. For those of you able to read Dutch, have a look at Stichting SchoolLan to read more about the foundation. --
[»]
Not tar? Why would you want to use partimage instead of
[»]
Great article One thing that I've been looking for information about (and hopefully
someone can help me out here) is a means to send images out on a network
using multicast.
[»]
Re: Great article Search for a project called Frisbee.
[»]
Re: Great article We use FAI (Fully Automated Install).
[»]
great but.. First of all thanx to the authors for this useful tutorial and software..
[»]
Re: great but..
[»]
Start with a small partition The solution to the small partition issue is to create your master image on a small partition. I support several hundred Windows 2K and XP boxes and have had very few problems with partimage. I created a master syspreped image with all of our standard apps and configurations on a 5GB partition. Now if a new image ever needs to be installed I know it will fit. After the install I use QTParted to resize the partition to desired size. If I have problems with the boot partition I use the partimage boot image restore option.
[»]
different sizes of a partition for cloning an 1:1 partition, I don't really need partimage. dd and gzip
are my best friends.
[»]
Re: different sizes of a partition
|