LFS LiveUSB from LFS Livecd - Tips4ever

Latest

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

Jul 11, 2010

LFS LiveUSB from LFS Livecd

Here are the steps (tested with version x86-6.3-r2160 of LFS)
  1. Boot from an existing Linux distro
  2. Download the LFS LiveCD iso from http://www.linuxfromscratch.org/livecd/download.html
  3. Insert your flash disk but don't mount it
  4. Partition your usb disk (ERASING ALL DATA) with the command echo ",,b,*" | sfdisk /dev/sdX

    1. sdX should be replaced with the block device name of your usb drive
    2. Use the command dmesg if you need help finding it
  5. Ignore the "If you created or changed a DOS..." message
  6. Format the newly partitioned disk with mkfs.vfat /dev/sdX1
  7. Create a folder for mounting the new disk with mkdir /mnt/lfs-usb
  8. Mount the new partition with mount /dev/sdX1 /mnt/lfs-usb
  9. Create a directory to mount the LFS LiveCD iso with the command mkdir /mnt/iso
  10. 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
  11. mkdir /mnt/lfs-usb/boot
  12. cp /mnt/iso/boot/isolinux/linux /mnt/lfs-usb/boot
  13. cp /mnt/iso/boot/isolinux/initramfs_data.cpio.gz /mnt/lfs-usb/boot
  14. umount /mnt/iso
  15. cp lfslivecd-x86-6.3-r2160.iso /mnt/lfs-usb/lfslivecd.iso

    1. Change lfslivecd-x86-6.3-r2160.iso to match the iso file you downloaded
  16. echo "lfslivecd-x86-6.3-r2160" > /mnt/lfs-usb/VERSION

    1. This is just to record what version you have
    2. Change lfslivecd-x86-6.3-r2160 to match the name of the iso
  17. mkdir /mnt/lfs-usb/boot/grub
  18. cp /boot/grub/{stage1,stage2,fat_stage1_5} /mnt/lfs-usb/boot/grub
  19. Create a file named /mnt/lfs-usb/boot/grub/menu.lst with the following content
    default 0

    title LFS USB
    root (hd0,0)
    kernel /boot/linux root=iso:/dev/disk/by-uuid/48F4-6515:/lfslivecd.iso rootfstype=vfat rootdelay=20
    initrd /boot/initramfs_data.cpio.gz


    1. You must change the UUID (48F4-6515 above) to match your disk UUID
    2. Use the command blkid to determine the UUID
  20. Unmount your usb key with umount /mnt/lfs-usb
  21. Start grub with the command grub
  22. Determine your grub device mapping name for your usb key with the grub command find /lfslivecd.iso
  23. Enter the grub command root (hdX,Y)
  24. You should get a response "Filesystem type is fat, partition type 0xb
  25. Enter the grub command setup (hdX)

    1. Note that you do NOT include the Y partition number
  26. Enter the grub command quit
  27. You are done. Try booting from the key now
More reference:
http://www.linuxfromscratch.org/hints
/downloads/files/lfscd-remastering-howto.txt

http://www.linuxfromscratch.org/
pipermail/lfs-support/2010-April/038468.html

http://www.rodneybeede.com/
Booting_the_Linux_From_Scratch_LiveCD
_from_a_usb_key_drive.html