Cloning a Linux machine

Contents:

  1. Prepare new client with minimum software
  2. Fix rdistd
  3. Distribute the operating system
  4. Adjust configuration on the new client
  5. Install boot image (alpha only)
  6. Reboot the machine

For more information visit these links:

Prepare new client with minimum software

Linux/alpha

This WNT ARC setting should be entered on all machines for default booting (set autoboot to 10 seconds).

	LOADIDENTIFIER  = Linux
	SYSTEMPARTITION = scsi(0)disk(0)rdisk(0)partition(1)
	OSLOADER        = scsi(0)disk(0)rdisk(0)partition(1)\linload.exe
	OSLOADPARTITION = scsi(0)disk(0)rdisk(0)partition(1)
	OSLOADFILENAME  = \MILO
	OSLOADOPTIONS   = boot hda2:vmlinux.gz root=/dev/hda2

With AlphaBIOS press F2 to get into Setup. Choose Utilitities -> OS Selection Setup. The items there translate as follows:

  • LOADIDENTIFIER -> Boot Name
  • OSLOADER -> Boot File
  • OSLOADFILENAME -> OS Path
  • OSLOADOPTIONS -> OS Options

The partitions are drop down menus, and should be easy enough to understand. For OS Path you should just enter \, otherwise the system will probably refuse to boot (new versions of linload.exe will search for MILO in the same location as itself, so the OS Path is actually ignored).

As a reminder I install another entry using the floppy drive with these settings differing (and of course the drive spec - you can choose Floppy from the menu).

	LOADIDENTIFIER  = Linux Floppy
	OSLOADOPTIONS   = boot fd0:vmlinux.gz root=/dev/fd0
	                  load_ramdisk=1 prompt_ramdisk=1

While the above will not boot, you can read the proper boot command conveniently from the screen after switching floppies.

Install networked RH using FTP from:

	ftp.funet.fi:/pub/Linux/mirrors/redhat/redhat/current/alpha

The partition table should be something like shown below. Use the whole disk space available. Adjust swap to match installed memory, and scale the native Linux partition to fill the disk. I use fdisk (from the installation menu) to enter these values.

	Partition  Type          ID  Start  End
	---------  ----------    --  -----  -----
	/dev/hda1  DOS 16-bit     6      1     11
	/dev/hda2  Linux native  83     12   3567
	/dev/hda3  Linux swap    82   3568   4092

Linux/i386

Linux is booted using a LInux LOader (LILO). LILO is written into the master boot record during a normal installation. It takes care of loading Linux (and other systems you might have installed). Always install Linux last on your machine.

Install networked RH using FTP from:

	ftp.funet.fi:/pub/Linux/mirrors/redhat/redhat/current/i386

The partition table should be something like shown below. Use the whole disk space available. I use fdisk (from the installation menu) to enter these values.

	Disk /dev/hda: 64 heads, 63 sectors, 825 cylinders
	Units = cylinders of 4032 * 512 bytes

	   Device Boot Begin Start   End   Blocks   Id  System
	/dev/hda1   *      1     1    33    66496+  83  Linux native
	/dev/hda2         34    34    99   133056   82  Linux swap
	/dev/hda3        100   100   165   133056   83  Linux native
	/dev/hda4        166   166   825  1330560   83  Linux native

The partitions are:

  1. root partition, 64 MB
  2. swap partition, 128 MB (adjust to match installed memory)
  3. var partition, 128 MB
  4. usr partition, adjust to fill the disk (minimum 768 MB currently)

Fix rdistd

After installation has completed you will need to create another symlink for rdistd to compensate for the hardcoded PATH in rshd.

	# cd /usr/bin
	# ln -s ../sbin/rdistd .

You will also need to create /root/.rhosts that contains the following line:

	nessus.lce.hut.fi root

Distribute the operating system

Distribute the operating system from the distribution master. Use the following commands on the master machine (calypso for Linux/alpha, nessus for Linux/i386) replacing client with the name of the client.

(Note: You will need to have proper PATH settings for this to work.)

	# sdist -s -r -h client /bin /boot /root /sbin /usr /lib
	# cd /var
	# sdist -s -r -h client catman nis yp
	# cd /var/lib
	# sdist -s -r -h client games pgp rpm texmf
	# cd /var/spool
	# sdist -s -r -h client lpd

Then distribute share configuration files by first editing /etc/distfile appropriately (usually just the name of the new machine needs to be added) and then running rdist manually (do not run sdist).

	# cd /etc
	# rdist

Adjust configuration on the new client

Edit /etc/sysconfig/network to include

	NISDOMAIN=ltl

Notify the dynamic linker about added libraries.

	# ldconfig

Check your /etc/lilo.conf, and make sure that the latest kernel image is included from /boot. You may also need to add an append entry to the linux boot options, if the machine has 128M memory. The whole entry might then look something like this:

	image=/boot/vmlinuz-2.0.32
        	label=linux
        	append="mem=128M"
        	root=/dev/hda1
        	read-only

Remember to run /sbin/lilo to install the LILO properly with current boot images, etc.

Create or restore SSH identity for the machine. To create a new identity use the following commands:

	# /usr/local/bin/ssh-keygen -b 1024 -f /etc/ssh_host_key -N ''
	# chmod a-w /etc/ssh_host_key*

Fix /etc/fstab to place mount points in /fs. On alpha machines include the DOS partition as /fs/boot (see the master machine for an example).

Install boot image (alpha only)

On alpha machines, install the correct boot image in the DOS partition.

	# cd /tmp
	# ftp ftp.funet.fi
	ftp> bin
	ftp> cd /pub/Linux/mirrors/redhat/redhat/current/alpha/milo/images
	ftp> get pc164.img
	ftp> exit
	# dd if=pc164.img of=/dev/hda1
	# rm pc164.img

Reboot the machine

To see that everything works correctly, reboot the machine and watch the boot messages carefully.

	# reboot

You should now be able to use the machine as a normal workstation.