LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 03-12-2005, 01:43 PM   #1
Xswitch
Member
 
Registered: Jul 2003
Distribution: Ubuntu, Debian
Posts: 139

Rep: Reputation: 15
help me do pxe...


Goal: To boot my machines via the network and push already created Ghost
images(*.gho) to multiple(multicast) Windows clients on my network.


dhcp server working fine passing out ip addresses.

Installed the following:
tftpd-hpa (server)
tftp-hpa (client) Probably didn't need, but installed anyway.
syslinux bootloader
pxe (Not sure if I should have installed this)

Used this site for some help: http://www.debianplanet.com/node.php?id=818

The above site states:
Get the following files (bf2.4 kernel-version) from a debian mirror:
debian/dists/woody/main/disks-i386/current/bf2.4/linux.bin
debian/dists/woody/main/disks-i386/current/images-1.44/bf2.4/root.bin
(different paths!!)

I'm running sarge on a laptop with a 2.4 kernel. Was unsure about how to
obtain these files. Should this go in my sources.list file?

When I installed tftpd-hpa, it created /var/lib/tftpboot. The above 2
files are supposed to go in /var/lib/tftpboot per the instructions. Need
to know how to obtain the proper files.

I copied the file pxelinux.0 from the /usr/lib/syslinux directory to the
/var/lib/tftpboot directory.

Created a directory named pxelinux.cfg in the directory tftpboot.

I created in the pxelinux.cfg directory a file named: default and inserted
the following:

PROMPT 1
LABEL pxe
KERNEL linux.bin
APPEND initrd=root.bin flavor=bf2.4
IPAPPEND 1

This is where I stopped:

I'll be imaging Windows clients. How should this default file be edited?

Here are my ?'s:

1. I know that my dhcp server is working, but how do I know if my tftp
server is working?

2. In what directory do the ghost images that I have created go in,
/var/lib/tftpboot?

3. Since I'll be imaging Window's PC's, do I need linux.bin and root.bin?
(The Instructions on the above site is designed for installing "Woody" using pxe, but should work similar for Windows clients. right?)

4. Once the machines are booted, the tftp server should then send my image
to every machine that was given an IP address, correct?

Somebody please show me the way.....
 
Old 03-13-2005, 08:36 AM   #2
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 61
Having a pxe nic on each client sounds kind of expensive. Also, if I remember correctly, every ghost image to a client is supposed to be paid for.
Would you be interested in using partimage instead of ghost?
 
Old 03-13-2005, 08:43 AM   #3
sigsegv
Senior Member
 
Registered: Nov 2004
Location: Third rock from the Sun
Distribution: NetBSD-2, FreeBSD-5.4, OpenBSD-3.[67], RHEL[34], OSX 10.4.1
Posts: 1,197

Rep: Reputation: 47
You're going about this all wrong. Wouldn't it be easier to just have a ghostcast server? It's designed to work that way ...

The Windows admins where I work have been trying to figure out how to image windows servers unattended without having to use RIS, but have thusfar come up short.

The setup you are working on is dandy for installing (or even running diskless) linux machines, but Windows doesn't work that way...
 
Old 03-13-2005, 05:38 PM   #4
Xswitch
Member
 
Registered: Jul 2003
Distribution: Ubuntu, Debian
Posts: 139

Original Poster
Rep: Reputation: 15
The NIC's all have pxe capability. Partimage sounds great.

1. Can I convert my *.gho images to partimage, or do I have to reimage using partimage from scratch. I don't have to use ghost. In fact I would love to learn how to use the utilities provided by the open source community. We are slowly making the switch from Microsoft based solutions to Open Source.

I need to image lots of PC's (Multicast) just like ghost does. I have a laptop that I want to put these images on. The laptop will be a pxe server that will push the images to the the Windows clients via their NIC cards.

1. I already have a dhcp server working great on the laptop.

2. I pretty much need help from there on.

Here is where I could use some help:

3. Where should the images be stored on my debian laptop? What directory?

4. tftp is used to send the image to the clients, right? How exactly does this work?

All I want to do is put an image on my laptop, and then send that image to multiple Windows clients. I think I'm close because dhcp is working. I need help the rest of the way. I'll start reading up on this "partimage".

homey and sigsegv, thanks for taking the time to help me. I am greatly appreciative.
 
Old 03-13-2005, 06:10 PM   #5
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 61
I don't know how to setup ghost using tftp but I do know how to setup Partimage server and then upload / download images to client machines. Partimage is completely different than Ghost so the images are not exchangeable.

