[ale] Two questions

Brian Pitts brian at polibyte.com
Wed Mar 5 14:12:31 EST 2008


Atlanta Geek wrote:
> We are trying to take an image of a Linux server that we will clone
> over and over again on our appliances.  anyone have any suggestions.
> Also has anyone worked with Avnet before. They suggested I use ghost
> 11 to clone machines but I see conflicting stories on the internet on
> how well ghost supports linux file systems.

If you need an integrated system, look at SystemImager [0], but it's not 
complicated to roll your own.

If the appliance will always have the exact same disk, you can clone at 
the device level with

dd if="$DEVICE" | gzip -c > "$IMAGE"

and restore with

gzip -dc "$IMAGE" | dd of="$DEVICE"

If the appliance disks might vary in geometry, you'll need to clone at 
the filesystem level. Partimage [1] is a great tool for doing this. You 
might clone with

partimage -z 1 -M -b save "$DEVICE" "$IMAGE"

The restore becomes more complicated since you have to set up swap and 
and install grub. You might do something like

parted $DEVICE mklabel msdos
parted $DEVICE mkpart primary linux-swap 0GB 0.5GB
mkswap $SWAPPART
parted $DEVICE mkpart primary ext2 0.5GB 100%
partimage -b restore $LINUXPART "$IMAGE"
e2fsck -f -p $LINUXPART
resize2fs -p $LINUXPART
mount $LINUXPART "$MOUNTPOINT"
grub-install "--root-directory=$MOUNTPOINT" $DEVICE

How to boot the appliance in an environment where it can run these tools 
and access the image file? It depends. One idea is to store a small live 
system like Parted Magic [2] and the image on a bootable DVD. Another is 
to PXE boot and mount an NFS share with the image.

If you need to image many appliances at once, look into udpcast [3]. For 
example, using udpcast to do a multicast restore of an image made with 
dd and gzip: on the server

udp-sender -f $IMAGE

and on the clients

udp-receiver --pipe "gzip -dc" -f $DEVICE

I hope that gives you some ideas.

-Brian

[0] http://wiki.systemimager.org/index.php/Main_Page
[1] http://www.partimage.org/
[2] http://partedmagic.com/wiki/PartedMagic.php
[3] http://www.udpcast.linux.lu/


More information about the Ale mailing list