Friday, August 24, 2012

Booting via PXE (Example)

 

Normally, a computer tech will boot a computer from a USB flash drive, or a CD/DVD-ROM when special utilities are needed. Sometimes the computer seems to block all of the normal options but still must have its data saved. It’s not always easy being a computer tech.

The other day I was given a laptop to work on. I was asked to wipe and reload it with a fresh copy of Windows. I was also told that the computer had a virus and was slow to respond. My initial scans did not reveal a virus but the computer definitely was slow. Perhaps the virus had already been cleaned by another tech but there still appeared to be damage to the operating system. Running MSCONFIG and using it to disable all start-up programs and non-Microsoft services gave it a boost which was enough to make the computer incomplete, but usable.

I needed to back up the data before wiping the computer. The hard drive was 30 gigs with 20 used. I wondered how much of that would be temporary files or files that I would not need to back up so I tried to run SpaceSniffer from my USB flash drive. ( www.uderzo.it/main_products/space_sniffer/ ) The light on the flash drive lit up then went out. It was not recognized by the system. I didn’t even get an error message about it. I tried an external USB hard drive. It spun up but was not able to be recognized either. It seemed that the USB ports were not working. I assumed that the problem was a driver within Windows because the port was still supplying power to the USB port. I was not going to be able to do a sparse file copy backup from within Windows.

I decided that I would boot off of a BartPE live CD and take a hard disk image with DriveImageXML. ( http://www.nu2.nu/pebuilder/) / ( http://www.runtime.org/driveimage-xml.htm ). The hard drive was again not recognized. I tried both USB ports…nothing. The USB ports are either bad or disabled in the BIOS. … I then checked the BIOS and there were no settings for disabling the USB ports. Sooooo…… how am I supposed to backup this data?

I know! I’ll just take the hard drive out of the laptop and hook it up to external reader. Nope, this laptop was one of those types of laptops where you have to take the whole thing apart just to get at anything. Scratch that.

So I took inventory of what works and what doesn’t work. The hard drive works, the CD-ROM drive works, the USB ports DON’T work. What options do I have left for backing up 20-som gigs of data? Burning CDs was out of the question because it would have taken at least 29 CDs. I came up with a sharp idea about repartitioning the hard drive into 2 partitions and then backing up the data from the old partition to the new partition. However, there was too much data on the drive for that to work well without moving some data off of it first. I still needed to find a way of getting that data off the hard drive safely.

I then tried file sharing within Windows but that did not work. Figuring that there was corruption within the operating system I decided that I would need ANOTHER operating system to get at the data and transfer it over the network. PartedMagic can do that and it can help with the repartitioning idea if the network file transfers turn out to be too slow.

No blank CDs. Great time to be out of blank CDs. All I would have to do is burn a PartedMagic CD, boot off of it, and do the partitioning and network file transfers. Why did I have to lend my copy to somebody AND be out of blank CDs? Okay, well, whatever. I’m a computer tech and computer techs solve problems. The solution for the future may be to have more than one copy of PartedMagic. The solution for now would be a bit more technical.

OH BOY! A CHALLENGE! So, how do you boot a computer from a device other than it’s hard drive, a flash drive, or CD? PXE, that’s the answer! Simply put, PXE (Preboot eXecution Environment) is a method of booting computers from a file given to it by another computer on the network. ( http://en.wikipedia.org/wiki/Preboot_Execution_Environment ) Most computers nowadays support PXE, although it is rarely used in home environments. I also have not met many computer techs that have used PXE.

It had been a long time since I myself had used PXE and I made some mistakes this time before I got everything right. Here are some problems I encountered before having a successful PXE boot… before actually doing it RIGHT.

These are screenshots from the settings tabs of TFTPd32. The third picture shows the correct boot file to send to the PXE-enabled computer.

Settings 1  Settings 2  Settings 3

First tried to just pass the bzImage file. Once I managed to get the PXE booting laptop to download the file I got the following error message “NBP is too big to fit into free base memory.” - http://serverfault.com/questions/247445/pxe-boot-nbp-is-too-big-to-fit-into-free-base-memory 

I then read up on PXE to see what I was doing wrong. Turns out that I needed pxelinux to be passed first and then IT would boot the bzImage file. This is like chain-loading. - http://www.syslinux.org/wiki/index.php/Download

I obtained the pxelinux.0 file from the Syslinux package. I then used an example pxelinux.cfg from the PartedMagic website. Error message this time was “Could not find ramdisk image: /pmagic/initramfs”. I mostly copy and pasted the example on the PartedMagic website into my configuration file. However, there was no file named ‘initramfs.”. I then downloaded the specific PXE version of PartedMagic. The ‘initramfs’ file was not there either. - http://partedmagic.com/doku.php?id=pxe

So, where is the file? I looked more closely inside of the PXE version of PartedMagic and found a folder called ‘boot’ which had a file called ‘sample_pxelinux.cfg’. Jackpot! This pxelinux.cfg was different than the one that I found on the Internet at the author’s website. Perhaps that was an old webpage? No matter. The new pxelinux.cfg was different. The line “INITRD pmagic/initrd.img” replaced the line “INITRD pmagic/initramfs”. Well, that makes a world of difference! There actually IS a file named '”initrd.img”. We’re in business now!

These are some pictures of the PXE boot of the laptop. Each picture shows a different try. The first shows that I set up the PXE boot on TFTPd32 wrong. The second one shows that I configured at least a portion of it correctly with the result of those incorrect settings shown on the third picture. The forth picture is what the good PXE boot looked like.

Kernel PanicLoad bzImage

Missing fileLoad initrd

 

Sending bzImage This is a picture from the TFTPd32 program. So, now I was able to boot the laptop from PXE. Crossin’ my fingers now, hoping that this works considering that seems like it’ll take an hour passing 236,673,901 bytes of data. (EDIT: It took 40 minutes.) This laptop only has 512 megabytes of RAM in it. I don’t need any more bad news, just please let this work.

Loading PartedMagic Everything worked as expected after the boot files were sent! After it booted, the system acted just like as if I had booted PartedMagic from the CD.

I attempted to setup the network connection on the laptop and connect it to a network file share.  Oddly, the laptop was getting assigned the same IP address as my laptop. Weird. Had to reset the router which provided DHCP and then release and renew the IP addresses on both laptops. I used “ipconfig /release | ipconfig /renew “ on my laptop and then “dhcpcd –k eth0” and “dhcpcd eth0” on the customer’s laptop (Parted Magic is a linux live CD) and both computers were online. I was then able to backup the files to a network share.

The rest of the story was a near typical reinstall of Windows. The files that were backed up were returned to the computer via the network again. Add another notch to the I.T. belt.

 

 

References / Links:

Configuring TFTPd32 - http://tftpd32.jounin.net/

PXELINUX - http://www.linuxfordevices.com/files/misc/pxe_boot_stb-howto.html 

PartedMagic - http://partedmagic.com/doku.php?id=downloads

No comments:

Post a Comment

Keep it clean. :)