Gentoo Logo
Gentoo Logo Side

Making clones of Sun Sparc machines via network boot

Contents:

1. Introduction

About this guide 

This is a guide to making disk clones of Sun Sparc machines using a Gentoo tftpboot image, with Udpcast. The source for these materials are with the various projects utilized. This guide is simply glueing together the very useful contributions of Udpcast and Gentoo's experimental tftpboot images. You can either use the ready-made tftpboot image, or download a modified and updated package based on the Gentoo tftpboot file generator (by Jason Wever). The tftpboot-udpcast package includes updated versions of the kernel and tools, and adds Udpcast binaries and lzop binary.

2. Utilization

How would it be used? 

Suppose you want to make a disk clone of a Sun Sparc machine, perhaps in building a cluster, or simply to have a complete backup of a Sun Sparc machine's drive. With this tool set, you could boot the Sun Sparc machine from the network ('boot net' at the prom prompt), and enter a Linux environment running completely in RAM memory. From here it is possible to use a Udpcast command, and have it send or receive the disk image. Another machine on the network, perhaps even an x86 box, can run the complimentary instance of Udpcast, and store or send the disk image as a file.

What do I need to use it? 

You need to know how to set up a network boot image for a Sun Sparc. Gentoo provides a good how-to here. Although parts of the instructions are oriented for Gentoo, I think any seasoned Linux user would be able to use the instructions to make rarpd, tftp, and friends work on Debian, Slackware, etc.

You need to know a little bit about Udpcast - both the concept of how it works, and what command line options are available. The project site for Udpcast is here.

You need a tftpboot image which includes the Linux kernel, busybox, Dhcpcd, raidtools, and e2fsprogs, and also the Udpcast programs. You can obtain a ready-made tftpboot image for network boot of a Sun sparc64, containing these disk imaging tools, by downloading this file: gentoo-sparc64-1.4_rc4-20041112.tftpboot (tftpboot-able). It includes Linux kernel 2.4.27, busybox 1.0, and Udpcast 20040531. If you need specific kernel features compiled, see below on how to make your own tftpboot image file.

The original package for generation of a tftpboot image was obtained from a Gentoo developer, Jason Wever. It can be found here. In the tftpboot-udpcast package (see below to download), the versions of kernel and software have been updated, and a couple of packages have been added that would assist the imaging of disks with Udpcast: udp-sender, udp-receiver, and lzop.

3. I've booted the tftpboot image, how do I clone the disk?

Zero unused sectors of the master drive 

To create a disk image, first fill the unused portions of the master disk with zeros. This allows it to compress much better. Here is an example:

Code listing 3.1: Zeroing unused sectors

# mount /dev/sda1 /mnt/gentoo
# dd if=/dev/zero of=/mnt/gentoo/zero.bits
# rm /mnt/gentoo/zero.bits

Note: Only zero writable file systems (reiser, ext2, ext3, etc.). Do not attempt to zero swapfile partitions and other types of partitions.

When all file system partitions have been zeroed like this, you can image either partitions, or the entire disk. The following examples assume we are cloning the whole disk.

Step 1 - make the disk image file. 

On a remote/server machine (any machine where udpcast applications can be run and where you will store the image files), run the receiver:

Code listing 3.2: Receiving the disk image on the remote/server machine

# udp-receiver --file sundiskimage.lzo

On the Sun Sparc machine to be cloned, boot the tftpboot image (boot net from the prom) and then run the sender:

Code listing 3.3: Sending the disk image from the Sun Sparc

# udp-sender --full-duplex --pipe "lzop" --file /dev/sda

Note: If you get an immediate error from udp-sender on the tftpboot'ed client, it may mean the network is not up. Try running dhcpcd

This will produce a image file on the receiver machine of the entire first SCSI disk on the Sun Sparc machine. You can adjust the command accordingly for what disk you are imaging. lzop is used to compress the image. gzip could also be used here, but I found lzop was a lot faster and only slightly larger image file size.

Step 2 - recreate the disk copy on a new machine or disk 

On the remote/server machine, run the sender:

Code listing 3.4: Sending the disk image on the remote/server machine

# udp-sender --full-duplex --file sundiskimage.lzo

On the Sun Sparc machine to be created from the disk image, run the receiver:

Code listing 3.5: Receiving the disk image on the client

# udp-receiver --pipe "lzop -d" --file /dev/sda

This will write the disk image to the entire first SCSI disk on the Sun Sparc machine.

The disk must be identical size and geometry. If working with only partitions (e.g. /dev/sda4) the partition must be the same block count as on the original partition that was imaged. If the same geometry is not possible, but is close (.e.g., both are different models of 18GB disks) , ensure that the master disk image leaves a few blocks unpartitioned at the end of the disk to improve the chance of partition size compatibility across disk makes and models.

4. What is the difference between this, and the vanilla Gentoo Sun Sparc tftpboot package?

How this package is unique 

The original make script has been updated and enhanced, so that it downloads source and compiles the lzop compression utility and Udpcast. The primary focus of the Gentoo tftpboot environment was for installing Gentoo. In the tftpboot-udpcast project, the focus has been to create a network boot environment that can be used for cloning disks and disk partitions. If you are curious how the tftpboot-udpcast building script differs from the Gentoo script, look at the updated make_tftpboot.sh script

5. How do I build my own tftpboot image?

Generating a tftpboot image on a Sun Sparc 

The full tftpboot-udpcast package is available for building your own tftpboot images. It works very much like the original from Gentoo, adding the packages for lzop (and it's required lzo library), and udpcast prior to building the tftpboot image. Download tftpboot-udpcast.tar.gz

To use the package, extract it, and run

Code listing 5.1: Generating tftpboot image

# sh make_tftpboot.sh

See the folder configs/kernel for the kernel configuration.

Note: This has been tested on sparc64 only - if you have another platform or you need other kernel options enabled, you may need to tweak the kernel configuration.

Questions or comments? Ask me.

This document maintained by Donald Teed.


The contents of this document are licensed under the Creative Commons - Attribution / Share Alike license.
line
Updated Nov 17, 2004
line
Donald Teed
Researcher, Author

line
Summary:  This guide will help you create disk images of Sun Sparc machines from a network boot
line
Copyright 2004.