
228
|
Chapter 9, Administration and Automation
#74 Clone Your Linux Install
HACK
HACK
#74
Clone Your Linux Install Hack #74
Deploy a single installation of Linux across many computers.
Cloning is simply a method by which some data is copied exactly, from one
medium to another. This can be a physical CD being copied into a CD
image (such as an ISO image) or, in the case of this hack, copying a hard-
disk partition into a file that can be stored for archival purposes or deployed
to several machines. The use of cloning is very widespread on the Internet,
with CDs and floppies being distributed as images that are just a bit-for-bit
copy of the original medium. Cloning can also be used to move your Linux
system to a larger hard drive.
Create an Image
Linux systems generally have a utility installed called dd (data dump) that
can accept an input from a device and pipe the output as an exact copy of
the original to another device or a file. This is the tool you should use when
creating a cloned image of an installation.
First, you need to find out which partition on the hard disk contains the root
filesystem. You can do this using the
mount command:
foo@bar:~# mount
It should give some output similar to the following:
/dev/hda1 on / type ext3 (rw,noatime)
none on /proc type proc (rw)
none on /sys type sysfs (rw)
The entry you’re looking for is the one mounted on the root filesystem, /.In
this case, it is /dev/hda1 ...