Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Linux on a USB Flash Drive
View unanswered posts
View posts from last 24 hours

Goto page 1, 2, 3  Next  
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
cohesion
n00b
n00b


Joined: 27 Aug 2002
Posts: 24
Location: KC, MO, USA

PostPosted: Sun Apr 06, 2003 6:36 pm    Post subject: Linux on a USB Flash Drive Reply with quote

I just bought the last of the 256mb USB flash drives for $79 from Microcenter.

I had an interesting idea and I need your help filling in the holes:

The drive is fast. Fast enough to use as a root partition. So, I frequently go on computer-help visits to different people I know and there are some really great utilities at the standard Linux console that would be indespensible to have when troubleshooting a Windows problem like cfdisk, lspci, df, dd -- just access to /proc is useful. USB flash disks are bootable. They appear as a SCSI hard drive to Linux. They can be partitioned and formated to any file system. Here is what I want to do:

Divide the drive in half. Make one half a bootable Linux partition with lots of useful command line utilities. Install grub as the bootloader. Put a FAT32 partition on the second half with things like Mozilla 1.3, JRE 1.4.1_02, and OpenOffice on it with some space left over for whatever I want to take back and forth.

I have figured out how to partition it; format it in FAT32 and reiserfs for the respective partitions; install the bootloader. I've confirmed that most modern computers can boot from it. Here's what I don't know:
  • What is the best way to get 128mb of the best of the Linux console in to that space? Should I start with a boot floppy distro and build up? What about building my own from a Slackware or Gentoo distro (compiling for i386 generic)? (If so, how can I build on my system and install to the flash drive?) Are there any bootable distros that you have a recommendation for?
  • Is there anything I've overlooked in my brainstorming?
  • How can I give grub access to the kernel when grub doesn't know how to access USB Storage? Once the kernel is loaded with usb-storage support, I should be okay.
  • Will any version of Windows have any trouble skipping over the reiserfs partition and hot mounting the FAT32 partition?

Here are the benefits of USB Storage over a bootable CD-RW:
  • It is fast and can opperate in systems that don't have a lot of memory to populate a root RAM disk with.
  • I can make changes to the configuration and reboot in the field.
  • I can quickly make modifications, enhancements and additions to the distro by simply mounting the Linux partition.
  • It's durable enough I can just have it with me wherever I go.
  • It's uber-geeky to whip Linux out of your pocket at a party.

the only disadvantage is that I only have 128mb as opposed to 700mb.
Back to top
View user's profile Send private message
femtotech
n00b
n00b


Joined: 19 Dec 2002
Posts: 23

PostPosted: Sun Apr 06, 2003 9:34 pm    Post subject: Reply with quote

Are you sure that you can boot from a USB flash drive? I didn't see a "Boot from USB" option in my BIOS (Asus A7N8X Deluxe) so I assumed it couldn't. It would be great if I could boot Linux from my 512MB Pen Drive. :D
Back to top
View user's profile Send private message
Ian
l33t
l33t


Joined: 28 Oct 2002
Posts: 820
Location: Newport, RI

PostPosted: Mon Apr 07, 2003 1:48 am    Post subject: Reply with quote

If this is indeed possible, I would love if someone could make something similar to Knoppix (although obviously much smaller) for various card sizes. Then I'd be able to impress people all over the school! :P

One thing that may help, if your BIOS doesn't support USB Boot...

A few weeks ago, I got a floppy disk from a friend. It loads a boot manager, which allows you to go into the BIOS, shutdown, reboot, boot from floppy (yeah, kind of useless), boot from hard drive, or boot from cd-rom. I believe it's from somewhere on sourceforge.net, but I can't say, as I got it from my friend.

Basically, if something like that exists, I would think to take that, and add in some sort of USB support shouldn't be too hard. Then again, I don't know how it works, so it could be next to impossible.

This is definitly an interesting idea, but as femtotech said, I've yet to see a BIOS that supports "Boot from USB." The other problem you may have is locked BIOSes, as it seems to have become the latest rage at my school, making the previously mentioned bootdisk so invaluble. Plus, if I could get Linux to run on my compact flash card, it'd almost be worth it just to carry a floppy disk around, because it's not that much bigger. :)
Back to top
View user's profile Send private message
cohesion
n00b
n00b


Joined: 27 Aug 2002
Posts: 24
Location: KC, MO, USA

PostPosted: Mon Apr 07, 2003 2:24 am    Post subject: Reply with quote

