Swapinfo equivalent sought for Raspbian

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

Reply to
bob prohaska
Loading thread data ...

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/
Reply to
Richard Kettlewell

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 The computer obeys and wins. | licences available see You lose and Bill collects. |

formatting link

Reply to
Ahem A Rivet's Shot

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" 
PGP public key available upon request
Reply to
Lew Pitcher

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 The computer obeys and wins. | licences available see You lose and Bill collects. |

formatting link

Reply to
Ahem A Rivet's Shot

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
Reply to
Kees Nuyt

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
Reply to
Kiwi User

I prefer 'swapon --show' myself $ /sbin/swapon --show NAME TYPE SIZE USED PRIO /var/swap file 128M 0B -1

HTH

--
Torfinn Ingolfsen, 
Norway
Reply to
Torfinn Ingolfsen

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

Reply to
bob prohaska

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.