1. Add the following kernel boot option to the kernel line in grub’s menu.lst and reboot ( I’m not sure which one does the trick ):
    loop.max_part=63 max_part=63
  2. Create a sparse disk image file ( 40 GB reserved, 0 bytes on disk )
    dd if=/dev/zero of=fs.image bs=1024 seek=40000000 count=0
  3. Initialize a new loop device ( /dev/loop0 )
    losetup -f fs.image
  4. Create a partition table, for example 2 partitions. A 4 GB swap(loop0p1) and a root filesystem(loop0p2) containing the remaining space.
    fdisk /dev/loop0
  5. Reread partition table for /dev/loop0. Nodes /dev/loop0p1, /dev/loop0p2, etc are created.
    sudo blockdev --rereadpt /dev/loop0
  6. Create filesystems
    mkswap /dev/loop0p1
    mkfs.ext3 /dev/loop0p2
  7. Mount the filesystem and use debootstrap or any other method to create a file system. Don’t forget to install or copy grub to it.
    mkdir fs
    sudo mount /dev/loop0p2 fs
  8. Install grub

    grub
    grub> device (hd0) /dev/loop0
    grub> root (hd0,1)
    grub> setup (hd0)

Comments are closed.