I have an ASUS A7V133-C motherboard and it has a "boot from removable device" menu in which you can choose either:
  • LS-120
  • USB FDD
  • USB ZIP

Supposedly USB FDD and USB ZIP both work, but have to be configured on the Flash device differently. (This would be something I would have to research a little; see which of those opions is more commonly implemented. I haven't actually tried booting from this thing, yet. Though, I just did finish successfully repartitioning it and installing the grub bootloader to it. I'm not sure if this is all I have to do.

It's really hard to find info on this on Google because of all the online USB Flash device retailers pages that keep coming up in the search results.
Back to top
View user's profile Send private message
reaz82
Apprentice
Apprentice


Joined: 14 Mar 2003
Posts: 203
Location: Austin, Texas

PostPosted: Fri Apr 11, 2003 1:58 am    Post subject: Reply with quote

very very interesting project..
building gentoo on that usb will be hard..
not sure if you should use gentoo or slackware..
try building linux from scratch..
that's a distro.. it's very light (doesnt need
the ebuilds that gentoo downloads > 200mb)

you are working in a tight environment.. so i assume
you will build on a pc and then copy to the key drive?
let us know how you progress..

good luck
Back to top
View user's profile Send private message
OdinsDream
Veteran
Veteran


Joined: 01 Jun 2002
Posts: 1057

PostPosted: Thu Jun 05, 2003 8:43 pm    Post subject: Reply with quote

This is a great idea, and seeing as how I just came to be the owner of a 512mb flash disk, I'm very interested. A little digging on google turned up:

http://www.ncsu.edu/resnet/runt/

...which seems to be the most useful of the links. The distribution is based on ZipSlack, which is, not surprisingly, SlackWare designed to run from a Zip-100 drive. RUNT is designed to make use of an extra 28MB available on their target media, however, I'm sure it would be a simple matter to add more capabilities...

Booting is done via a floppy. Perhaps this can be modified.
_________________
s/(?<!gnu\/)linux(?! kernel)/GNU\/Linux/gi

Don't blame me. I didn't vote for him.

http://john.simplykiwi.com
Back to top
View user's profile Send private message
searcher
Apprentice
Apprentice


Joined: 13 Mar 2003
Posts: 175
Location: NL

PostPosted: Thu Jun 05, 2003 9:39 pm    Post subject: Reply with quote

I'm also working on this as i just bought a small usb keychain (64mb). After reading this i've been trying to get the gentoo boot cd on it. With a little tweaking you could install your own kernel, rip the hardware detection program from knoppix (it's open source and hopefully not too large) and i'd might even be able to run TinyX, a small X server. OpenOffice won't fit with me, but i should be able to put a few small editors on the stick, just for fun.

I'd like to see more people bring in ideas about this, as having gentoo on a usb-stick would be very cool to flip out at lan parties :)
_________________
You are unique ... just like everyone else.
Back to top
View user's profile Send private message
Carlo
Developer
Developer


Joined: 12 Aug 2002
Posts: 3356

PostPosted: Thu Jun 05, 2003 11:31 pm    Post subject: Reply with quote

Be aware that flash ram is only capable of ~1.000.000 write accesses per sector, so it seems better to put /proc etc. in a ramdisk.


Carlo
Back to top
View user's profile Send private message
zuigzoen
n00b
n00b


Joined: 07 Oct 2002
Posts: 20
Location: The Netherlands

PostPosted: Wed Jun 18, 2003 10:00 am    Post subject: Reply with quote

cohesion have you made any progress?
This really is interesting and I'm curious about your progress, 'cause this could be very handy for a lot of us geeks.
_________________
minds are like parachutes, they only function when they are open
Back to top
View user's profile Send private message
sschlueter
Guru
Guru


Joined: 26 Jul 2002
Posts: 578
Location: Dortmund, Germany

PostPosted: Thu Jun 19, 2003 5:59 am    Post subject: Re: Linux on a USB Flash Drive Reply with quote

cohesion wrote:
The drive is fast. Fast enough to use as a root partition. So, I frequently go on computer-help visits to different people I know and there are some really great utilities at the standard Linux console that would be indespensible to have when troubleshooting a Windows problem like cfdisk, lspci, df, dd -- just access to /proc is useful. USB flash disks are bootable. They appear as a SCSI hard drive to Linux. They can be partitioned and formated to any file system. Here is what I want to do:


Maybe this mini distribution is what you want... haven't used it though.
Back to top
View user's profile Send private message
sschlueter
Guru
Guru


Joined: 26 Jul 2002
Posts: 578
Location: Dortmund, Germany

PostPosted: Thu Jun 19, 2003 6:02 am    Post subject: Reply with quote

Carlo wrote:
Be aware that flash ram is only capable of ~1.000.000 write accesses per sector, so it seems better to put /proc etc. in a ramdisk.Carlo


/proc is just a virtual file system... but otherwise you are right... something like /var/log/* (depending on the user's config) could kill the flash media soon.
Back to top
View user's profile Send private message
klarnox
Guru
Guru


Joined: 28 Jan 2003
Posts: 350
Location: Wisconsin, USA

PostPosted: Thu Jun 19, 2003 5:43 pm    Post subject: Reply with quote

cohesion wrote:
I have an ASUS A7V133-C motherboard and it has a "boot from removable device" menu in which you can choose either:
  • LS-120
  • USB FDD
  • USB ZIP

Supposedly USB FDD and USB ZIP both work, but have to be configured on the Flash device differently. (This would be something I would have to research a little; see which of those opions is more commonly implemented. I haven't actually tried booting from this thing, yet. Though, I just did finish successfully repartitioning it and installing the grub bootloader to it. I'm not sure if this is all I have to do.

It's really hard to find info on this on Google because of all the online USB Flash device retailers pages that keep coming up in the search results.


My newest system supports booting from USB devices as well (Shuttle XPC SS51G). Options include USB HDD, USB CDROM, USB Floppy. I believe there are more, but I'm not at home to check at the moment.
Back to top
View user's profile Send private message
jago25_98
Apprentice
Apprentice


Joined: 23 Aug 2002
Posts: 180

PostPosted: Fri Jun 20, 2003 5:41 pm    Post subject: bootdisk to boot /dev/usb/<massStorage> Reply with quote

I've also been trying to do this.

The problem I have is my bios doesn't support booting from USB.

So I need to make a bootdisk.

I thought getting a bootdisk to boot a USB root partition should be simple:-

- Install lilo/grub onto a floppy with support in the kernel for USB mass storage, as many varieties as possible, probably a 2.5 kernel.

Haven't got a computer of my own for a while but going to try just copying bzImage to a disk, hope it fits.
Back to top
View user's profile Send private message
xlyz
Veteran
Veteran


Joined: 27 Oct 2002
Posts: 1470
Location: Italy

PostPosted: Sat Jun 21, 2003 9:15 pm    Post subject: Re: Linux on a USB Flash Drive Reply with quote

cohesion wrote:
What is the best way to get 128mb of the best of the Linux console in to that space? Should I start with a boot floppy distro and build up? What about building my own from a Slackware or Gentoo distro (compiling for i386 generic)? (If so, how can I build on my system and install to the flash drive?) Are there any bootable distros that you have a recommendation for?


u may want to check http://eaglelinux.w32.net/ to build a console liveCD (or liveUSB :wink:) in 4 mb

latest release is based on debian, but can be easily adapted to be used with gentoo

they plan to release an X version in july
_________________
wanna change how bootsplash or qingy look like? try here
Back to top
View user's profile Send private message
IntergalacticWalrus
Guru
Guru


Joined: 07 Jan 2003
Posts: 513
Location: Montreal QC (Canada)

PostPosted: Mon Jun 23, 2003 1:54 am    Post subject: Reply with quote

Funny how this topic hits the GWN the exact same day I buy a Verbatim USB2.0 256MB Drive... The thing was expensive (maybe a bit too much for my budget) but it's so cool (in a geeky way) to have 256MB of storage on my keyring that I couldn't help myself...
Back to top
View user's profile Send private message
onkelfusspilz
Tux's lil' helper
Tux's lil' helper


Joined: 26 Aug 2002
Posts: 128
Location: Germany

PostPosted: Tue Jun 24, 2003 9:02 am    Post subject: Reply with quote

Great Idea!

I think about the way to arange the storage on the usb-drive. It seems that knoppix (http://www.knopper.net) which is actualy only available as a 700 MB boot image for cdroms, have a COMPRESSED file, containing the root-fs. This file is mounted, so it is direct accessable as "/" and deflating "on the fly".

My idea is to use a kind of image file, who is NOT read only! It would be great if it were possible to mount this compressed image as "/" and if something is written to the root-fs it is compressed into the image-file "on the fly" ;-)

The main difference between a 256MB USB Stick and a cdrom to me, is that it is small, fast and that it is WRITABLE! So there must be way to use this witable capability to store user-related data (profiles...)

I'm dreaming of a knoppix-like image, with tinyX and kOffice, browser (phoenix?) and everything what I need on a 256 USB-Stick, with the ability to write my profile-data to the stick, too.

Does anyone know something about a filesystem, that is able to mount a compressed image for R/W? Is it possible?

Let me hear your ideas ...
Back to top
View user's profile Send private message
sagipolley
n00b
n00b


Joined: 29 Apr 2002
Posts: 40
Location: Israel

PostPosted: Wed Jun 25, 2003 7:42 pm    Post subject: Another (non-Gentoo) alternative Reply with quote

There is another way to approach this. (Disclaimer--I am a big Gentoo fan, and run it myself. I'm just offering this information 'cause it might help someone.)

Knoppix-MiB Privacy Edition lets you boot from CD (like regular Knoppix), but also lets you use the USB stick as your home directory.

You can find it here:

http://www.bouissou.net/knoppix-mib/doc-html/Knoppix-Mib.html
Back to top
View user's profile Send private message
led42
n00b
n00b


Joined: 25 Jun 2003
Posts: 1

PostPosted: Wed Jun 25, 2003 10:34 pm    Post subject: Reply with quote

sschlueter wrote:
Carlo wrote:
Be aware that flash ram is only capable of ~1.000.000 write accesses per sector, so it seems better to put /proc etc. in a ramdisk.Carlo


/proc is just a virtual file system... but otherwise you are right... something like /var/log/* (depending on the user's config) could kill the flash media soon.


worst if the filesystem is mounted with atime (default) every time a file is read it's access time is updated... so potencialy some parts of the flash will fail pretty fast.

better to mount with noatime
Back to top
View user's profile Send private message
ben_h
Tux's lil' helper
Tux's lil' helper


Joined: 26 Nov 2002
Posts: 118
Location: Australia

PostPosted: Thu Jun 26, 2003 7:11 am    Post subject: Reply with quote

If your mainboard can boot from USB, and can handle USB to IDE, then Grub can see the USB drive.

For the record, I have a Gigabyte 8IEXP, and it boots from a USB device beautifully.
I got a USB2 Caddy to pop a laptop HDD into -- grabbed a 6 gig disk out of an old, bereaved laptop in my cupboard. Works really well, and writes at 7 to 8 MB/sec with echi-hcd modprobed.

Now, to get gentoo on it, I partitioned it up nice and simply --
-- /dev/sda1 = /boot (24MB)
-- /dev/sda2 = swap (192MB)
-- /dev/sda3 = / (1 gig)
That leaves me 5 gigs.

Now, mkfoofs and mount the appropriate partitions at /foo/bar (and then /foo/bar/boot, etcetera for whatever else you desire). But, you most probably don't want to compile on the USB device, for space reasons, and you definitely don't want to redownload all those tarballs. So,
Code:
cd /foo/bar
mkdir mnt/tarpit
mkdir mnt/compile
mount -o bind [your host system's DISTDIR path] mnt/tarpit
mount -o bind [your host system's PORTAGE_TMPDIR path] mnt/compile

Then, chroot into the new tree with
Code:
chroot /foo/bar /bin/bash

After that, just follow the install instructions from the appropriate point (that is, directly after the chroot command), but make sure you set
Code:
DISTDIR=/mnt/tarpit
PORTAGE_TMPDIR=/mnt/compile
in /etc/make.conf, once you've emerge sync'ed.

Make sure you compile scsi disk support and usb-storage support into the kernel proper, as well as uhci and ehci.

All this worked fantastically for me. However I ran into problems when I was booting the device -- the kernel gets to a stage where it should be mounting the root device and loading /sbin/init. However, because the usb-storage drivers take a good couple of seconds to initialise, they're too late for the kernel's root mounting attempt, and it panics.
A delay can be introduced, but this only worked for me if devfs was turned off. Obviously this isn't a solution, since gentoo dies at about the third init script if devfs isn't enabled.
However, it does narrow the problem to devfs -- and I haven't tried it with 2.4.21, so that might be something to do. (I only tried 2.4.20).

But, the moral of the story is that if this delay problem can be fixed, then there's no need to bollocks around with knoppix, ramdisks, and the like -- if the device is big enough and the computer supports USB booting, then a completely standard Gentoo install will work perfectly, provided the kernel has the necessary drivers compiled in.
Back to top
View user's profile Send private message
TecHunter
Tux's lil' helper
Tux's lil' helper


Joined: 15 Feb 2003
Posts: 124

PostPosted: Fri Jun 27, 2003 11:12 am    Post subject: Reply with quote

cohesion wrote:
I have an ASUS A7V133-C motherboard and it has a "boot from removable device" menu in which you can choose either:
  • LS-120
  • USB FDD
  • USB ZIP

my mb is AUSU a7v266-ex,but i cant find USB boot options :( :( :( :(
_________________
Gentoo is GREAT!!!
Back to top
View user's profile Send private message
macval
n00b
n00b


Joined: 28 Dec 2003
Posts: 1

PostPosted: Sun Dec 28, 2003 11:00 pm    Post subject: Reply with quote

I suggest see http://openfacts.berlios.de/index-en.phtml?title=Linux_bootable_USB_key_HOWTO

One can indicate the USB key where it works ( I wants to buy one ;)

Regards.
Back to top
View user's profile Send private message
bakey
n00b
n00b


Joined: 31 Dec 2003
Posts: 3
Location: Austin

PostPosted: Wed Dec 31, 2003 10:57 pm    Post subject: Linux on a USB Flash Drive Reply with quote

There are a few distros that are setup for usb key.
flonix http://linuxdocs.tuxfamily.org/flonix/index.php and stixx http://www.stixx.org/
Flonix has a 64meg version and it is based off of Knoppix.
I would like to make a few versions of gentoo on usb key.
Flonix is using a fat filesystem and syslinux to make the usb key bootable.
They have an init ramdisk that has etc and stuff (2meg).
It boots with a good sized ram disk and the knoppix system is cut down from the cd one but it has enough to bring up x and has some basic utils and office apps. The knoppix file system is using cloop instead of cramfs which allows you to break the 16meg file and 256meg filesystem limits. It looks like you get a three to one compression ratio with cloop. So you can fit a lot of apps in a small space. It should be easy to convert the gentoo install cd's and maybe cut down the livecd to fit a 256meg usb key. As soon as I free up a machine I'm going to start work on the basic install cd.
Back to top
View user's profile Send private message
gringo
Advocate
Advocate


Joined: 27 Apr 2003
Posts: 3730

PostPosted: Sat Jan 03, 2004 10:44 am    Post subject: Reply with quote

Yes, a great job was done with flonix. Have tried it and it´s very impressive !

But i will try to do something like this but based on gentoo. Have already tried to optimize / cut down a knoppix live-cd to fit in the 128 megs pen, without success. Which size should have the tree before compressing ?? More or less 300 / 400 megs i suppose...

I think we should try with "light" apps like tinyx with *box, dietlibc and so on. Will give it a try this weekend... will also try with a 2.6.x kernel without the cloop utility. Let´s see....

Have you tried building with catalyst ??
http://www.gentoo.org/proj/en/releng/catalyst/

regards
Back to top
View user's profile Send private message
barnabe
n00b
n00b


Joined: 19 Mar 2003
Posts: 9

PostPosted: Mon Jan 19, 2004 10:33 pm    Post subject: Reply with quote

ben_h wrote:
All this worked fantastically for me. However I ran into problems when I was booting the device -- the kernel gets to a stage where it should be mounting the root device and loading /sbin/init. However, because the usb-storage drivers take a good couple of seconds to initialise, they're too late for the kernel's root mounting attempt, and it panics.
A delay can be introduced, but this only worked for me if devfs was turned off. Obviously this isn't a solution, since gentoo dies at about the third init script if devfs isn't enabled.
However, it does narrow the problem to devfs -- and I haven't tried it with 2.4.21, so that might be something to do. (I only tried 2.4.20).

But, the moral of the story is that if this delay problem can be fixed, then there's no need to bollocks around with knoppix, ramdisks, and the like -- if the device is big enough and the computer supports USB booting, then a completely standard Gentoo install will work perfectly, provided the kernel has the necessary drivers compiled in.


I'm having the exact same problem, with 2.4.22-gentoo-r5. I'm even able to boot from USB as my motherboard permits it, although very slowly, but as soon as the kernel tries to mount the root partition it panics. When booting on another, non-USB disk everything is fine and I can work with the USB disk. Do you know if there's any progress? Thx.
Back to top
View user's profile Send private message
brncmp
n00b
n00b


Joined: 22 Jan 2004
Posts: 1

PostPosted: Thu Jan 22, 2004 2:35 am    Post subject: Reply with quote

This is great idea. I have been using damn small linux since my hard drive craped out in my nootbook and i would love to use my cdrom again.

How hard would it be to port opie or Open Zarurs to a pc. I think sysLinux could be used as the boot loader.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Goto page 1, 2, 3  Next
Page 1 of 3

 
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