How to detect if a swap partition is available and active?
I guess the subject line says it. I'm testing out my dad's installation of Yoper, and I think his swap partition is not working. Now I know this is not a Yoper forum, but generally, what would be the procedure to detect if a swap partition was available and working?
Hi, On Saturday 20 August 2005 12:04, Shriramana Sharma wrote:
Now I know this is not a Yoper forum, but generally, what would be the procedure to detect if a swap partition was available and working?
Use the command "free". It will show you if (and how much) swap is active/used. Greetings from Stuhr hartmut
On Saturday 20 August 2005 05:24, Hartmut Meyer wrote:
Hi,
On Saturday 20 August 2005 12:04, Shriramana Sharma wrote:
Now I know this is not a Yoper forum, but generally, what would be the procedure to detect if a swap partition was available and working?
Use the command "free". It will show you if (and how much) swap is active/used.
Or try "/sbin/swapon -s". This will also tell you the device(s) used for swap partitions and the amount of each that is in use.
On Saturday 20 August 2005 12:33, Robert Paulsen wrote:
On Saturday 20 August 2005 05:24, Hartmut Meyer wrote:
Hi,
On Saturday 20 August 2005 12:04, Shriramana Sharma wrote:
Now I know this is not a Yoper forum, but generally, what would be the procedure to detect if a swap partition was available and working?
Use the command "free". It will show you if (and how much) swap is active/used.
Or try "/sbin/swapon -s". This will also tell you the device(s) used for swap partitions and the amount of each that is in use.
Both are good ways of seeing if the kernel thinks it has swap available, but I suspect the only way to see if it's actually working (as in 'no bugs') is to actually allocate enough memory that the kernel starts swapping. A small program that does nothing but allocate memory wouldn't take many seconds to write
On Saturday 20 August 2005 05:55, Anders Johansson wrote:
On Saturday 20 August 2005 12:33, Robert Paulsen wrote:
On Saturday 20 August 2005 05:24, Hartmut Meyer wrote:
Hi,
On Saturday 20 August 2005 12:04, Shriramana Sharma wrote:
Now I know this is not a Yoper forum, but generally, what would be the procedure to detect if a swap partition was available and working?
Use the command "free". It will show you if (and how much) swap is active/used.
Or try "/sbin/swapon -s". This will also tell you the device(s) used for swap partitions and the amount of each that is in use.
Both are good ways of seeing if the kernel thinks it has swap available, but I suspect the only way to see if it's actually working (as in 'no bugs') is to actually allocate enough memory that the kernel starts swapping. A small program that does nothing but allocate memory wouldn't take many seconds to write
It's a little more complicated than you might think but luckily it's been done: wget http://weather.ou.edu/~apw/projects/stress/stress-0.18.7.tar.gz Build it as: tar zxf stress-0.18.7.tar.gz cd stress-0.18.7 ./configure make Run it as: cd src ./stress -m 1 --vm-bytes 1024M --vm-hang 5 -v Observe from a different console: sar -W 2 0 NOTE: 1024M above assumes you have at least 1 Gig of virtual memory to spare. You may want to work your way up from smaller numbers until you see swapper activity with the sar command. If you are not careful you can overrun your available virtual memory.
Thanks, all, for the info! :) Now what does priority -1 mean? I mean, I've heard of priority 1, 2, 3 etc, but *-1*? Thanks again.
On Saturday 20 August 2005 14:53, Robert Paulsen wrote:
Both are good ways of seeing if the kernel thinks it has swap available, but I suspect the only way to see if it's actually working (as in 'no bugs') is to actually allocate enough memory that the kernel starts swapping. A small program that does nothing but allocate memory wouldn't take many seconds to write
It's a little more complicated than you might think
The program you link to looks interesting and useful. But it wasn't what I was talking about. I was talking about allocating memory just to see if the system actually is able to use the swap it claims to be. This is a 5 second job. This program you point to does more than that. But it looks very interesting, and could probably come in handy as a base for a benchmarking tool
On Saturday 20 August 2005 14:06, Anders Johansson wrote:
On Saturday 20 August 2005 14:53, Robert Paulsen wrote:
Both are good ways of seeing if the kernel thinks it has swap available, but I suspect the only way to see if it's actually working (as in 'no bugs') is to actually allocate enough memory that the kernel starts swapping. A small program that does nothing but allocate memory wouldn't take many seconds to write
It's a little more complicated than you might think
The program you link to looks interesting and useful. But it wasn't what I was talking about. I was talking about allocating memory just to see if the system actually is able to use the swap it claims to be. This is a 5 second job. This program you point to does more than that.
Simply allocating the memory does not cause the swapper to be used. Each page of the memory must be also touched. Then, there will still not be much activity if the memory is not touched repeatedly, especially if you want to see both swap in and swap out. You will also see different behavior depending on whether or not the memory is freed and re-allocated. These are all things the program allows you to control, in addition to the other non-memory related stresses it can induce. If you simply allocate the memory you will not be able to observe any swapper activity -- and that was the point of the exercise: to see if the swap system was "working".
But it looks very interesting, and could probably come in handy as a base for a benchmarking tool
On Saturday 20 August 2005 23:52, Robert Paulsen wrote:
Simply allocating the memory does not cause the swapper to be used. Each page of the memory must be also touched.
One also has to declare all variables one uses, and return a value at the end of the program, and change the permissions of the program to allow execution, and.......
Then, there will still not be much activity if the memory is not touched repeatedly, especially if you want to see both swap in and swap out.
That wasn't the object of the exercise at all. I said if you wanted to see if the swap is actually working, not how well it's working, or how performant it is, or how intelligent the algorithm is. I said it was an interesting program, but just to see if swap is actually working, it's overkill
I would switch off the swap partition with "swapoff", then test it r/w whith "badblocks". If it shows to be ok, reformat it with mkswap, and reenable it with swapon. One of course needs enough memory to do this without swapping.. -- Viele Grüße ------------------------------------------------------------------------ Michael Behrens
participants (5)
-
Anders Johansson
-
Hartmut Meyer
-
Michael Behrens
-
Robert Paulsen
-
Shriramana Sharma