Here are my notes and two scripts, Netsave and Netrestore. The service sshd is used to upload / download the MBR file. That file includes the boot loader and partition table.
Code:
Install  partimaged  at the server

This part is for a Redhat/Fedora partimaged setup
Create the default user partimag with a password. Then run the following commands:
mkdir /mnt/images
## mount /dev/hdb1 /mnt/images -t ext3
## put an entry in the /etc/fstab: /dev/hdb1 /mnt/images ext3 defaults 0 0
chown partimag /mnt/images
chmod 755 /mnt/images
echo partimag >> /etc/partimaged/partimagedusers &&
chown partimag /etc/partimaged/partimagedusers &&
chmod 600 /etc/partimaged/partimagedusers

 This part is for partimaged setup on other distros 
Create the default user partimag with a password. Then run the following commands:
mkdir /mnt/images
## mount /dev/hdb1 /mnt/images -t ext3
## put an entry in the /etc/fstab: /dev/hdb1 /mnt/images ext3 defaults 0 0
chown partimag /mnt/images
chmod 755 /mnt/images
mkdir -p /usr/etc/partimaged
echo partimag >> /usr/etc/partimaged/partimagedusers &&
chown partimag /usr/etc/partimaged/partimagedusers &&
chmod 600 /usr/etc/partimaged/partimagedusers

The following should be the same on all distros

Start sshd for network imaging:
chkconfig --level 345 sshd on
service sshd restart

Start the server with the command: partimaged -L
At the server, put the netsave and netrestore scripts in the /mnt/images folder
In my ecample, the server has an ip address of 192.168.0.1 . If that is different on your system, the scripts will need to be edited accordingly.

Client setup: Save image
Boot up with a rescue cd and make sure you can ping the server.
At the live cd, copy the scripts over from the server...
scp 192.168.0.1:/mnt/images/netsave /mnt/images
scp 192.168.0.1:/mnt/images/netrestore /mnt/images
Save the image: ./netsave /dev/hda
When prompted, give the image a meaningful name
You will be prompted for a password so the mbrfile can scp to the server.

Client setup: Restore image
Boot up with a rescue cd and make sure you can ping the server.
At the live cd, copy the scripts over from the server...
scp 192.168.0.1:/mnt/images/netsave /mnt/images
scp 192.168.0.1:/mnt/images/netrestore /mnt/images
Restore the image: ./netrestore /dev/hda
When prompted, give the image name which you previously saved.
You will be prompted for a password so the mbrfile can scp from the server.
Here is the netsave script
Code:
#!/bin/bash
##### This saves the MBR / Partition Table
##### and all partitions using partimage
##### to a network server
##### example:  ./netsave /dev/hda

##############################################
#  Ensure that root is running the script.
#
WHOAMI=`/usr/bin/whoami`
if [ $WHOAMI != "root" ]; then
	echo
	echo "You must be root to run this!"
	echo
      exit 1
fi
##############################################

usage()
{
        echo "Usage: $0 /dev/hd#"
        exit 1;
}

test "$1" || usage

if ! [ -e $1 ]; then
    echo "$1 does not exist. Exiting."
    exit 1
fi

if [ -e $1 ]; then
clear
echo
echo "********************************************************************"
echo
echo -n "                Please select a name for the image to be saved: "
read name
if test "$name" = "";
   then exit 0;
fi

   #Save the MBR with partition table
   mbrfile=`echo -e $1 | awk -F"/" '{print $3}'`;
   dd if=$1 of=/mnt/images/"${name}${mbrfile}mbr" bs=512 count=1
   clear
   
   #send the mbrfile to the server which has sshd running
   #you will need a password
   scp /mnt/images/"${name}${mbrfile}mbr" 192.168.0.1:/mnt/images
   
   for i in `/sbin/sfdisk -l $1 | \
   grep -e "^[/dev]" | awk '{print $1}'`;
   
do
   a=`/sbin/sfdisk -s $i 2> /dev/null`
   test=$(($a + 0))
   stuff=`echo -e $i | sed -e 's/.\{8\}//'`;
   check=`sfdisk -c $1 $stuff`
   
if [ $check != 5 -a $check != 82 -a $test != 0 ];then

   part=`echo -e $i | awk -F"/" '{print $3}'`;
  #Save the partitions to a network server
  #use this method for GUI progress
  partimage save -c -b -d -z0 -f3 \
  -s 192.168.0.1 $i /mnt/images/$name$part
  
  #use this method for command line progress
  #partimage save -B=foo -c -b -d -z0 -f3 \
  #-s 192.168.0.1 $i /mnt/images/$name$part
  clear
fi  
done
echo

else
    exit 1
fi

