Install LFS livecd to harddisk - Tips4ever


Hi this is Mahesh, Tips4ever is my IT Journey to technology, computers, software, Internet and much more....

Aug 25, 2010

Install LFS livecd to harddisk

  1. Boot from an existing Linux distro or any live-cd
  2. Download the LFS LiveCD iso from
  3. Use exist Partition or make a  new Partition of your harddisk (ERASING ALL DATA) with the command echo ",,b,*" | sfdisk /dev/sdX  or we will know tool

    1. sdX should be replaced with the block device name of your harddisk (sda1 or hda1)
  4. Format the newly partitioned disk with mkfs.ext2 /dev/sdX1
  5. Create a folder for mounting the new disk with mkdir /mnt/lfs-hd
  6. Mount the new partition with mount /dev/sdX1 /mnt/lfs-hd
  7. Create a directory to mount the LFS LiveCD iso with the command mkdir /mnt/iso
  8. Mount the iso with the command mount -o ro,loop lfslivecd-x86-6.3-r2160.iso /mnt/iso

    1. Change lfslivecd-x86-6.3-r2160.iso to match the iso file you downloaded
  9. mkdir /mnt/lfs-hd/boot
  10. cp /mnt/iso/boot/isolinux/linux /mnt/lfs-hd/boot
  11. cp /mnt/iso/boot/isolinux/initramfs_data.cpio.gz /mnt/lfs-hd/boot
  12. Create a folder for mounting the root.ext2 ( It is compressed ext2 filesystem it will uncompressed to RAM and run as live lfs-cd ) with mkdir /mnt/rootfs
  13. Mount root.ext2 to /mnt/rootfs

    1. mount /mnt/iso/root.ext2 /mnt/rootfs -o loop 
  14.  Copy /mnt/rootfs file and folders to /mnt/lfs-hd
    1. cp -Rvf /mnt/rootfs/* /mnt/lfs-hd
  15. Use exist Linux grub bootloader file form step 17 or Create folder for bootloder
    1. mkdir /mnt/lfs-hd/boot/grub
  16. Copy  stage1,stage2,fat_stage1_5 /mnt/lfs-hd/boot/grub
    1.  cp /boot/grub/{stage1,stage2,fat_stage1_5} /mnt/lfs-hd/boot/grub
  17. Create a file named /mnt/lfs-hd/boot/grub/menu.lst with the following content
    default 0

    title LFS HD
    root (hdX,Y)
    kernel /boot/linux root=/dev/sdaX
    initrd /boot/initramfs_data.cpio.gz

    title Windows
    rootnoverify (hd0,0)
    chainloader +1

    1. Replace sdaX with your lfs harddisk some PC have hdaX (x is partition number).
  18. Unmount your harddisk with umount /mnt/sdaX
  19. Start grub with the command grub
  20. Enter the grub command root (hdX,Y) it is root hard disk for the 
  21. Enter the grub command setup (hdX).

    1. Note that you do NOT include the Y partition number
  22. Enter the grub command quit
  23. You are done. Try booting from the key now