Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
TIP: Multiple Partition LiveUSB
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
forgotten1
Guru
Guru


Joined: 11 Jan 2005
Posts: 477
Location: East Coast, USA

PostPosted: Mon Jul 10, 2006 4:18 pm    Post subject: TIP: Multiple Partition LiveUSB Reply with quote

TIP: Multiple Partition LiveUSB

This TIP is based on the Gentoo Linux LiveUSB HOWTO

Changelog wrote:
20060913 - Forgot to add step in fdisk to set partition to boot


Purpose: If you want to create a LiveUSB with 2 (or more) partitions, and you would like to have a partition that is usable for both linux and windows, then this TIP will describe how. An annoyance with windows, is that it only 'sees' the first partition of a drive. So if you create two partitions on a flashdrive, spindrive, etc., and then create the LiveUSB on the first partition, that is all windows will see. It will not see the second partition, which is the one you (at least I do) want windows to see. So I want the LiveUSB in the second partition, and all my scripts/distfiles used for installs in the first partition giving windows access also.

(Why is this desirable to me? I perform networkless installs, and use a windows machine to download all necessary files.)

Example: This example uses a 5GB Seagate spindrive. But you can use whatever size and type of device you wish. It also assumes you are only interested in the current minimal install iso, which is less than 64MB.

  1. Download, verify, and copy the iso to your flash or spindrive.

  2. Create a directory in your home directory.
    Code:
    mkdir /root/iso

  3. Plug in and mount the spindrive, and move the iso to it. Modify the device name as necessary.
    Code:
    mkdir /mnt/usb
    mount -t vfat /dev/sda1 /mnt/usb
    mv /mnt/usb/*iso /root/iso/

  4. Make sure you've emerged dosfstools and syslinux.

  5. Make test partitions for proper sizing.
    Code:
    fdisk /dev/sda
    n
    p
    1
    <hit enter for first cylinder>
    +64M
    n
    p
    2
    <hit enter for first cylinder>
    <hit enter for last cylinder>
    p

    Using my spindrive, I note that cylinders 1 -14 are used for the 64M partition to be used for the LiveUSB, and that there are 1022 total cylinders. So for the actual partition scheme, i want the first partition to use cylinders 1 through 1008, and the second partition to use cylinders 1009 through 1022.

  6. Delete the test partitions.

  7. Create actual partitions.
    Code:
    fdisk /dev/sda
    n
    p
    1
    <hit enter for first cylinder>
    +1008M
    n
    p
    2
    <hit enter for first cylinder>
    <hit enter for last cylinder>
    a
    2
    w

  8. Create the filesystems
    Code:
    mkdosfs -F 32 /dev/sda1
    mkdosfs -F 32 /dev/sda2

  9. Install master boot record
    Code:
    dd if=/usr/lib/syslinux/mbr.bin of=/dev/sda

  10. Mount the iso image.
    Code:
    mount -o loop,ro -t iso9660 install-x86-2006.iso /root/iso/

  11. Mount the LiveUSB partition. BE SURE TO USE THE DESIRED ONE
    Code:
    mount -t vfat /dev/sda2 /mnt/usb/

  12. Copy the files over the the LiveUSB partition.
    Code:
    cp -r /root/iso/* /mnt/usb/
    mv /mnt/usb/isolinux/* /mnt/usb/
    mv /mnt/usb/isolinux.cfg /mnt/usb/syslinux.cfg
    rm -rf /mnt/usb/isolinux
    mv /mnt/usb/memtest86 /mnt/usb/memtest
    cd /
    umount /root/iso/

  13. Adjust the bootloader configuration. Feel free to be creative here, if you're a little nervous, just use the default code shown in the original HOWTO (see the link above). This is what I use for my configuration.
    Code:
    sed -i \
      -e "s:dokeymap::" \
      -e "s:cdroot:cdroot dobladecenter acpi=on nodhcp nodmraid nofirewire nosata:" \
      -e "s:kernel memtest86:kernel memtest:" \
      /mnt/usb/syslinux.cfg

  14. Install bootloader. IT IS KEY THAT YOU USE THE CORRECT PARTITION.
    Code:
    umount /mnt/usb
    syslinux /dev/sda2


That's it. Now you'll have separation between the LiveUSB and all your files, plus windows will have access to the partition for necessary file transfer!
_________________
Return the Favor | Problem fixed? Add [Solved] to your title | Google the Forums
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum