LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 08-15-2008, 02:33 PM   #1
WingnutOne
Member
 
Registered: Sep 2007
Location: Kansas City
Distribution: Mixed, mostly RH / Fedora
Posts: 76

Rep: Reputation: 16
Lightbulb Using flash memory for swap space?


It's fairly common knowledge that swap space on a hard drive is much slower than RAM. Has anyone here tried using a USB 2.0 flash drive for their swap space instead of a hard drive partition?

If I've read everything right, it sounds like using a USB memory stick (plugged in permanently) would be faster than a swap partition on a typical 7200 RPM disk.

One thing that occurs to me in thinking about this is that if you compare bus speeds, a SATA hard drive looks a lot faster (1.5-3.0 Gbit/sec vs. 480 Mbit/sec for USB). Neither of those accounts for the read/write speed of the actual media though. I know the read/write rates on an HD platter are a lot slower than SATA bus speeds, but don't know how flash compares.

Would a USB 2.0 flash drive actually have a faster throughput to & from the media? If it works, then it seems like a good idea - especially considering how cheap they've gotten.
There must be something wrong with the idea though, or I'd probably have heard more about it...


Any insight would be appreciated.
wn
 
Old 08-15-2008, 02:40 PM   #2
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian Stable
Posts: 2,546
Blog Entries: 8

Rep: Reputation: 465Reputation: 465Reputation: 465Reputation: 465Reputation: 465
USB 2.0 flash drives are typically very slow, maybe a third as fast as an average hard drive for reading; even slower for writing. Neither of them come anywhere close to the interface limits.

Also, flash memory has a limited lifetime in write cycles. This probably means it's not a good idea for a swap partition, but if the swap partition is rarely used then maybe it's okay.
 
Old 08-15-2008, 03:06 PM   #3
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
I could only see using a "disposable" sd card on an eeepc. You shouldn't configure an eeepc with a swap partition for the same reason, but configuring an external sd card you don't mind destroying is an alternative. Flash memory is very slow for writing. One advantage they do have over hard drives is you don't have a spinup time if they shut down to save power. Writing two files at once will also cause a performance hit on sd flash drives.
 
Old 08-15-2008, 03:08 PM   #4
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
I had a manager stuck with Vista (I know, not Linux related) but they wouldn't pay the option to upgrade his Memory from 1GB installed to 2GB or more. The memory was so awful, he ended up using a 2GB USB Flash for swap, didn't have any issues and it actually sped up his machine. And this was Vista for crying out loud..
 
Old 08-15-2008, 03:21 PM   #5
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Cramming Vista on a machine with 1GB of memory slowed the machine down so much that the flash memory seemed like an improvement.
You really need a 64 bit machine with 4GB of memory if you don't want a performance hit with Vista. Then Vista runs fine.
 
Old 08-15-2008, 03:58 PM   #6
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
Quote:
Originally Posted by jschiwal View Post
Cramming Vista on a machine with 1GB of memory slowed the machine down so much that the flash memory seemed like an improvement.
You really need a 64 bit machine with 4GB of memory if you don't want a performance hit with Vista. Then Vista runs fine.
I know, I just figured sharing this info to stand up for the USB flash drive who can't create an account to stand up for himself..

Personally if the OP has a machine with 2GB or more memory installed and it's a desktop, do away with swap if you want or just create on the actual disk, it'll probably rarely get used anyways and if you do need to use it, that's just an indication that you should install more memory in the first place.
 
Old 08-18-2008, 09:04 AM   #7
WingnutOne
Member
 
Registered: Sep 2007
Location: Kansas City
Distribution: Mixed, mostly RH / Fedora
Posts: 76

Original Poster
Rep: Reputation: 16
Thumbs up

Hey everyone, thanks for the info on flash drives. The tips on Vista were good too - especially since the machine I was thinking about using it on was my Winderz box.

wn
 
Old 08-18-2008, 09:37 AM   #8
b0uncer
LQ Guru
 
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
Quote:
Originally Posted by IsaacKuo View Post
Also, flash memory has a limited lifetime in write cycles. This probably means it's not a good idea for a swap partition, but if the swap partition is rarely used then maybe it's okay.
I doubt if there's such thing that doesn't have "limited lifetime" Some flash memory devices indeed seem to die rather quickly, but others tend to live longer - and some manufacturers/resellers give a 10 year guarantee (one guy offered a lifetime guarantee last time I was at a camera shop) for their flash memory cards. That's long; if you used such memory for swap, lifetime wouldn't be a problem because either it lasted at least 10 years (and you probably switched your hardware in the meantime anyway) or it didn't and you got a replacement for the 10-year warranty. But taking into consideration the speed and on the other hand the price of harddisks today there's not much point in buying flash memory for swap. Instead you could easily buy (if you found) a 10GB harddisk for pocket money, or the smallest harddisk you could find and use the extra space for storage -- long-time/not-usually-in-use-storage for example.

I was astounded when I heard Microsoft folks advertise that you can buy a "Vista compatible" (hah, what a term) USB key and "extend" your Vista-machine's memory onto it. They actually made it sound like you could now "get more RAM" literally for coins.

Quote:
Originally Posted by jschiwal
You really need a 64 bit machine with 4GB of memory if you don't want a performance hit with Vista. Then Vista runs fine.
I have a 64-bit machine that runs a 32-bit Vista (they don't sell preinstalled 64-bit Vistas here, and I wouldn't buy one if I wasn't more or less forced with the hardware in question) with 4GB of RAM (but only ~3GB visible on Vista..) and it does run fine - except for the "are you sure you really wanted to personally let this application X do what you just selected" stop messages And an elder friend of mine has a laptop with a lot less horsepower (and 2GB RAM) and it runs Vista smoothly too - though anything heavy on top of it might not do so well.

Last edited by b0uncer; 08-18-2008 at 09:40 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how much swap space is needed; how to increase swap space? johnpaulodonnell Linux - Newbie 5 03-23-2007 03:20 AM
not enough memory to run YaST,enable swap space, but can't ArtsWorks Linux - Newbie 8 09-13-2004 08:59 AM
swap space used: 0; memory used: 90-95% abs Slackware 9 08-30-2004 12:33 PM
How to unmount actual swap and mount a new(bigger) swap space? isaac Linux - Newbie 1 06-06-2004 01:23 AM
Difference between Swap Virtrual memory and Swap Parition Nappa Slackware 4 11-27-2003 07:58 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:37 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration