Welcome to Linux Forums! With a comprehensive Linux Forum, information on various types of Linux software and many Linux Reviews articles, we have all the knowledge you need a click away, or accessible via our knowledgeable members.
Find the answer to your Linux question:
Site Navigation
Linux Articles
Linux Forums
Linux Downloads
Linux Hosting
Free Magazines
Job Board
IRC Chat
RSS Feeds


Imagine a condition where you need to install many computers, say for a LAN in your office or lab. All systems have to have identical configuration. Installation from a boot CD/DVD is not advisable in this case as its time consuming and boring, above all! You can opt to copy the installed hard disk data/contents to another hard disk. In this case you don't have to take the trouble of running the installer or go through the complete installation process again and again for all the systems. All you have to do is the know using your Linux tools smartly.

Connect your hard disk and ensure proper connections before proceeding. The author is not responsible if in case the following procedure fails and ends up crashing your system. If you disagree then please don't continue.


Installation of GNU/Linux from CDROM is one of the easiest and friendly ways of GNU/Linux installation. All you need to know is to use two very low level *nix tools. I have installed Debian 5.0 on a bare 320GB hard disc by connecting it to a Ubuntu [9.04 - JJ]system  running as master and another 160GB hard disc with Debian 5.0 already installed on it.
  • Know Your Partitions
The first tool I'd like to introduce to you is fdisk. This is the partition table manipulator for GNU/Linux. Well, we don't have to create any partitions but need to know which hard disc image has to be copied. This can be known by the '-l' option. You have to be a privileged user for using this utility. The "fdisk -l" ran on my system as follows:

$ sudo fdisk -l
Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x0003e619

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1       19176   154031188+  83  Linux
/dev/sda2           19177       19457     2257132+   5  Extended
/dev/sda5           19177       19457     2257101   82  Linux swap / Solaris

Disk /dev/sdb: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x0003e619

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1          34      273073+  83  Linux
/dev/sdb2              35        1384    10843875    5  Extended
/dev/sdb5              35         642     4883728+  83  Linux
/dev/sdb6             643        1007     2931831   83  Linux
/dev/sdb7            1008        1335     2634628+  82  Linux swap / Solaris
/dev/sdb8            1336        1384      393561   83  Linux

Disk /dev/sdc: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

Disk /dev/sdc doesn't contain a valid partition table

Now, I can say that /dev/sda is my master (disc with ubuntu installed), /dev/sdb is the source (disc which has the installation done) and /dev/sdc. Please ensure the disc names before going to the next step. Check the screenshots at the end.

  • Choose the Hard Discs to be Copied
The second tool you would like to use is dd. This is used to copy and convert files. Before talking about this you should know why are we using this tool. It can copy data from/to raw sectors of a disc. Sounds interesting, but any mistake in the parameters may lead to loss of data permanently!

The hard disc which needs to be configured for your LAN would be called target disc from now on and the hard disc which is configured would be called source disc. Now, imagine that the source disc has used 12GByte(that is what it took on my system) for configuration then these 12GB have to be copied to the target disc. Now call 'dd' to do this job as follows:

dd if=<source_disk_device_name> of=<target_disc_device_name> bs=512 count=25165824

You have to have administrator permissions for running this.

if refers to the source disk name of refers to the target disk name bs specifies the block size to be copied at a time and count refers to the number of such blocks to be copied. The copy starts from the start of the disk .i.e. from the first track and first sector of first cylinder of the disk. So this copies the MBR for you too! All this can happen safely and smoothly only if care is taken in giving the arguments. Any mistake may screw up your disk!  Grab your cup of coffee because in say 10 - 20 minutes your installation is done. This instruction on my system looked as follows:

$ sudo dd if=/dev/sdb of=/dev/sdc bs=512 count=25165824
25165824+0 records in
25165824+0 records out
12884901888 bytes (13 GB) copied, 740.148 s, 17.4 MB/s

In approximately 13 minutes, the installation is complete. So this can save you a lot of time and you can copy disc image to multiple discs to multiply your speed.

The screen shots for fdisk and dd on my system are here:





I have tried this on my own following a suggestion from my collegue so I don't have any suggested references.

Rate This Article: poor excellent
 
Comments about this article
Good, but not scalable....
writen by: Tarthen on 2009-09-30 04:42:25
This technique is a good way, don't get me wrong, but there are better ways. One of these ways is the excellent Clonezilla - Image your hard drive to a file, make that file accessible over the network, by Samba, NFS or SSH, and then use the Clonezilla live CD to image across the network. Clonezilla also has the ability to do disk to disk. CZ uses dd, too, but it also has partimage, which I personally prefer, and ntfsclone on older versions when copying Windows workstations. Clonezilla, when booted into RAM or PXE, is also fantastic - have a fast enough network, and you can clone multiple PC's at once with minor issues. It's also FOSS, too, which makes it especially good :) .
RE: Good, but not scalable.... written by Tarthen:
4 x Terrible
writen by: archtoad6 on 2009-10-01 05:49:29
1. As "Tarthen" said, not the best choice of available techniques.

2. Worthless: I already know how to do this.

3. Non-idiomatic English, "This can be known", for example. Get a literate native speaker to copy edit.

4. Bad layout: use [code] blocks.
RE: 4 x Terrible written by archtoad6:
RE: 4 x Terrible
writen by: PA on 2009-10-01 11:02:37
Fair enough on point 1 but a) no need to repeat what has been already said and b) "not the best" is not the same as "terrible".
On points 2, 3 and 4; how petty your grievances are.
Reply to PA:
Reply to PA
writen by: UU14325 on 2009-10-04 13:43:30
True that! What a child.
@archtoad: There is more than one way to skin a cat and the author simply presented a way to do so. Don't waste the 0's and 1's on the servers or my time (or yours!) posting such trivial jibberish. It really is petty.
Reply to UU14325:
not really distributed
writen by: ramin.honary on 2009-10-07 23:33:45
Step 1: get a cheap USB hub ($25) and some cheap USB key drives that can hold a small, bootable Linux image ($10 * 4)
Step 2: connect your USB drives to the hub and connect the hub to your computer, use "tail /var/log/dmesg" to see which disks were added, e.g. "sda, sdb, sdc"
Step 3: Use "dd if=linux.iso | tee /dev/sda /dev/sdb /dev/sdc ..." to copy the image to all of your at the same time
Step 4: use each USB key drive to boot all your other machines
Step 5: make an ISO image of the Linux you have installed (e.g. hdb) that you want to copy to all other machines using "umount hdb
RE: not really distributed written by ramin.honary:

Comment title: * please do not put your response text here