The USB Recovery in detail

So the USB “nuke my webbook” restore process is quite handy but it is always nice to know how things work so here goes. . .

The USB stick is FAT formatted and has the syslinux bootloader on the master boot record, on the filesystem are the following files

ldlinux.sys something to do with the syslinux bootloader

isolinux.bin something to do with the syslinux bootloader

kernel this is the linux kernel that the bootloader starts

initrd.gz this is the initial ram disk, the filesystem that contains all the partimage programs and everything the kernel needs to run

syslinux.cfg the configuration file for the bootloader with some important parameters that get passed through to partimage

there is a folder containing the full backed up image of the webbook

bios this contains backed up bios settings, I am not sure this actually works or does anything useful. In theory it might be possible to reset the boot sequence back to boot from the hard drive.

hda this contains the very first bit of the drive, the master boot record and partition table

hda1.first_sectors this contains the start of partition 1

hda2.first_sectors partition 2 just exists to contain the extended partition

hda5.first_sectors partition 5 is the swap partition, we only need to recover the first sectors with the partition information, the contents don’t matter.

hda1.000 this is the biggie a Gzipped partition image of the contents of partition 1.

Making a restore

To turn the Intrepid USB stick into a backup of whatever is on your webbook you need to edit the syslinux.cfg

DEFAULT rescue
LABEL rescue
KERNEL kernel
APPEND vga=normal devfs=nomount pxe ramdisk_size=33000 load_ramdisk=1 init=/linuxrc prompt_ramdisk=0 initrd=initrd.gz root=/dev/ram0 rw noapic lba After_Completion=Shutdown Replace_BIOS=N AUTO=Y Server=/dev/sda1 Directory=/ Image_To_Restore=intrepid1

Edit the APPEND line so it reads:

APPEND vga=normal devfs=nomount pxe ramdisk_size=33000 load_ramdisk=1 init=/linuxrc prompt_ramdisk=0 initrd=initrd.gz root=/dev/ram0 rw noapic lba

and you can delete the folder with the webbook image in it. If you boot from the USB stick you will now be able to go to a root shell or do a backup (or restore) from the partimage menus. There is an extra irritating little detail which took me days to figure out, when you back up an image this way it splits it into two files, the restores then don’t work (most of the time). I do the backup from the menus then delete the hda1.000 and hda1.001 files then go to the shell and run partimage from the command line which lets me back up the partition to a single unsplit file. (I will do some screenshots of that at some stage).

There are pros and cons to this method, it might be better to have a separate /home partition and have an option on startup to leave the home alone. The advantage is that it is a hands off rebuild that anyone can use, including the factory.

5 Responses to “The USB Recovery in detail”

  1. Matt says:

    Most important bit of that being that the factory can use it!
    Tell me, does the image still contain setup_wb.sh, or did you delete that…

  2. Alan Bell says:

    I didn’t use a script to set it up, I did it all manually. The point of the script was to reduce the typing hence error potential at the factory so they could reproduce the configuration we built at this end before we had all the partition cloning thing sussed. This particular image isn’t going to the factory just yet.

  3. Peter says:

    Just a note for anyone that has upgraded their machine – this sets up the partition table to be the same as the source disk, so if you have a larger HDD it will leave slack space at the end of the drive. It also creates a fixed size swap partition rather than basing in on the RAM size of the machine in the way the installer does.

  4. Alan Bell says:

    yes, that is very true. One thing I would like to work on for the future is having a small 10GB operating system partition (or set of partitions and having the rest as the /home partition which would be 70GB or whatever you have upgraded to.). There is endless debate on the appropriate size of the swap partition, I think it matters less than it used to do.

  5. john voisey says:

    I made a comment in the “server down” blog entry earlier but I now realise my problem may be better expressed here.

    I have just acquired one of the usb wrist-strap drives hoping to use it to reset my webbook after the hard drive decided it was uncleanly dismounted, tried to fix itself, and then cheerfully erased itself days after I bought it six months ago.

    The stick has a directory named intrepidibex so I guess this is the new release. Has anyone had problems with this (or for that matter has anyone had any success !!!!!)

    You see, when I follow the instructions – to the letter – that came with it, things start copying, but grind to a halt when I get about 12% of the way into restoring the 3GB of /dev/hda1.

    The install screen shows a royal blue square cursor appearing below the grey/blue dialog box, then it stops the copying process, goes black, starts a reboot, and comes up with grub error 2. Which is hardly surprising since the restore process is supposed to take 20 minutes and this happens after about four ….

    The drive itself appears to be fine – it certainly happily took and ran arch linux (!) and the installation process for that did not report any drive sector issues or similar.

    I’m not familiar with the software used on this stick to effect a restoration and I don’t know if there is any sort of log file created anywhere.

    Any ideas on a way forward would be MOST welcome (!!!!)

Leave a Reply