Swapinfo equivalent sought for Raspbian

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
Is there a program equivalent to swapinfo for Rasbian? I'm  
using a Pi3 with the latest version of Rasbian. The machine
is configured to use dphys-swapfile, I've added a USB flash
swap drive and I'd like to see the effect of adding a second
USB flash drive. It's hard to understand what's going on without
some utility to compare usage.

I've tried using apt-get install swapinfo, but it's not found.
Is there something lurking under a different name?

Thanks for reading,

bob prohaska




Re: Swapinfo equivalent sought for Raspbian
Quoted text here. Click to load it

The web suggests that swapinfo is an HP-UX command. Try ?free? on Linux.

$ free
              total        used        free      shared  buff/cache   available
Mem:         444536       26996      123140       35584      294400      349188
Swap:        909308        9020      900288

--  
https://www.greenend.org.uk/rjk/

Re: Swapinfo equivalent sought for Raspbian
Richard Kettlewell wrote:

Quoted text here. Click to load it

And, if that's not enough, the OP can
  /sbin/swapon -s
or
  cat /proc/swaps
to get more info (both report the same info)

  ~ $ /sbin/swapon -s
  Filename                        Type            Size    Used    Priority
  /dev/sda3                       partition       31471328        1180    -1

  ~ $ cat /proc/swaps  
  Filename                        Type            Size    Used    Priority
  /dev/sda3                       partition       31471328        1180    -1

HTH
--  
Lew Pitcher
"In Skills, We Trust"
We've slightly trimmed the long signature. Click to see the full one.
Re: Swapinfo equivalent sought for Raspbian
On 03/01/2018 19:00, Lew Pitcher wrote:
Quoted text here. Click to load it
I prefer 'swapon --show' myself
$ /sbin/swapon --show
NAME      TYPE SIZE USED PRIO
/var/swap file 128M   0B   -1

HTH
--  
Torfinn Ingolfsen,
Norway

Re: Swapinfo equivalent sought for Raspbian
On Thu, 01 Mar 2018 17:38:33 +0000

Quoted text here. Click to load it

    swapinfo (also known as pstat) came from 4.0BSD, both HPUX and
FreeBSD inherited it from there.

--  
Steve O'Hara-Smith                          |   Directable Mirror Arrays
C:\>WIN                                     | A better way to focus the sun
We've slightly trimmed the long signature. Click to see the full one.
Re: Swapinfo equivalent sought for Raspbian
On Thu, 1 Mar 2018 17:27:43 +0000 (UTC)

Quoted text here. Click to load it

    The nearest linux equivalent is probably /usr/bin/free, it also
shows memory usage.

--  
Steve O'Hara-Smith                          |   Directable Mirror Arrays
C:\>WIN                                     | A better way to focus the sun
We've slightly trimmed the long signature. Click to see the full one.
Re: Swapinfo equivalent sought for Raspbian

Quoted text here. Click to load it

The htop utility can show swap usage in text or a bar graph.
apt-get install htop # I think

Active swap I/O can be observed with vmstat, si=swap in, so=swap out.

 $ vmstat 1
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 2  0  78356  35572   7312 828852    0    0     3     1    5    2  1  1 94  4  0
 0  0  78356  35548   7312 828868    0    0     0     0  585  310  2  0 98  0  0
 0  0  78356  35516   7312 828868    0    0     0     0  603  304  4  0 96  0  0
^C

 $ vmstat -s
       949580 K total memory
        77908 K used memory
       416096 K active memory
       439448 K inactive memory
        31540 K free memory
         7304 K buffer memory
       832828 K swap cache
      1048572 K total swap
        78356 K used swap
       970216 K free swap
     11641959 non-nice user cpu ticks
      1224944 nice user cpu ticks
      5878433 system cpu ticks
    850078619 idle cpu ticks
     36563871 IO-wait cpu ticks
            0 IRQ cpu ticks
      1979324 softirq cpu ticks
            0 stolen cpu ticks
   1019055220 pages paged in
    784013486 pages paged out
        33886 pages swapped in
       100472 pages swapped out
   2317299646 interrupts
   1395971095 CPU context switches
   1517672408 boot time
      1935316 forks

Hope this helps,
--  
Regards,
Kees Nuyt

Re: Swapinfo equivalent sought for Raspbian
Quoted text here. Click to load it

Indeed, it does. Thanks to everybody for a wealth of information.
I'm a little chagrined to learn that swapon -s does essentially
what I need.  

bob prohaska


Re: Swapinfo equivalent sought for Raspbian
On Thu, 01 Mar 2018 17:27:43 +0000, bob prohaska wrote:

Quoted text here. Click to load it
If you just want to see whether anything is using swap space, use 'top'.  
Its a standard part of every Raspbian install.

In addition, if a long running program is using swap, top will show you  
enough detail to pick which one it is: any program whose memory quota  
approaches or exceeds the installed RAM size is likely to be the culprit.


--  
Martin    | martin at
Gregorie  | gregorie dot org

Site Timeline