PDA

View Full Version : Using a USB flash drive as RAM.....



Rggoalie3
12-30-2003, 11:47 PM
Ok, heres that deal. I work at a major electronics store and we need to be able to back up data on laptops, but we do not have auth. to take that HDs out. So iv'e loaded knopptix under run level 2 "knopptix 2" at start up. Then I mount my hda1 (my win partition) and then I mount my smb drive and transfer my files over.

The problem comes when I have a laptop that has under 128 MB ram. Then I start getting ERRnomem errors. I figure this is because I'm using so much of te RAM as ramdisk.

So my question is: Can I use a USB flash drive as RAM in Linux??? I would repartition the drive, but many of the laptops I get have a bunch of bad sectors and that usually won't work.

How can I "partition" a USB flash drive as swap and how do I get the Linux box to recongnise it as system RAM?

THANKS in advance for any help.
:D

arkaine23
12-31-2003, 12:55 AM
You can probably use it as swap if you cfdisk it to the right type of filesystem for swap.

Knoppix would probably recognize it as /dev/sda1, so once you've made a partition on it of type swap with cfdisk, you'd then run these commands as root:

cfdisk /dev/sda
mkswap /dev/sda1
swapon -a

In fact, knoppix might detect it and use it as swapspace automatically thereafter.

rickenbacherus
12-31-2003, 01:19 AM
I don't have a USB drive so this is nothing more than a stab in the dark......

cdrecord -scanbus

Hopefully your USB drive shows up there. If so it should be mountable something like /dev/sda

If you can mount it i would think that you could partition and format it.

cfdisk /dev/sda

mkswap /dev/sda1
swapon /dev/sad1

Then maybe (if you're really lucky) the next time you boot knoppix it might just see your swap and use it. Please post back either way as this is something I'd like to explore further in the future.

Duffin444
12-31-2003, 08:45 AM
While it might be possible to format the USB drive to be swap, it is most likely not a good idea if the drive is a flash (pen/thumb) drive. Those drives have a very limited read/write speed (<10MBs). This would be VERY noticeable when using it to transfer files. Another very important limitation with these drives is that they have a limited erase cycle, most around 1,000,000 times. While this might seem like a lot (and it is for file storage) it is not enough to use as swap.
I apologize if the flash drives are not what you were talking about. If you were talking about a USB hard drive then I am right with you on that one. I think that a USB hard drive would be a great idea, and eliminate the partitioning problem that you are currently having.

Cheers,
Duffin

Rggoalie3
01-02-2004, 05:03 AM
Hadn't thought of a USB HD. That would probebly do a much better job. Thanks for the tip.