This manual was tested on Debian Lenny.
Install helper scripts
sudo -s
apt-get update
apt-get install live-helper
Create live system environment
mkdir -p ~/liveusb/
cd ~/liveusb/
lh_config -b usb-hdd \
--hostname rescue \
--packages "python console-setup console-cyrillic libstdc++6 libntfs10 e2fslibs libparted1.8-10" \
--username root \
--bootappend-live "locale=ru_RU.UTF-8 keyb=ru quickreboot" \
--syslinux-timeout 5
Cyrillic and python are just my own requirements and you can drop it if you want.
Now we will put partimage-ng binary to the-soon-to-be-build liveUSB image :)
mkdir -p ~/liveusb/config/chroot_local-includes/usr/sbin
cp ~/partimage-ng ~/liveusb/config/chroot_local-includes/usr/sbin
chmod 755 ~/liveusb/config/chroot_local-includes/usr/sbin/partimage-ng
I also turn off dhcp-client when live system boots
cp ~/01-disable_service.sh ~/liveusb/config/chroot_local-hooks
chmod 755 ~/liveusb/config/chroot_local-hooks/01-disable_service.sh
Contents of 01-disable_service.sh
#!/bin/sh
/bin/echo "I: disable networking"
/usr/sbin/update-rc.d -f networking remove
Let's build the LiveUSB image now. This will take time, so be patient :)
cd ~/liveusb/
lh_build
If everything goes well we will have binary.img file, which should be copied to usb-flash with dd like this
cd ~/liveusb/
dd if=binary.img of=/dev/sdb
Now you have a bootable liveUSB Debian with partimage-ng onboard :)
Hope this will help :)