| View previous topic :: View next topic |
| Author |
Message |
serene LXF regular

Joined: Sun Jun 19, 2005 1:43 pm Posts: 101
|
Posted: Sun Apr 14, 2013 7:02 pm Post subject: Log what is being written to swap |
|
|
For a laptop with 16 G memory, that never suspends or hibernates... I'm considering disabling the swap partition.
Could someone please recommend a short bash script to log details for what exactly (if any) activity is being writen to the swap partition ?
Thank you
Serene |
|
| Back to top |
|
 |
purplepenguin
Joined: Wed Oct 05, 2011 3:19 pm Posts: 33 Location: Blissfully at the Command Line
|
Posted: Mon Apr 15, 2013 5:32 pm Post subject: |
|
|
| Code: | | sudo top | grep Swap |
Will output the swap usage to the terminal. It updates every few secs or so.
I just tried | Code: | | sudo top | grep Swap >> swap.txt |
The file swap.txt was created but nothing was written to it?
Hope this helps.
Edit**
I left the command running whilst I had my tea. When I came back there was data written to the file.
You could pop the command in a executable file and create a cron job to run it, or just start it when you want to monitor your swap usage. _________________ Linux Mint 14 64bit Cinnamon and loving it... |
|
| Back to top |
|
 |
nelz Moderator

Joined: Mon Apr 04, 2005 12:52 pm Posts: 8002 Location: Warrington, UK
|
Posted: Mon Apr 15, 2013 11:39 pm Post subject: |
|
|
You don't need to run it with cron, it keeps running the way you have run it and will keep filling the file. By default, it updates every three seconds, which will soon be a lot of data. You can change this with -d.
BTW, top runs as a user, you don't need to use sudo.
You may be better off using a combination of swapon and watch
| Code: | | watch /sbin/swapon -s |
_________________ Unix is user-friendly. It's just very selective about who it's friends are. |
|
| Back to top |
|
 |
serene LXF regular

Joined: Sun Jun 19, 2005 1:43 pm Posts: 101
|
Posted: Wed Apr 17, 2013 9:43 pm Post subject: |
|
|
Thank you both.
This is a little difficult to record due to the swap isn't being used for anything. Which stress test would you use to force the swap to be read and written to .
Thank you.
Serene |
|
| Back to top |
|
 |
nelz Moderator

Joined: Mon Apr 04, 2005 12:52 pm Posts: 8002 Location: Warrington, UK
|
Posted: Wed Apr 17, 2013 9:46 pm Post subject: |
|
|
Loading a shedload of large digital photos into GIMP always does it for me  _________________ Unix is user-friendly. It's just very selective about who it's friends are. |
|
| Back to top |
|
 |
serene LXF regular

Joined: Sun Jun 19, 2005 1:43 pm Posts: 101
|
Posted: Fri Apr 19, 2013 3:01 pm Post subject: |
|
|
Will follow up, thanks.
Cheers
Serene
[SOLVED] |
|
| Back to top |
|
 |
| View previous topic :: View next topic |
|