TIP Imaging with UDPcast
From Gentoo Linux Wiki
| G4U • G4L • yagi • UDPcast • LiveCD |
Contents |
[edit] Intro
I have some Dell GX280s at work which have no PS/2 mice or keyboards. Not even Norton Ghost supports them, but thanks to my local LUG, VAGUE I heard about udpcast and it works great. This will tell how to use pxegrub and udpcast to do unattended installs of cloned images.
This document instructs you in how to:
- Take Inventory
- Set up tftpd
- Create syslinux boot menu
- Use Cast-O-Matic
- Image machines unattended
- Remotely customize machines
However, for most people, the documentation found on http://udpcast.linux.lu/ is sufficient.
[edit] QuickStart
For an attended cloning with udpcast before you jump into the unattented guide, here's a very quick example of what one might do.
Instead of manually running the commands you could go to http://udpcast.linux.lu/cast-o-matic/ and create a boot disk that will work with both your client and server systems.
[edit] Server
Once you prepare a machine for imaging - and don't forget to defrag using Perfect Disk and run `nullfile.exe` or `dd if=/dev/zero of=/${YOUR_FILESYSTEM} bs=16M `(/ or /mnt/win9x for example) you can boot with a Linux disk which has updcast and run:
emerge udpcast udp-sender --full-duplex --pipe "gzip -c" --file /dev/hda
This will take full advantage of the network, use gzip compression, and read from the entire primary master PATA hard drive.
[edit] Client
You'll probably want one machine to keep an image stored on it, on that machine run:
emerge udpcast udp-receiver --pipe "gzip -dc" --file /var/udpcast/gx280.hda.gz
but on other machines that are to receive the image now, run:
udp-receiver --pipe "gzip -dc" --file /dev/hda
[edit] Troubleshooting
- Mixing Gigabit & Ethernet
- The problem you'll most likely run in to (aside from running out of disk space) is mixing gigabit & ethernet (or running gigabit on both sides, but between a 100BaseT router or switch). This will affect performance, as the highest attainable speed is the speed of the slowest link.
- --nokbd
- This option might segfault on older updcast versions. Upgrade.
[edit] Unattended Cloning Guide
Assumptions:
- Your network is 192.168.1.0
- You don't have an inventory system currently in place
- You want to image groups of machines, not every machine
[edit] Inventory
There is a quick and painless utility called AngryIP (available for Windows and may run under wine provided that you are root and have comctl32.dll) with which you can export a csv file to feed into a web-based database application (which I am working on, but does not yet exist) that would create all of the appropriate symbolic links and such that you will need for the rest of this.
Acquiring Inventory with AngryIP:
- Reset to defaults Utils --> Install / Uninstall --> Remove settings from registry
- Close and reopen angryip.exe
- Under Options --> Select Columns choose:
- MAC Address
- hostname
- Comp Name
- Group Name
- In the first IP Range box put 192.168.1.1 and click class C
- Click the red button that says "Start" only after reading the following warning
LEGAL NOTICE: Be VERY careful what you do with ipscan.exe. Assuming that you scan only your own network with the default set of options for MAC, IP, and HOSTNAME it should be safe to use. However, if you turn on any of the additional portscanning features or scan networks of which you are not the administrator, you could find yourself in BIG trouble. Port scanning without consent is a FEDERAL offense in the United States of America.
Exporting Inventory list:
- Sort list as appropriate
- File --> Export Selection
- Change the save type from text to csv
- Save your file as ${HOME}/ipscan.csv
- Open the file in your favorite spreadsheet application rearrange the columns in this order:
- MAC
- IP
- HOSTNAME
- (or COMP NAME, whichever is filled - varies on Windows / Linux)
- GROUP NAME
- (windows only)
- Delete all of the columns except for those which represent MAC, IP, and HOSTNAME.
- Save the file
- If your favorite spreadsheet is OpenOffice Calc, you'll need to select "Save As...", check "Edit filter settings", click save, and delete " from the text delimeter field.
[edit] dhcp
Follow the LTSP Server : DHCP guide for information on how to set up dhcp. The purpose of using DHCP is the same for both LTSP and imaging with UDPCast - boot a filesystem from the network. We'll only be changing a few parameters.
[edit] Convert Inventory to Static DHCP
If you don't have a good reason not to, now would be a great time to convert your network to static dhcp. Here are a few scripts to help with that. Considering that the first 3 sets of characters AB:01:CD:23:EF:45 in a MAC address are more or less unique for a particular model of machine, the list will be quasi sorted for you, but you'll need to actually group them on your own. Formats your current inventory information:
sort ~/ipscan.csv | while read NODE; do
MAC_I=`echo $NODE | cut -d',' -f1`;
IP_I=`echo $NODE | cut -d',' -f2`;
HOSTNAME_I=`echo $NODE | cut -d',' -f3`;
echo "host ${HOSTNAME_I} {
hardware ethernet `echo ${MAC_I} | sed s/-/:/g`;
fixed-address ${IP_I};
}";
done
Ignore current IP and hostname information, autoincrement starting at 192.168.1.101
sort ~/ipscan.csv | cut -d',' -f1 | while read MAC; do
let COUNT=${COUNT}+1;
if [ -e "$COUNT_IP" ];
then COUNT_IP=100;
fi;
let COUNT_IP=${COUNT_IP}+1;
echo "host ws${COUNT} {
hardware ethernet `echo $MAC | sed s/-/:/g`;
fixed-address 192.168.1.${COUNT_IP};
}";
done
[edit] Grouping Machines
You may not really NEED to group your machines, but it helps for the sake of logic
group {
# Library PCs
# range 192.168.1.101 192.168.1.130;
filename /tftpboot/pxe/pxelinux.0;
host ws101 {
hardware ethernet AB:01:CD:23:EF:45;
fixed-address 192.168.1.101
}
}
the filename is something we'll discuss in a minute
[edit] pxeboot
Follow the LTSP Server : tftpboot guide for information on how to set up dhcp. The purpose of using DHCP is the same for both LTSP and imaging with UDPCast - boot a filesystem from the network. We'll only be changing a few parameters.
I don't have this script right now... I'll finish creating it later, just consider a format like this:
- group files link to default file
- mac files link to group file
- relink group files and mac files to special files as needed
export PXECFG_PATH="/tftpboot/pxe/pxelinux.cfg/"
sort ~/ipscan.csv | while read NODE;
do MAC_I=`echo $NODE | cut -d',' -f1`;
rm ${PXECFG_PATH}/`echo 01-${MAC_I} | tr '[A-Z]' '[a-z]'`
ln -s ${PXECFG_PATH}/default ${PXECFG_PATH}/`echo 01-${MAC_I} | tr '[A-Z]' '[a-z]'`;
done
# Note that the additional 01- needs to be there
ln -s /tftpboot/pxe/pxelinux.cfg/default /tftpboot/pxe/pxelinux.cfg/`echo ${GROUP_I} | tr '[A-Z]' '[a-z]'`
rm /tftpboot/pxe/pxelinux.cfg/`echo ${MAC_I} | tr '[A-Z]' '[a-z]'`
ln -s /tftpboot/pxe/pxelinux.cfg/${GROUP_I} /tftpboot/pxe/pxelinux.cfg/`echo 01-${MAC_I} | tr '[A-Z]' '[a-z]'`
[edit] syslinux
For machines that support PXE. You may need to configure this in your BIOS. As a default we want machines to boot to their regular operating system, but have imaging as an option. We can easily change the imaging option to be the default option and then set a windows (or linux) net rpc script to force a shutdown on friday evening and then reset it monday morning.
/tftpboot/pxe/pxelinux.cfg/01-${MAC}
timeout 50 default local display default.msg prompt 1 F1 default.msg F2 kernels.msg F3 help.msg label local # Boot local system default localboot 0 # localboot 0x80 # hard drive # localboot 0x00 # floppy label udpcast-receiver kernel linux-udpcast append load_ramdisk=1 initrd=initrd-udpcast.sata.gz.receiver root=/dev/ram0 ipappend 1 label udpcast-sender kernel linux-udpcast append load_ramdisk=1 initrd=initrd-udpcast.sata.gz.receiver root=/dev/ram0 ipappend 1 label ltsp kernel bzImage-2.6.9-ltsp-3 append init=/linuxrc rw root=/dev/ram0 initrd=initrd-2.6.9-ltsp-3.gz NIC=tg3
/tftpboot/pxe/default.msg
Booting [local] operating system in 5 seconds. Press: F2 for more options. F3 for help.
/tftpboot/pxe/kernels.msg
local : boot local devices udpcast-receiver : recieve a new image (for malfunctioning PCs. Before using this option dial ext 123 for an IT assist) udpcast-receiver : send this image (for healthy PCs. Before using this option dial ext 123 for an IT assist) ltsp : boot thin-client linux
[edit] nbgrub
For machines that don't support PXE
[edit] udpcast
- get udpcast commandline tool
- get udpcast image
You can emerge udpcast to get the command-line tools udp-receiver and udp-sender. These are usefull when you want to permanently store an image on a server. In my case, I had some trouble getting the process to run fully automatically without keyboard input so i restorted to making it a two-step process (usb keyboards = can't "Press any key to begin"). But you may be able to use the --nokbd directive to get into keyboardless mode.
For example, say that you have already booted up a machine with udp-${DIRECTION} using gzip and /dev/sda:
- You could run udp-receiver --file /var/ftp/dell_gx-280.gz to save it (and make it accessible to g4u via ftp)
- You could run udp-sender --file /var/ftp/dell_gx-280.gz to save it (and make it accessible to g4u via ftp)
http://clic.mandrakesoft.com/documentation/pxe/ch06.html
[edit] Creating the image
Visit http://udpcast.linux.lu/cast-o-matic/ and start by
- Select pxeboot
- selecting the drivers you think you'll need. I don't think there's any harm in selecting all of them (to be on the safe side), but the most common ones are as follows:
You can find out, of course, by lspci and performing a short google. emerge pciutils if you don't have lspci.
NET:
10/100:
- e100
- 3c59x
- 8139too
- eepro100
1000:
- tg3
- e1000
Wireless: (quite a bit trickier to figure out) atmel oronico prism54
SATA: sata_piix sata_nv sata_sil sata_promise
- Go to the second page
- Select every "YES" option
- Check every box (even if you leave it blank!!!)
- Select "automatic" wherever possible
- Make sure the port box says 9000
- Put in the name of the disk to be copied
- /dev/sda on SATA machines
- /dev/hda on PATA machines
- I recommend gz compression for greater compatibility
- g4l, g4u, etc
- commandline options:
- receiver: --nokbd
- don't accept user input client-side
- sender: --full-duplex --min-wait 60 --min-clients 10 --max-wait 300
- don't wait for user input, wait at least 60 seconds or 10 clients, but no more than 5 minutes
- --full-duplex won't work through hubs, but switches and routers are okay
- receiver: --nokbd
boot up all of the receivers first and then the sender. It seems to work better that way.
