forgotten1 Guru
Joined: 11 Jan 2005 Posts: 477 Location: East Coast, USA
|
Posted: Mon Jul 10, 2006 4:18 pm Post subject: TIP: Multiple Partition LiveUSB |
|
|
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.
- Download, verify, and copy the iso to your flash or spindrive.
- Create a directory in your home directory.
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/ |
Make sure you've emerged dosfstools and syslinux.
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.
Delete the test partitions.
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 |
Create the filesystems
Code: | mkdosfs -F 32 /dev/sda1
mkdosfs -F 32 /dev/sda2 |
Install master boot record
Code: | dd if=/usr/lib/syslinux/mbr.bin of=/dev/sda |
Mount the iso image.
Code: | mount -o loop,ro -t iso9660 install-x86-2006.iso /root/iso/ |
Mount the LiveUSB partition. BE SURE TO USE THE DESIRED ONE
Code: | mount -t vfat /dev/sda2 /mnt/usb/ |
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/ |
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 |
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 |
|