View previous topic :: View next topic |
Author |
Message |
hertog Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 28 Jun 2002 Posts: 138 Location: Enschede/The Netherlands/Europe
|
Posted: Wed Aug 27, 2003 10:19 am Post subject: Booting Linux from a USB-Pendrive |
|
|
The 'Why'
Ever been in the situation where you wanted to flash your BIOS only to find out you ran all out of (working) floppy's, or you didn't have a windows bootdisk at hand, or even worse, you didn't have a (working) floppy drive?
Been there, done that, got the T-Shirt.
The (perceived) Solution
With the falling prices of the so called usb-pendrives and computers being able to boot from media connected to the machine via USB this problem is solved. At least, that is how simple I thought it would be.
Guess again.
The 'Bears on the road'
There seem to be no 'solid' standard as to how bios-makers implement this boot from USB-feature, so this might not work entirely as described, but with the hardware I have, things work. I can now boot a Windows 98SE bootdisk, a wide range of kernels and (but that's in the future) a whole linux system, all from my USB-stick.
The Lab
My hardware is as follows:
Epox EP-8RDA+ motherboard, this one is equipped with an Award bios (so maybe all systems with Award-biosses might operate in this manner)
A 512 MB USB Pendrive, which is detected by lsusb as a Apacer (this might be overkill, but as said, I want to do a full linux install on it)
In the BIOS I have enabled the support for USB-keyboards and USB-Mice (last one is also known as extended compatibility)
Boot-drive order is (first) set to USB-HDD, it also might work when set to USB-Floppy or USB-Zip.
So far the description of hardware. On to so more dry theory
Some dry theory
To be able to boot from a pendrive the partition that you are booting from (on the pendrive) needs to be FAT16. Since the bios has no knowledge about ext[2|3]/ntfs/filesystem-du-jour it MUST be FAT16.
This is not too bad, since you can put the bootdist of (e.g.) Win98SE in there, which might come in handy when you need to flash your bios (and as an added bonus, it gives the option to load the cd-drives for MS-DOS, you never know what that might be useful for).
The 'real' solution
So, enough theory, real work.
Plugin your USB-pendrive (I skip the kernel-configuration part, there are other howto's that describe what options need to be set for the kernel, see https://forums.gentoo.org/viewtopic.php?t=53537).
It probably get's detected as /dev/sda, you can always check dmesg for that.
Code: |
scsi0 : SCSI emulation for USB Mass Storage devices
Vendor: Model: USB DISK 2.0 Rev: 1.09
Type: Direct-Access ANSI SCSI revision: 02
Attached scsi removable disk sda at scsi0, channel 0, id 0, lun 0
SCSI device sda: 1015808 512-byte hdwr sectors (520 MB)
sda: Write Protect is off
/dev/scsi/host0/bus0/target0/lun0: p1 p2 p3
WARNING: USB Mass Storage data integrity not assured
USB Mass Storage device found at 2
|
Look for this line to see what sd* name your stick got:
Code: |
Attached scsi removable disk sda at scsi0, channel 0, id 0, lun 0
|
Fire up cfdisk:
Delete any partitions on the drive
Create a new primary partition (5 MB should be enough), mark it bootable, and change it's type to FAT16 (06).
Create a second primary partition, it's type is (default) on Linux (83) that is ok. This is going to be your /boot drive, so check your current boot-partition for your size requirements.
Write all to the card/pen and quit cfdisk.
Do:
Code: |
mkfs.vfat /dev/sda1
|
(mkfs.vfat is included in dosfstools, you might have to emerge it)
and:
Code: |
mkfs.ext3 /dev/sda2
|
(or choose your favorite filesystem).
Mount /dev/sda2 (the linux partition, not the FAT32-one) to a convenient point (I use /mnt/pen for this), and mount your 'real' boot-partition
Code: |
mount /dev/sda2 /mnt/pen
mount /boot
|
Now copy the contents of your boot-partition over to the pendrive:
Code: |
cp -rpP /boot/* /mnt/pen/
|
(-r for recursive, -P for keeping permissions and -p for copy a symlink as symlink)
unmount the /boot and /mnt/pen:
Code: |
umount /mnt/pen
umount /boot
|
and mount the pendrive as /boot:
Code: |
mount /dev/sda2 /boot
|
Fire up GRUB (someone else has to come up with a Lilo description, as I don't use that)
and find out what drivenumber your pendrive got (probably the last one, in my case hd2).
In grub type:
Code: |
root (hd2,1)
setup (hd2)
|
This installs the grub-loader on the bootsector of the pendrive, and points to the linux-partition for it's grub.conf.
Edit your /boot/grub/grub.conf and include the following code:
Code: |
title Boot from floppy-drive
root (fd0)
chainloader (fd0)+1
title Boot Win98SE bootflop (from pendrive)
root (hd0,0)
chainloader (hd0,0)+1
|
Important when booting from the pendrive, it becomes the first HD for grub, so instead of (hd2,x) it should be addressed as (hd0,x)!!
Now unmount the pendrive again, put a Win98 bootfloppy in the floppy drive (if you have one, this step can be skipped, or delayed until later) and reboot the machine.
My computer sometimes needs an extra 'warm' reset (ctrl-alt-delete) to find the pendrive, I guess it just boots up too fast for the thing to initialize.
Upon booting you'll get a grub-selection screen. If you have a bootflop in the drive, choose the first one (boot from floppy), this will cause the windows bootflop to be started, and will dump you to a DOS prompt.
Here you can do a (in my case it is C:, this might be different depending if you have FAT16/32 partitions on you HD's, check carefully!). This will cause the FAT16 part of your pendrive to be made into a bootable dos partition (which can be booted by choosing the second (Boot Win98SE bootflop (from pendrive)) Grub-option in the menu. Copy the contents of the DOS disk to the C: drive:
Now go back to linux and edit your grub.conf file. I'll include my 'normal' and my 'pendrive' version here, which are both able to boot anything that is on the HD's so that you can see the (subtle) differences in them.
Normal grub.conf (in /boot/grub/)
Code: | default 0
timeout 20
title Linux 2.4.22 (pre) VESA
root (hd0,1)
kernel /boot/vmlinuz-2.4.22-rc2-ac3 root=/dev/hda3 pci=noacpi vga=791
title Linux 2.4.22 (pre)
root (hd0,1)
kernel /boot/vmlinuz-2.4.22-rc2-ac3 root=/dev/hda3 pci=noacpi
title Microsoft Windows XP Pro
root (hd0,0)
chainloader (hd0,0)+1
title Boot from floppy-drive
root (fd0)
chainloader (fd0)+1
|
Pendrive grub.conf (on /dev/sda2)
Code: | default 0
timeout 20
title Boot from floppy-drive
root (fd0)
chainloader (fd0)+1
title Boot Win98SE bootflop (from pendrive)
root (hd0,0)
chainloader (hd0,0)+1
title Linux 2.4.22 (pre) VESA
root (hd0,1)
kernel /boot/vmlinuz-2.4.22-rc2-ac3 root=/dev/hda3 pci=noacpi vga=791
title Linux 2.4.22 (pre)
root (hd0,1)
kernel /boot/vmlinuz-2.4.22-rc2-ac3 root=/dev/hda3 pci=noacpi
title Microsoft Windows XP Pro
root (hd1,0)
chainloader (hd0,0)+1
|
Good luck with booting from a USB-Memory stick!
Gert-Jan Rodenburg |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
taskara Advocate
![Advocate Advocate](/images/ranks/rank-G-1-advocate.gif)
Joined: 10 Apr 2002 Posts: 3763 Location: Australia
|
Posted: Mon Feb 02, 2004 1:40 pm Post subject: |
|
|
Hi,
thanks for your guide
I'm trying to get my usb pen drive to be /boot for my raid 0 array.
I have installed grub to the pen drive (sdc1), which is (hd2,0)
it has a 30mb bootable partition, which I mounted as /boot throughout my gentoo install
I emerged grub, and ran it with - it found etx3 partition, so then I installed to
after finishing the gentoo install and rebooting, it appears to be trying to boot from the pen drive (the light on it is flashing on an off constantly) but NOTHING happens.. not even a grub sign or error.
do you have any ideas? can you help me?
Many thanks! _________________ Kororaa install method - have Gentoo up and running quickly and easily, fully automated with an installer! |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Starkiller n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 22 Dec 2002 Posts: 4
|
Posted: Thu Feb 05, 2004 8:56 pm Post subject: |
|
|
I know from experiance that not all USB pendrives are bootable.
the two that I have , a dell braned 64mb drive, and a lexar jumpdrive something....
Anyway both are made by lexar, but only the lexar jumpdrive will boot.
I called them up and emailed them about it, and they simply said that some can some cant...(boot that is) |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
taskara Advocate
![Advocate Advocate](/images/ranks/rank-G-1-advocate.gif)
Joined: 10 Apr 2002 Posts: 3763 Location: Australia
|
Posted: Thu Feb 05, 2004 10:45 pm Post subject: |
|
|
Starkiller wrote: | I know from experiance that not all USB pendrives are bootable.
the two that I have , a dell braned 64mb drive, and a lexar jumpdrive something....
Anyway both are made by lexar, but only the lexar jumpdrive will boot.
I called them up and emailed them about it, and they simply said that some can some cant...(boot that is) |
ahh that's great to know, cheers. I'm using a transcend jetflash.. I'll try another brand.
(although I got it working on my external usb hdd anyway ) _________________ Kororaa install method - have Gentoo up and running quickly and easily, fully automated with an installer! |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
raghu1111 n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 01 Mar 2004 Posts: 1
|
Posted: Mon Mar 01, 2004 3:08 am Post subject: |
|
|
hertog,
Great explanation. I used it to get my cf card to boot.
I have one correction to grub.conf.
When we chain load XP from the first harddisk, we should 'map' hd1 to hd0 so that when XP boot loader is loaded, its hd0 points to the hard disk.
So the XP section above should be:
Code: |
title Microsoft Windows XP Pro
root (hd1,0)
map (hd0) (hd1) # This is required to make XP boot properly
chainloader +1
|
Raghu. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Gav n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 10 Oct 2002 Posts: 65 Location: Surrey, UK
|
Posted: Tue Mar 09, 2004 3:30 pm Post subject: |
|
|
I'm thinking about doing something like this...
Although rather than having a hard drive in the machine, use either the flash drive as /, or preferably mount a share on my server dedicated to this PC. Any thoughts?
I've only ever booted linux from a hard drive (and never used USB), so it'll be new teritory for me. I do have a spare 64MB Memory Stick that can be used without incurring extra costs, and a few spare hard drvives to get a working install while I try. Time isn't on my side, so I don't expect to get this up and running for a few weeks.
I could use network boot like foldings farms use, but it seems hard to do for just 1 PC. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
nevynxxx Veteran
![Veteran Veteran](/images/ranks/rank_rect_5_vet.gif)
Joined: 12 Nov 2003 Posts: 1123 Location: Manchester - UK
|
Posted: Tue Mar 09, 2004 3:46 pm Post subject: |
|
|
@Gav If I remember correctly there are some distors availible that are aimed at firewalls that are specifically diskless, if you mount from a read only floppy its a little hard for an intruder to tamper with stuff. Looking at those and knoppix should be a good place to start _________________ My Public Key
Wanted: Instructor in the art of Bowyery |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
satimis Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
Joined: 21 Oct 2003 Posts: 365
|
Posted: Sun Mar 19, 2006 3:05 pm Post subject: |
|
|
Hi folks,
I have been searching around for solution to make BIOS detect and boot a pendrive using Grub bootloader.
The story is as follow;
I tried copying the OS running on HD on a pendrive having 2 partitions. /boot was copied to /dev/sda1 running on FAT16 and the rest copied to /dev/sda2 running on ext2.
The motherboard can boot
-USB-FDD
-USB-HDD
-USB-ZIP
-SCSI
etc.
On booting the PC, the BIOS did not detect the pendrive.
I have no problem using syslinux bootloader to boot the pendrive then Linux distro running on it.
This is an experience to test whether a pendrive can be used as HD and whether Grub bootloader can used to boot a pendrive instead of syslinux.
Advice would be appreciated. TIA
B.R.
satimis |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
NeddySeagoon Administrator
![Administrator Administrator](/images/ranks/rank-admin.gif)
![](images/avatars/3946266373f47d606a2db3.jpg)
Joined: 05 Jul 2003 Posts: 54513 Location: 56N 3W
|
Posted: Sun Mar 19, 2006 3:28 pm Post subject: |
|
|
Hi guys,
This is no more than a few loose rocks in the pool.
1. The BIOS has no concept of filesystems at all. It reads raw disk blocks to locations in memory.
2. USB Pen drives come in two sorts, those that look like a floppy (with no partition table) and those that look like a HDD, with a partition table.
You may be able to swap them backwards and forwards, I only have the latter.
Much of the work here has been done before - Google flash linux Its Gentoo on a stick. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
rlittle Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
![](images/avatars/gallery/Southpark/avatar4.gif)
Joined: 17 Dec 2003 Posts: 200
|
Posted: Sun Mar 19, 2006 9:05 pm Post subject: |
|
|
I thought of the same thing after I got a 1GB USB key, and I could not figure out how to but a bootable kernel on it, so I took the "easy" way out. I partitioned the USB key (just with fdisk) into 3 pieces something like:
slice 0: 255MB of free space (later formated to FAT32 for easy of portability)
slice 1: 717MB for bootable .iso image
slice 2: 15MB for /boot partition (just like in a normal Gentoo install)
I used dd to put the iso image into slice 1, and then I installed grub into slice2 (that was a little tricky, but nothing major. Just read the man page 10 times. ) I used the Knoppix live CD, (Gentoo Live CD wasn't out yet) and here's what my grub.conf file looked like to get Knoppix to work:
Code: |
# Boot menu configuration file
#
timeout 20
default 0
title=USB bootable Knoppix
#Partition where the kernel image is located.
root (hd0,1)
kernel /boot/isolinux/linux ramdisk_size=100000 init=/etc/init lang=us vga=791 nomce quiet BOOT_IMAGE=knoppix
initrd=/boot/isolinux/minird.gz
|
Now I have a bootable USB key that will work on any modern machine, and no matter how old the machine I plug it into, they can all see slice0 with my FAT32 partition on it! (Some can't see beyond the first partition). The "tricky" part was how is your system going to enumerate your USB "drive" (hd0? hd1?). On some machines it can change depending on how many and what kind of harddrives you have. I've forgotten a lot of what I learned, but that config (above) works on every machine I've tried it on (except MY home machine, which refused to boot off of USB even though it should. ![Rolling Eyes :roll:](images/smiles/icon_rolleyes.gif) _________________ I need a better signature... |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
satimis Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
Joined: 21 Oct 2003 Posts: 365
|
Posted: Mon Mar 20, 2006 12:32 am Post subject: |
|
|
Hi rlittle,
Tks for your advice.
I'm on the same situration as yours, having a new 1G USB key bought recently. I want to make it as a HD with grub bootloader, booting on any 586 and/or above PC.
Quote: | slice 0: 255MB of free space (later formated to FAT32 for easy of portability) | What is the use of this silce, /sda1? Just leaving it empty?
Quote: | I used dd to put the iso image into slice 1, | The size of the partition on HD running the OS may differ from slice 1, /sda2, is there any problem in running dd? If the OS and /boot are on the same partition of the HD whether delete /boot later after running dd?
Quote: | and then I installed grub into slice2 | Whether run; Code: |
# cp -rpP /boot/* /mnt/sda3 |
as described on 1st posting of this thread.
Please advise. TIA.
B.R.
satimis |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
satimis Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
Joined: 21 Oct 2003 Posts: 365
|
Posted: Mon Mar 20, 2006 12:46 am Post subject: |
|
|
Hi NeddySeagoon,
Quote: | Google flash linux Its Gentoo on a stick. | Tks. I got it.
B.R.
satimis |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
satimis Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
Joined: 21 Oct 2003 Posts: 365
|
Posted: Mon Mar 20, 2006 10:54 am Post subject: |
|
|
Hi rlittle,
Further to my last posting, I made following test at WORK solely checking whether the bootable partition of the pendrive can be detected. On my WORK there was only a DSL on a partition to carry out this test.
Now I have 3 slices on the pendrive (1G)
# fdisk -l /dev/sda Code: |
Disk /dev/sda: 1007 MB, 1007419392 bytes
31 heads, 62 sectors/track, 1023 cylinders
Units = cylinders of 1922 * 512 = 984064 bytes
Device Boot Start End Blocks Id System
/dev/sda1 1 260 249829 6 FAT16
/dev/sda2 261 990 701530 83 Linux
/dev/sda3 * 991 1023 31713 83 Linux |
# mount /dev/hda8 /mnt/hda8 (DSL partition)
# mount /dev/sda3 /mnt/sda3
# cp -rpP /mnt/hda8/boot/* /mnt/sda3/
# ls -al /mnt/sda3/ Code: |
drwxr-xr-x 4 root root 1024 Mar 20 17:19 .
drwxr-xr-x 17 root root 4096 Mar 18 16:14 ..
lrwxrwxrwx 1 root root 17 Mar 20 17:19 System.map-2.4.26 -> System,map-2.4.26
-rw-r--r-- 1 root root 582790 Jul 25 2004 System.map-2.4.26
drwxrwxr-x 2 root root 1024 Mar 18 15:45 grub
-r--r--r-- 1 root root 994807 Mar 18 15:43 linux24
drwx------ 2 root root 12288 Mar 20 17:18 mlost+found |
# cd /mnt/sda3/
# grub Code: |
Probing devices to guess BIOS drives. This may take a long time.
GRUB version 0,91 (640K lower /3072K upper memory)
[ Minimal BASH-like line editing is supported. For the first word, TAB
lists the possible completions. Anywhere else TAT lists the poosible
completions of a device/filename. ]
grub> |
Nothing displayed
# cat /mnt/sda3/grub/menu.lst Code: |
default 0
timeout 15
title=USB bootable DSL
# Partition where the kernel image is located
root (hd0,2)
kernel /boot/linux24 ramdisk_size=100000 init=/etc/init lng=us vga=79
#BOOT_IMAGE=knoppix
#initrd=/boot/isolinux/minird.gz |
Rebooted PC. BIOS selected
USB-HDD/USB-ZIP/USB-FDD
none of them can work to detect the boot partition /sda3 of the pendrive.
Remark: tried (hd1,2) and (sd0,2) without result.
My problem is always failing to get the boot partition detected by the BIOS. Would it be the problem of the pendrive "Avixe Platinum Drive"? However it works on USB-ZIP, zip geometry and syslinux bootloader without problem.
B.R.
satimis |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
satimis Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
Joined: 21 Oct 2003 Posts: 365
|
Posted: Mon Mar 20, 2006 3:01 pm Post subject: |
|
|
Hi NeddySeagoon,
I got Flash Linux version 0.34, the latest release, download and burned on CD, playing it for about 2 hours. It is based on Gentoo with Gnome desktop but too slow. I can't setup broadband connection. "pppoe-setup" did not work. Neither I can find the setup process on desktop menu. The version is a little bid out of date, released on Feb, 2005.
I don't know what wil happen if burning it on pendrive. The discusion forum is not very active.
B.R.
satimis |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
rlittle Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
![](images/avatars/gallery/Southpark/avatar4.gif)
Joined: 17 Dec 2003 Posts: 200
|
Posted: Thu Mar 30, 2006 2:42 am Post subject: |
|
|
Sorry for being away so long.
Satimis! I think the main thing about about my method that you missed was that I took an already bootable iso image (it was around 700MB) and used dd to direct-dump it into slice 1 (/dev/sda2). dd-ing an already installed partition is not the same thing. Normally this trick wouldn't work at all, except that newer GRUB understands the iso filesystem and can read its contents.
Then, I configured the grub info in /dev/sda3,I pointed it at the kernel in /dev/sda2 (which is ONLY visible if you mount the iso image. Once you have used "dd" to put it on /dev/sda2, you can just mount /dev/sda2 to view the contents of your "boot disk").
Lastly, I ran grub-install which writes data to the Master Boot Record which is the first 1024(?) bytes on the device and is not visible as a "slice". It is before slice 0(/dev/sda1). When you try to boot from your USB key, your BIOS thinks your USB key is a SCSI drive and reads the MBR. The MBR will point to /dev/sda3 which has just enough brains to read the kernel INSIDE THE ISO IMAGE on /dev/sda2.
Ouch. I think I remembered this better a week ago. I've lost a few brain cells since then, if you know what I mean. To be honest, I can't remember the details for setting up GRUB, I just remeber having to keep a Live CD handy after I re-wrote the MBR on the wrong disk...
I know I didn't answer any questions directly, but I hope that clears up my other message a bit. _________________ I need a better signature... |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
satimis Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
Joined: 21 Oct 2003 Posts: 365
|
Posted: Thu Mar 30, 2006 3:28 pm Post subject: |
|
|
Hi rlittle,
Tks for your advice.
Quote: | used dd to direct-dump it into slice 1 (/dev/sda2). dd-ing an already installed partition is not the same thing. Normally this trick wouldn't work at all, except that newer GRUB understands the iso filesystem and can read its contents........ |
If I understand your advice correctly.
1. leaving slice 0 (/dev/sda1) untouched, without having anything installed ???
2. without burning the iso.img on CD
3. run; (slice 1) Code: |
# dd if=/path/to/iso.img of=/dev/sda2 |
4. # mount /dev/sda3 /mnt/sda3 (slice 3)
5. run; (slice 3) Code: |
# grub-install /mnt/sda3 |
6. run; (slice 3) Code: |
# echo abc > /mnt/sda3/pendrive |
6. # cd /mnt/sda3 (slice 3)
7. Fire "grub"
8. grub> find /pendrive
9. grub> root (hdX,2)
10. grub> setup (hdX,2)
11. menu.lst (content) Code: |
default 0
timeout 15
title=USB pendrive
# Partition where the kernel image is located
root (hdX,2)
kernel /boot/linux24 ramdisk_size=100000 init=/etc/init lng=us vga=79
#BOOT_IMAGE=knoppix
#initrd=/boot/isolinux/minird.gz |
If I'm wrong please correct me. Tks. I can't recall correctly how to create MBR on slice 3 (/dev/sda3).
Folks, your valuable comments are also welcome. TIA
B.R.
satimis |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
rlittle Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
![](images/avatars/gallery/Southpark/avatar4.gif)
Joined: 17 Dec 2003 Posts: 200
|
Posted: Thu Mar 30, 2006 7:09 pm Post subject: |
|
|
I'm at work right now so I can't poke around with Grub, but I think you have that correct. A few points.
- Yes, I just leave slice0 (/dev/sda1) blank. When I had completed all this, I formatted (mkfs -t vfat ) it with Win FAT32. That way I could use it on almost any system (M$ or Linux). The reason I did it is because some systems couldn't see anything besides the first parition, so if I wanted it to be useful, I had to put it first. The bootable stuff I could but anywhere.
- The MBR is always onthe beginning of the disk, not the partition. The MBR you write will POINT to /dev/sda3 where the configuration info that GRUB needs is stored (the first 1024 bytes of the disk is just not big enough). Once it reads the config info in /dev/sda3, it learnes enough to be able to read the kernel etc.. in /dev/sda2. You never actually "see" the MBR at any time. It is basically hidden unless the system is trying to boot from it.
In that snip of gub-kernel-boot stuff vga=79 should have 3 digits. _________________ I need a better signature... |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
satimis Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
Joined: 21 Oct 2003 Posts: 365
|
Posted: Fri Mar 31, 2006 5:04 am Post subject: |
|
|
Hi rlittle,
I have following points expected to clarify;
1. size of slice2 - 15M
Would it be suffient for installing grub?
2. Which slice needed to be tagged otherwise the BIOS can't find the pendrive? Slice2 ??? Then I need a boot floppy to boot the PC first which is not my target on this test. I don't expect to have a boot floppy.
3. About Gentoo Live CD.
On its officical sites I found;
livecd-i686-installer-2006.9.iso
I think this is an installer not the LIVE CD which can be booted and played on CDRom like Knoppix LiveCD.
Please advise. TIA
B.R.
satimis |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
rlittle Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
![](images/avatars/gallery/Southpark/avatar4.gif)
Joined: 17 Dec 2003 Posts: 200
|
Posted: Sat Apr 01, 2006 12:43 am Post subject: |
|
|
1. Not only is 15MB enough space, it's waaaay overkill space. The contents of my grub directory total up to 438KB which is all you will need. I guess I was being overcautios when I made mine 15MB. I'd recommend you only make it 1MB or 2MB. (hindsight is 20/20 as they say...)
2. I'm not sure if I understand Q #2 so I'll shotgun it:
-when the BIOS goes looking at the USB ports for something to boot, it will find your pendrive. When it does, it will look at Sector 0 (i.e. the Master Boot Record, which is not on any slice at all, it's at Sector 0 which is before all the slices). When it reads the MBR, the information put there when you ran "grub-install will tell grub to jump to /dev/sda3 and look for the grub-directory. When it finds that, it learns how to understand .iso filesystems and reads the kernel in the iso image in /dev/sda2 (grub.conf tells it /dev/sda2 and the kernel location).
Therefore, there is no need for a boot floppy, all the booting is done off the USB pendrive.
- if your question has anything to do with the "empty" /dev/sda1, the first time I set this up, I had my "empty space" in /dev/sda3. I found that when I plugged it into my Windoze machine, it couldn't find it. So I blew everything away and re-did it all, but put the "empty space" in /dev/sda1. Then my Windoze machine could find it etc.
I think that when you run grub-install, (with the proper flags, switches, etc), it writes the grub files (e2fs_stage1_5, stage2_eltorito, grub.conf.sample etc etc) to the partition you specify (/dev/sda3 in our case) and the updates the MBR with the info to go look in /dev/sda3 when booting.
One last thing. I finally went and re-read "man grub-install". If I remember right, I think I mount /dev/sda3 to a directory, then pointed grub-install at it:
Code: | mount /dev/sda3 /mnt/boot_usb
grub-install --root-directory=/mnt/boot_usb /dev/sda |
Are you trying it that way?
Good luck man! Let us know how it goes and if you have any more questions. Gentoo is the best! ![Cool 8)](images/smiles/icon_cool.gif) _________________ I need a better signature... |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
satimis Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
Joined: 21 Oct 2003 Posts: 365
|
Posted: Sat Apr 01, 2006 3:53 pm Post subject: |
|
|
Hi rlittle,
Quote: | 2. I'm not sure if I understand Q #2 so I'll shotgun it: | To make a partition on the pendrive detected by the BIOS, it is necessary to make it bootable (*). However non of the partitions(slices) has been made bootable.
Quote: | - if your question has anything to do with the "empty" /dev/sda1 | What will be the use of this partition, leaving it just empty?
Quote: | Code: | mount /dev/sda3 /mnt/boot_usb
grub-install --root-directory=/mnt/boot_usb /dev/sda |
Are you trying it that way? | I re-did this part. Still the BIOS failed detecting the pendrive. Would the problem come from the pendrive? As Starkiller said on early of this thread "... not all USB pendrives are bootable."
I'll tried again later using Knoppix as you did previously to see what will happen.
B.R.
satimis |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
rlittle Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
![](images/avatars/gallery/Southpark/avatar4.gif)
Joined: 17 Dec 2003 Posts: 200
|
Posted: Mon Apr 03, 2006 10:34 pm Post subject: |
|
|
Here is the output of "fdisk" on my USB key/pendrive (it shows as sdc becuase this machine has actual SCSI drives!) :
Code: | zaphod ~ # fdisk -l /dev/sdc
Disk /dev/sdc: 1037 MB, 1037615104 bytes
32 heads, 62 sectors/track, 1021 cylinders
Units = cylinders of 1984 * 512 = 1015808 bytes
Device Boot Start End Blocks Id System
/dev/sdc1 1 264 261857 c W95 FAT32 (LBA)
/dev/sdc2 265 1005 735072 83 Linux
/dev/sdc3 1006 1021 15872 83 Linux |
Looks like forgot to make ANY of then "bootable" (. I don't think that "boot" flag has anything to do with modern Linux. Maybe Windoze needs it?
However, if your BIOS needs it, the device you wan't to make "bootable" is the one with the kernel in it (in this case /dev/sdc2 where the .iso resides)
As for the "empty" parition, it's not really empty. It's true that I left it empty while I was setting of the boot stuff, but when I was finished I formatted it with FAT32 (vfat) because everybody can understand that filesystem (even Windows! ) Now when I plug it into a WinXP machine, it sees a 250MB removable disk. (the other 750MB is taken up by the other two partitions). Like I said before, some O/S's don't like the idea of more that one parition on a USB key. (I can't remember if XP didn't like it or not).
If you're still not booting, perhaps your USB key is a problem, but I think it's more likely that it's your motherboard or BIOS. I have a nice Abit Motherboard that is rock solid, but it can't boot my USB key (even though it claims it's able to). I flashed the BIOS to the latest version, and things acted a little better, but it still wouldn't boot. My laptop(s) had no problem booting off USB.
In case you're curious, my USB key is a Lexar JumpDrive. _________________ I need a better signature... |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
a1exus n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 25 Jan 2007 Posts: 9 Location: Brooklyn, NY
|
Posted: Fri Mar 16, 2007 7:51 pm Post subject: |
|
|
what about if you run that pen drive on few different scenarios
1) with IDE and no SATA or SCSI
2) with IDE and with SATA drives
3) with IDE and with SCSI drives
how would pendrive where to get root from? |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|
|
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
|
|