Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm curious if anyone has accomplished the following, or knows a good terse description of how to set up the following.

I'd like to set up a Linux server that is able to clone PC's over the network, and also restore them over the network (using PXE if possible).

Is there any easy way of doing this? Any (hopefully free) software packages available for Linux to do this?

Ideally it would work regardless of the client OS - I have a few Windows boxes I'd like to clone.

Thanks.

share|improve this question

4 Answers 4

up vote 5 down vote accepted

Yes, Linux can be configured as a boot server for PXE systems, and it's not hard to imagine a USB-thumb-drive, LiveCD, or PXE environment specially configured to image a hard drive to a network target using stock (or near-stock) tools.

You can use PXElinux to configure a basic PXE server. If you have a Linux server handy, you can use that as a base. You'll need BOOTP or DHCP, TFTP, and PXE daemons on the PXE server. On Debian-based systems, you can use the pxe package to supply the PXE daemon.

Regarding client systems, if you're trying to image an OS partition, you need to boot from a different partition than you're trying to image anyway. If you don't want to bother with a full PXE server, you can boot from a Linux LiveCD or USB thumb drive to make your backup images.


Basic concepts and DIY

The basic tools of dd and netcat provide the workhorses for a basic DIY or manual system. The ideal system would add parted or sfdisk for partition detection (and creation on restore), a menu system of some kind, and maybe a server program to automate the backend.

Workflow for image creation:

  1. Boot (USB/CD/PXE)
  2. Examine partitions, select one for imaging, record size
  3. Check that backend target has room
  4. Setup send on client: dd if=/dev/sdXN | gzip -9 | nc -l 9999 (for partition /dev/sdXN)
  5. Start receive on backend: nc x.x.x.x 9999 > IMAGE_NAME.iso.gz

Workflow for image restoration:

  1. Boot (USB/CD/PXE)
  2. Examine partitions, check that one has room, create if necessary
  3. Setup send on backend: dd if=IMAGE_NAME.iso.gz | nc -l 9999
  4. Setup receive on client: nc y.y.y.y 9999 | gunzip | dd of=/dev/sdYM (to partition /dev/sdYM)

(Source for netcat examples; see "Transfering Files" and "Other Examples" sections.)


Partimage does it for you

Partimage can save images files locally or across the network. Partimage's network support includes its own partimaged server, or saving images to a Samba share or NFS drive. Be sure to read through the Partimage manual's Network Support section.

To configure a partimaged server, follow this basic procedure. The tutorial I found recommends downloading the static binary from the partimage homepage. Place it into the /var/partimaged_storage directory created in step 2.

The server is also available in the partimage-server package in Debian/Ubuntu repositories; use them if available. (They'll automate adding the daemon user and setting permissions.) On Debian-based systems, the server configuration can be modified in the /etc/default/partimaged file.

Manual partimaged configuration

  1. Create a new user for the daemon.
    useradd -c "Partimaged User" -s /sbin/nologin -r -M partimag

  2. Create a run directory where the server will run; this will also serve as the default image file storage location. You can change this on the server commandline.
    mkdir /var/partimaged_storage
    chown -R partimag:partimag /var/partimaged_storage
    chmod -R 0700 /var/partimaged_storage

  3. Change to the directory and start the server.
    cd /var/partimaged_storage ; ./partimaged --debug=1
    (uses a default port of 4025; specify --port XXXX to change.)
    (specify --dest /path/to/image/storage to change the location used for image storage.)

Save partitions across the network

  1. Boot (USB/CD/PXE)
  2. Save from client machine to the Partimaged server (no need to specify path to image file):

    partimage --server=x.x.x.x --port=4025 -z1 -o -d save /dev/sdXN IMAGE_NAME.partimg.gz
    

Restore partitions across the network

  1. Boot (USB/CD/PXE)
  2. Restore from client machine (again, no need to specify path to image file):

    partimage --server=x.x.x.x --port=4025 restore /dev/sdXN IMAGE_NAME.partimg.gz
    

(Source for manual partimaged setup and network save/restore examples.)

share|improve this answer
    
adding more details on partimage, but see the article for the full story. –  quack quixote Feb 16 '10 at 10:03

What you want is a DRBL Server. Then you can use Clonezilla to backup and restore your drive(s).

share|improve this answer

Take a look at systemimager it is an automated way for taking images from installed systems and duplicating these images using networks installed (here the same tools pxe, tftp, dhcp, rsync and a lot of scripting to keep everything together) are used. Since everything is scripted (e.g. generation of installscripts) installation procedures can easily be tuned.

share|improve this answer

We use FOG where I work. instead of explaining it I'll link you to the webpage. Hopefully you have as much luck with it as we do.

http://fogproject.org/index.php

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.