Grabbed some commands from this article.
It will install debian on swap partition.
Disable swap
swapoff -a
Change id for the swap partition to 83 with t command
fdisk /dev/sda
Create fs on swap partition
mke2fs -j /dev/sdaX
Mount partition and run debian bootstrap
export LFS=/mnt/lfs mkdir -p $LFS mount /dev/sdaX $LFS /usr/sbin/debootstrap --arch i386 lenny $LFS http://http.us.debian.org/debian
Copy required files from the host OS
cp /etc/resolv.conf $LFS/etc/resolv.conf cp /etc/hosts $LFS/etc/hosts cp /etc/hostname $LFS/etc/hostname
Update fstab, login in a chroot environment.
chroot $LFS /usr/bin/env -i HOME=/root \
TERM=$TERM PS1='\u:\w\$ ' PATH=/bin:/usr/bin:/sbin:/usr/sbin \
/bin/bash --login
Edit /etc/fstab with nano and add below content
# filesystem mount-point fs-type options dump fsck-order /dev/sdaX / auto defaults 0 1 proc /proc proc defaults 0 0
Mount proc in chroot
mount -t proc proc /proc
Set hostname
hostname srv.example.com
Install aother packages
apt-get update apt-get install console-data locales mc rootstrap
Configure network
nano /etc/network/interfaces
Install kernel
apt-cache search linux-image mount --bind /boot $LFS/boot apt-get install linux-image-2.6.24-1-686
Install discover for hardware detection
apt-get install discover
Umount and reboot
umount $LFS/proc umount $LFS shutdown -r now
You should have the debian OS installed after reboot. You can now manage other bigger disks and adapt installation.