LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 06-09-2006, 07:53 AM   #1
stevenjoseph
LQ Newbie
 
Registered: Feb 2005
Posts: 7

Rep: Reputation: 0
Using a usb thumb drive or flash drive as a swap partition.


Hi
I tried out a little experiment, i created a swap on my 1G thumbdrive.
There seems to be a little improvement in performance. Is this possible, safe, and can i continue to do this.
How do i know if the usb version.
and how do i bench mark performance

Thanks
Steven
--
Life would have been a lot more easier if we had the source code.
 
Old 06-09-2006, 09:42 AM   #2
oneandoneis2
Senior Member
 
Registered: Nov 2003
Location: London, England
Distribution: Ubuntu
Posts: 1,460

Rep: Reputation: 48
You're going to kill your thumb drive using it as swap - flash memory can only take so many writes, and swap will get through them in a very short time.
 
Old 06-09-2006, 09:56 AM   #3
kilgoretrout
Senior Member
 
Registered: Oct 2003
Posts: 2,987

Rep: Reputation: 388Reputation: 388Reputation: 388Reputation: 388
I think it's a bad idea. First, I've found write times to flash drives to be incredibly slow, slower than disk reads:

Code:
[root@localhost patrick]# hdparm -tT /dev/sdc

/dev/sdc:
 Timing cached reads:   3524 MB in  2.00 seconds = 1761.39 MB/sec
 Timing buffered disk reads:   30 MB in  3.06 seconds =   9.80 MB/sec
[root@localhost patrick]# hdparm -tT /dev/hde

/dev/hde:
 Timing cached reads:   3460 MB in  2.00 seconds = 1729.40 MB/sec
 Timing buffered disk reads:  116 MB in  3.01 seconds =  38.52 MB/sec
There, hde is an ata100 ide hard drive and sdc is a flash drive.

Second, flash drives have a limited amount of writes before they will fail to function. You don't want to put them in a position where they will potentially be constantly written to like a swap file/partition.

Third, if you have 512MB of ram or more, you will rarely go into swap during normal operation. Even if flash were faster, you are not likely to see any significant performance improvement if you have that amount of ram.
 
Old 01-14-2012, 12:51 PM   #4
boscharun
LQ Newbie
 
Registered: Jan 2012
Posts: 2

Rep: Reputation: Disabled
You will defenitely kill your USB drive if you use swap daily. But for occasional usage, using a pen drive as RAM or swap works perfectly fine as it does for me.
From my experience till now, it is really fast if you are adding in small processes(firefox, gimp etc) one by one. You don't feel any hang. But for very heavy ones like starting a virtualbox guest OS, there is a hang although not as much as with the hard disk swap.
 
Old 01-14-2012, 01:02 PM   #5
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
Bad idea. Try instead zram or zcache (better).
 
Old 01-14-2012, 01:09 PM   #6
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,980

Rep: Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625
I have used flash drives a lot. I am not sure you can easily kill them. In a year you just find the old one is too small and you throw it away. I run linux on them all time and use them for moving files. They have proven pretty good. Sheeze. A 4G is like $4.

A linux user sort of re-created the ready boost of windows, I think it was a script they called flash boost or such. Basically it uses flash to store swap.

You should monitor swap once in a while. Modern linux has made great advanced in it's ability to handle ram. Most people don't use swap. You may find it is not as valuable as it once was. Your system and exact use would decide for sure.
 
Old 01-15-2012, 06:56 AM   #7
elvinhaak
LQ Newbie
 
Registered: Jan 2012
Posts: 14

Rep: Reputation: Disabled
Hi,
What about shrinking the amount of data on the HDD, eventually moving the files to the external flash and using the internal HDD for the extra swaps?
What would the performance do in these instances?
I guess the most speed is to gained because the same HDD is not reading the data and writing to swap at the same time, so thus putting the 'static data' on the usb-device would get the most speed out of the system.
I got one of my older systems working way faster this way with an external USB-stick. By the way USB1, internal mem. 400MB, "older" laptop (2003, maybe 2002), 30GB HDD internal, 8 GB external IDE. Mostly works fine alone but with bigger files it likes its extra swap-memory.
Nice tough: large files from wireless network (over USB1 too) open faster in these cases then from internal hdd.
 
Old 01-16-2012, 12:00 PM   #8
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,980

Rep: Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625Reputation: 3625
A real hard drive is almost always faster for many reasons. The point of a usb flash drive is not to replace an internal hard drive. Consider a second drive.

Swap file/partition is not really designed to make a system faster as such, it is designed to allow to too little ram. Get more ram is the solution to that.
 
Old 01-16-2012, 12:09 PM   #9
snowday
Senior Member
 
Registered: Feb 2009
Posts: 4,667

Rep: Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411
Performance-wise, there is an exponential improvement from USB drive to internal HDD, and then again from HDD to RAM.

Therefore if you have a limited budget to improve your computer's performance, maxing the RAM is almost always the best "bang for the buck."
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: EDGE Tech Corp Announces Portable Flash Drive With Muscle - the New 8GB DiskGO!(TM) Now Available; Swap and Go With This Secure Thumb-Sized Flash Drive LXer Syndicated Linux News 0 12-14-2005 02:16 AM
USB Thumb Drive superdude_876 Slackware 2 10-18-2005 07:42 PM
USB Thumb Drive WolfCub Linux - Hardware 18 03-01-2005 09:06 AM
Usb Thumb Drive Crippledzero Linux - Hardware 1 10-07-2004 09:29 PM
USB drive using different partitions (usb key thumb drive) Arodef Linux - Hardware 0 08-04-2004 06:36 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 02:35 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