Click to See Complete Forum and Search --> : Installing to a USB drive
Donniesito
05-08-2007, 04:08 PM
I have been trying to install Linux to a usb hard drive so that I can have my 'linux box' wherever I go... (Most computers these days will allow you to boot from a usb drive.)
Problem is this: Every time I try to install it to my drive, it installs fine, but I get an error at the end saying that installing GRUB to sda failed; I've tried it a few times, even tried different distros, but always get the same error.
Basically I want the computer(s) I use this on to boot normally when the external drive's not connected, but when it *is* connected I want it to boot up from SDA (I don't want to have to install grub on the various machines this'll be used on)
Any suggestions?
Thanks in advance! :-D
saikee
05-08-2007, 05:50 PM
All your wishes have been granted by Linux.
What you need to do now is to tell the Bios to enable "USB legacy support" and select the USB disk first one to boot.
You can install Linux into a USB device because the LInux kernel scans repeatedly for the USB devices. At boot time Grub has no access to the kernel and cannot detect the USB disks. If the USB lagacy is enable then Grub can find the USB disks.
Just one more step and you are there.
cypherzero
05-08-2007, 06:40 PM
Another method is simply to install GRUB to your main drive, since GRUB can call NTLDR to boot Windows as well as Linux.
I used this as GRUB didn't like installing to my USB disks at all, despite recognising them.
If you use this method GRUB won't load without the external disk attached.
To correct this, change the location of GRUB's startup files (device.map, menu.lst) to your main internal drive.
Donniesito
05-08-2007, 07:18 PM
Yep - Legacy usb support is enabled, and I have the system set to boot from the usb hd, but still no-go. When it attempts to boot linux, all I get is a neverending string of 99 99 99 99 99 99 99 99, etc etc.
I've tried reinstalling, tried different distros, etc but to no avail. Now.. At my system at home I run linux with no problem.. I just can't get it installed on my usb drive, and since I'm away from 'home' I miss Linux hehehe.
I also don't want to install grub on any computers' internal drive; in this way, (if I can get it to work), I can literally go to, say, a friends' house, plug in my drive and start the computer with "my" system.
Thank you for your fast responses -- much appreciated! Looking forward to hearing more from ya :)
saikee
05-08-2007, 07:40 PM
One weekend's work to install the following into the USB disk
sda1 : FreeDOS, the only system not installed but ported directly from another disk
sda2 : PcBSD 1.0, the only BSD that works. FreeBSD and Solaris failed.
sda3 : not yet filled
sda4 : extended partition for sda5 to sda15
sda5 : swap partition for all the Linux
sda6 : Slax 4.1.8
sda7 : Mandriva 2007
sda8 : Suse 10.3 alpha1 (booted by FC6 kernel)
sda9 : Fedora Core 6
sda10 : Slackware 11 (booted by FC6 kernel)
sda11 : Ubuntu 7.04
sda12 : PCLinuxOS 2007 test 2
sda13 : Sabayon 3.0
sda14 : Raysx 1.5 (booted by Knoppix kernel)
sda15 : Knoppix 5.1.1.1
All booted by Grub of FC6 in the USB. Recorded in this thread (http://www.justlinux.com/forum/showthread.php?t=148499).
I think the major distros were represented there.
If you get 99 99 99..... You are using Lilo. Grub is more manageable because you can boot up every system manually with a Grub floppy, made according to Section 3.1 of Grub Manual.
I highly recommend making a Grub floppy (or Grub CD) containing only the stage1 and stage2 of Grub unattached to an operating system. There is no PC system that a Grub floppy or CD cannot boot. I use to boot Linux served by Lilo too (by displaying and using /etc/lilo.conf information on the spot).
If USB legacy is enabled the Grub command
geometry (hd0)
geometry (hd1)
etc
will show up if the USB disk is seen by Grub. Thereafter a Linux in an external USB disk is booted by Grub just like any system in an internal disk.
--------------------------------------------
One important point is you should install the Linux when the USB disk is the first hard disk to be booted (preceded only by the CD/DVD drive) in the Bios disk order. That way it is installed in (hd0) and booted from (hd0). Install it as (hd1) and give the internal disk as (hd0) and then change the disk order will not work because the installed files will point to (hd1).
Donniesito
05-08-2007, 08:31 PM
---snip
If you get 99 99 99..... You are using Lilo. Grub is more manageable because you can boot up every system manually with a Grub floppy, made according to Section 3.1 of Grub Manual.
---snip
Nope - It's not lilo, it's grub, since grub is what's giving me the error when I'm trying to install ubuntu on the drive (also gave me the same error with a few other distros)
If I were to install grub on the internal drive, everything works. Problem is.. I don't want grub on the internal, I want a "complete working system" on the usb drive, no installation of anything on the internal drive.
je_fro
05-08-2007, 10:06 PM
The last bootable USB stick I made I had to use this: http://www.chiark.greenend.org.uk/~neilt/mbr/
Donniesito
05-10-2007, 03:34 PM
Well, I still can't get it to work. I must be doing something wrong :/ I decided to try PCLinuxOS - there are very explicit instructions on how to boot/run it from the flash drive.
I followed the steps to the letter, got everything done & rebooted. Now when the computer boots, the screen clears and GRUB appears in the top-left of the screen & sits there. No errors or anything, just "GRUB."
saikee
05-10-2007, 04:24 PM
If you a Linux Live CD that has Grub you can repair it as follow
(1) Boot up the Live CD Linux
(2) Go into the root console (normally by su followed by root password)
(3) Activate Grub, by command "grub"
(4) Use "geometry (hd0)", "geometry (hd1)", etc to locate PCLinuxOS, say it is (hd0,0)
(5) Tell Grub the root partition of PCLinuxOS is (hd0,0) and set up Grub in the whole of disk (hd0), meaning its MBR
root (hd0,0)
setup (hd0)
quit
reboot
You will find Grub should work again after a reboot.
Grub counts from 0 so the 1st partition of the first disk is (hd0,0). (hd0) means the 1st disk.
jaygee432
05-10-2007, 06:49 PM
If you get tired of trying to get around this with grub, you might try a distro particularly suited to be installed on say usb sticks without needing grub to boot, e.g., Puppy, Slax, DSL. If you have enough memory, you can add a host of features. I've had good results with the first two, but didn't like DSL because it didn't do well with my wireless adapter.
saikee
05-10-2007, 08:14 PM
I think the installation of a USB pen drive is different to a USB hard disk for the following reasons
(1) Pen drives up to 2Gb sizes are invariably formatted in fat16. The size is too small for a full size Linux and the factory-supplied filing system is unsuitable too. That is why Grub isn't used but "syslinux" is. The latter is a Dos-based boot loader that can operate in a fat16 partition. If one installs Puppy into a pen drive it demands only one partition in fat16 and will be installed as one compressed file. When this Puppy partition is mounted by another Linux you can see nothing except a compressed file, plus the syslinux boot loader files.
The same Puppy if installed in a USB hard disk can live in a proper Ext2/3 partition like every other Linux and booted by Grub. You can access every file after mounting it.
When a USB Puppy boots it expands into Ext2/3 format and held in the memory same as a normal Linux. On exit it rolls everything back into one file to store into the fat16 partition.
(2) Fat16 has a limitation that it cannot address beyond the 2 Gb of the hard disk and so syslinux isn't helpful there whereas Grub rules supreme. Thus for a USB hard disk a Linux can be installed in exactly the same way as in an internal disk.
je_fro
05-10-2007, 08:43 PM
Like I mentioned above, installing multiple bootloaders on a USB stick left me with an unbootable USB drive until I used that mbr program in the link above...