[buug] Using swap on an SSD...or not.

Pewter Bot pewterbot9 at gmail.com
Thu Oct 1 00:35:15 PDT 2009


On 9/30/09, Rick Moen <rick at linuxmafia.com> wrote:

{{ However, FWIW, this other gentleman claims to _also_ have a 701SD,
and his view seems to contradict yours: }}

I just simply do not want to muck around with the innards of a cheap
system, is all. Much rather work with external solutions. Do *not*
want to invest more $$$ in this $140 bargain...and that is part of the
challenge I welcome. Besides, that thread seems to be for
accommodating the memory needs of Windoze use...which we all know are
for more demanding than Linux.

What *prompted* me to ask about using swap on an external SDHC card,
was that I read that solid state drives have a limited write capacity
considerably lower than your standard hard drives...significant enough
to be worth the trouble of moving swap off the SSD. Has nothing to do
with excessive swap problems.

{{ Now, _that_ is a different matter.  Obviously, when I was outlining
your alternatives, I had no present knowledge of either how much RAM
you use or even how much physical RAM you had. }}

I did state in my OP, that my RAM is 500MB.

{{ Therefore, all I said was that  _if_ you were hitting swap, then
it's easier to make sure you have enough RAM to not need swap on flash
media. }}

I understand, Rick. But this is also an experiment and learning lesson
for me, on how Linux uses memory, including swap. I will most likely
buy a new SDHC card that is class 6. in lieu of my present, class 2,
card.

{{ If I understand correctly, your next step should be to determine
the answer to that question of fact, rather than assume it. }}

Yes! Per your interesting suggestions, I played around tonight.

{{ You'll want to look at your fstab .

 $ grep swap /etc/fstab
 /dev/sda2       none            swap    sw              0       0 }}

--Here is my report:

Well, "sdc5" is the device label for my SDHC card's swap partition, so
the line would read:

   /dev/sdc5       none            swap    sw              0       0

But it doesn't. Here's my fstab's present swap line:

   # swap was on /dev/sda5 during installation
   UUID=d58c09be-5890-4cd3-93ba-67bb6f01bf3f none            swap    sw

Obviously, Ubuntu uses "universally unique identifier", so I found
this help page:

UUID in Ubuntu 9.04
http://beginlinux.com/blog/2009/04/uuid-in-ubuntu-904/

Which told me to run

  ls -l /dev/disk/by-uuid

to get a list of all UUID partitions. The result:

root at asus701:/home/zeke# ls -l /dev/disk/by-uuid
total 0
lrwxrwxrwx 1 root root 10 2009-09-30 20:47
0ea0b4c6-4437-4357-a8c7-09412d30a62b -> ../../sdc5
lrwxrwxrwx 1 root root 10 2009-09-30 20:15
2c45c835-6d01-42fc-b9f0-462df7362242 -> ../../sda1
lrwxrwxrwx 1 root root 10 2009-09-30 20:15
67eb82e0-86e0-4999-a65f-a29ebe22528d -> ../../sdc1

So I edited fstab's swap line to read:

# New Swap is on SDHC /dev/sdc5
UUID=0ea0b4c6-4437-4357-a8c7-09412d30a62b none            swap    sw

Rebooted, then ran gparted, which tells me that /dev/sdc5 is active as
linux swap. Yay! Further verification: system monitor shows swap to be
760.9mb...instead of zero, when I had no swap. And "vmstat -s" shows
"779112 K free swap".

I set swap size to 780mb. Originally, it was approx. 360mb on
/dev/sda5...I'll see if this increase in size causes any
slowdown...which I understand can be the case when swap is larger than
need be.

[FAST FORWARD]

Okay, now I'm connected via dialup. Firefox runs fine again. Likewise
Synaptics PM. Don't know if this is because swap is working once
again, or just coincidence. Perhaps they like to know swap is there,
and if it is...maybe they got a tad confused, and would have started
working properly again after a few more tries, even w/o resuming
swap...I just don't know enough to figure that out.

System Monitor now reports that I'm using 68% of my 500MBs of
RAM...and using 7.1MB swap space. (Using 100% of my CPU, 900MHz
Celeron BTW.) What do I have running on my Eee PC 701SD at this
moment?

Gnome GUI
Terminal in root, running "pon" dialup app.
Firefox 3.5 (actually "aBrowser")
Treepad Lite (a windoze note taker) via Wine.
Sticky Notes (just one note loaded, barely 100 characters).
System Monitor

So I then add Nautilus to the list of running processes, and notice
that swap increases slightly to 9.1 mb, while RAM very slightly to
69.1%. However, Nautilus uses 10.5MB of RAM according to the processes
list.  But the increase in RAM and swap doesn't even come close. Well,
Nautilus is "sleeping" while I type this, so maybe that's why.

Now, checking out the processes list, interesting to find an app
called "services.exe" !!?!??!!? System Monitor points it to
"C:\windows\system32\services.exe". I assume this is wine, but when I
go to the surrogate C-drive, there is no services.exe under wine's
system32 folder!

OMG...there's also "explorer.exe" and "winedevice.exe", which
processes claims are in the same folder as "services.exe"...but
Nautilus doesn't show them. Well, shutting down Treepad Lite got rid
of 'em, so it's definitely a wine thang. Whew!

Oh, and I'm discovering the world of swappiness now. From this page:

http://www.novell.com/coolsolutions/feature/18990.html

Quote: "The fact that Linux starts using swap space when any physical
memory is left at all may seem very counter-intuitive to most users
(as it did to myself at first). Linux, being a server-oriented
operating system, is by default tuned to deliver high performance to
background applications at the expense of foreground applications.
This means that your word processor, mp3 player, kde desktop manager,
doom3 video game, and any other "foreground" application will start to
be swapped out at the earliest sign of rising memory consumption so
that the system background services can run smoothly. For the average
desktop user, this is almost always not what you want. Short of
turning swap space completely off (which is not recommended), Linux
allows us the ability to fine-tune the likelihood of swap space being
used at all."

Apparently the default swappiness for Ubuntu is 60. I changed it to
10, per that page's instructions. Under the premise that this will
discourage LInux from swapping prematurely...and instead, actually
usuing all remaining RAM before doing any swaps. Let's see how that
goes.

--end report

{{ Well, if you ever get tired of wasting RAM and having to chew up
SDHC cards pointlessly, consider losing the GNOME bloat. }}

I will soon install two or three minimalist GUIs, now that I have a
better grasp of Linux characteristics. Thanks!

{{ Clue:  The more baroque the environment you're running when you
conduct this exercise, the more involved and time-consuming it becomes
to track down what all those obscure processes are. }}

Thanks for all your most helpful suggestions and critiques...and
patience. Believe me, you have accelerated my understanding of Linux
operations immensely. I will be referring to this, your latest
message, quite a few times in the next few weeks.

{{ Me, I'd not have done a text dump on it.  Summary might have been
interesting. }}

You're right, I just got lazy. More serious letters and articles have
been pressing on my cerebellum, so I didn't care to spend additional
thought on summarizing that page. Sorry, but it might happen again,
though I'll try to keep that to a bare minimum!

Time to reboot, and see how that 10 swappiness goes!  :\

-- 
Think Google's kewl? Think again:
http://www.google-watch.org/



More information about the buug mailing list