clear
echo "The save operation is complete"
echo "The images have been saved in /mnt/images/"
echo
exit 0
####End
Here is the netrestore script
Code:
#!/bin/bash
##### This retores the MBR / Partition Table
##### and all partitions using partimage
##### from a network server
##### example:  ./netrestore /dev/hda

##############################################
#  Ensure that root is running the script.
#
WHOAMI=`/usr/bin/whoami`
if [ $WHOAMI != "root" ]; then
	echo
	echo "You must be root to run this!"
	echo
      exit 1
fi
##############################################
usage()
{
        echo "Usage: $0 /dev/hd#"
        exit 1;
}

test "$1" || usage

if ! [ -e $1 ]; then
    echo "$1 does not exist. Exiting."
    exit 1
fi

if [ -e $1 ]; then
clear
echo
echo "********************************************************************"
echo "     Caution!!!     This program will erase your hard drive"
echo
echo -n "                Do you want to proceed (Y/N)?"
read answer
if test "$answer" != "Y" -a "$answer" != "y";
then exit 0;
fi
#
clear
echo
echo "********************************************************************"
echo
echo -n "                Please select a name for the image to be restored: "
read name
if test "$name" = "";
   then exit 0;
fi
   mbrfile=`echo -e $1 | awk -F"/" '{print $3}'`;
   #Erase the old boot sector
   dd if=/dev/zero of=$1 bs=512 count=1
   
   #Get the mbrfile from the server
   scp 192.168.0.1:/mnt/images/"${name}${mbrfile}mbr" /mnt/images
   
   #Restore the MBR with partition table
   dd if=/mnt/images/"${name}${mbrfile}mbr" of=$1 bs=512 count=1
   clear
   
   for i in `/sbin/sfdisk -l $1 | \
   grep -e "^[/dev]" | awk '{print $1}'`;
   
do
   a=`/sbin/sfdisk -s $i 2> /dev/null`
   test=$(($a + 0))
   stuff=`echo -e $i | sed -e 's/.\{8\}//'`;
   check=`sfdisk -c $1 $stuff`
   
if [ $check = 82 ];then
   #setup the swap partition 
   /sbin/mkswap $i
   
elif [ $check != 5 -a $check != 82 -a $test != 0 ];then

   part=`echo -e $i | awk -F"/" '{print $3}'`;
  #Restore the partitions from the server
  #use this method for GUI progress
  partimage restore -b -f3 \
  -s 192.168.0.1 $i /mnt/images/$name$part.000
  
  #use this method for command line progress
  #partimage restore -B=foo -b -f3 \
  #-s 192.168.0.1 $i /mnt/images/$name$part.000
  clear
fi
done
echo
else
    exit 1
fi

clear
echo "The restore operation is complete"
echo "The partitions have been restored from /mnt/images/"
echo
exit 0
####End
 
Old 03-16-2005, 01:09 PM   #6
Xswitch
Member
 
Registered: Jul 2003
Distribution: Ubuntu, Debian
Posts: 139

Original Poster
Rep: Reputation: 15
thanks homey.... very nice.... I'll give this a shot... By the way, can you image multiple machines at once with this... sort of like ghost's Multicast... ?
 
Old 03-16-2005, 03:43 PM   #7
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 61
Yes, the partimaged ( server ) has a gui which shows connections to various clients. Might want to crank up the memory if you plan to do multiple connections.
 
Old 03-18-2005, 07:08 AM   #8
Xswitch
Member
 
Registered: Jul 2003
Distribution: Ubuntu, Debian
Posts: 139

Original Poster
Rep: Reputation: 15
SWEEEEEEEEET...


Say I'm doing 50 machines:

1. What amount of RAM would you suggest?
 
Old 03-18-2005, 08:48 AM   #9
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 61
Quote:
Say I'm doing 50 machines:

1. What amount of RAM would you suggest?
You got me on that one as I've never tried a lot at once. I only have 500megs of ram and haven't noticed any problems.
You might want to put the imaging setup on it's own network segment so it doesn't bog down all other machines. Also, maybe look at gigabit switch and nics if you have them.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
pxe boot "PXE-T01 file not found" ssharma_02 Linux - Networking 16 05-18-2011 03:21 PM
Unable to boot with PXE managed.service Linux - Enterprise 1 10-18-2005 11:28 AM
PXE Bootsplash and Progressbar dragoncity99 Slackware 3 03-21-2005 07:20 PM
trying linux install over pxe paha Linux - General 0 12-14-2004 07:09 AM
PXE Server t420 Linux - Software 0 03-19-2003 01:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 12:38 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration