FLASH disk as swap
Bob Elzer
bob.elzer at gmail.com
Thu Dec 3 09:46:04 MST 2009
Swap is basically hard drive space used so that when your computer wants to
do something in memory and it doesn't have enough space left, it will
suspend and copy some running programs to the swap disk, it doesn't use
regular file system for speed, so it writes big nice even block sizes to the
disk.
Back in the day, you had to figure out, what programs you were running, how
many copies of the program you were running, and figure out how much memory
you were going to use, then double or triple it for the swap space.
Today with memory getting even bigger and bigger, you probably could run
without swap, but programs are using more and more memory too. So you have
to figure out what you'll be running, and again how much memory the app
requires. If you are going to run a large database, you probably want to
have swap so the system doesn't choke.
If the system runs out of memory, it probably going to stop running
programs, then start killing programs, then choke.
Again back in the day, it was probably 2 to 3 time the memory for swap,
today I use 1GB to 2GB, for a regular system, and if I had a large critical
system, I would at least match the memory with swap.
As for using a flash drive as swap, yes it is completely doable.
But the main reason for doing so, is speed, you want to cut down on swap
time.
There are all sorts of flash devices, so you have to figure out the speed
rating of your device, believe me I've used some device that would never
beat the speed of my hard drive. (and it's the write speed that's the
killer)
After that, you are correct, flash drives have a limited lifetime, and after
so many write to a particular address, that address gets marked as not
writable (it theory you could still read it). That's why when using flash as
a file system you want to turn off time stamping everytime you access a
file, because it keeps updating the file tables.
SSD's have logic to try and randomize where the writes take place, spreading
it around so they should last longer. Your everyday little old flash drive
doesn't, so most likely, it will die faster.
So if you are a big company with time critical stuff and need the faster
swapping, get some fast SSD's.
But for just regular use, it's not necessary to swap to flash.
Just do it to prove you can, then go back to regular disk swapping.
:-)
-----Original Message-----
From: plug-discuss-bounces at lists.plug.phoenix.az.us
[mailto:plug-discuss-bounces at lists.plug.phoenix.az.us] On Behalf Of
kitepilot at kitepilot.com
Sent: Thursday, December 03, 2009 9:08 AM
To: Main PLUG discussion list
Subject: Re: FLASH disk as swap
>> swap is generally not needed
This doesn't correlate with my experience...
But then again, my experience can be wrong. :)
What I (believe to) have seen however, is that Linux wants swap no matter
what.
I also tend to abuse the memory though.
Is there an "official" answer for the question "Does a Linux computer need
swap?"
ET
PS: Yo initialize a swap partition with mkswap.
Stephen writes:
> I have run Linux desktops without swap and most of the time it was
> just fine (it had a large amount of ram so i don't think it cared.
>
> but what i understood of the issue now given the large amount of cheap
> ram swap is generally not needed unless a program needs it for a
> graceful moment
>
> On Thu, Dec 3, 2009 at 7:50 AM, Alex Dean <alex at crackpot.org> wrote:
>>
>> On Dec 3, 2009, at 4:40 AM, Marco Savo wrote:
>>
>>> Hello,
>>> I have a *simple* question:
>>> it is possible use a FLASH drive as SWAP?
>>
>> Probably, but why would you want to? For a normal desktop or server,
>> I see a lot of disadvantages and no advantages over putting swap on a
regular HDD.
>> Post up your specific reason for being interested in the question,
>> and we can probably provide better advice. If you really just want
>> to know 'can it be done', I think the answer is "yes, but don't do it".
>>
>>> and which is the best filesistem to use then?
>>> (UBIFS? EXT4?...)
>>
>> A swap partition is its own kind thing. It doesn't have a normal
>> filesystem.
>>
>> alex
>>
>>
>>
>> ---------------------------------------------------
>> PLUG-discuss mailing list - PLUG-discuss at lists.plug.phoenix.az.us
>> To subscribe, unsubscribe, or to change your mail settings:
>> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
>>
>
>
>
> --
> A mouse trap, placed on top of your alarm clock, will prevent you from
> rolling over and going back to sleep after you hit the snooze button.
>
> Stephen
> ---------------------------------------------------
> PLUG-discuss mailing list - PLUG-discuss at lists.plug.phoenix.az.us
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
---------------------------------------------------
PLUG-discuss mailing list - PLUG-discuss at lists.plug.phoenix.az.us
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss
More information about the PLUG-discuss
mailing list