luni, 19 noiembrie 2012

despre swap ...


What is swappiness and how do I change it?
The swappiness parameter controls the tendency of the kernel to move processes out of physical memory and onto the swap disk. Because disks are much slower than RAM, this can lead to slower response times for system and applications if processes are too aggressively moved out of memory.

swappiness can have a value of between 0 and 100
swappiness=0 tells the kernel to avoid swapping processes out of physical memory for as long as possible
swappiness=100 tells the kernel to aggressively swap processes out of physical memory and move them to swap cache
The default setting in Ubuntu is swappiness=60. Reducing the default value of swappiness will probably improve overall performance for a typical Ubuntu desktop installation. A value of swappiness=10 is recommended, but feel free to experiment. Note: Ubuntu server installations have different performance requirements to desktop systems, and the default value of 60 is likely more suitable.

To check the swappiness value

cat /proc/sys/vm/swappiness
To change the swappiness value A temporary change (lost on reboot) with a swappiness value of 10 can be made with

sudo sysctl vm.swappiness=10
To make a change permanent, edit the configuration file with your favorite editor:

gksudo gedit /etc/sysctl.conf
Search for vm.swappiness and change its value as desired. If vm.swappiness does not exist, add it to the end of the file like so:

vm.swappiness=10
Save the file and reboot.

What is the priority of swap containers?
The Linux kernel assigns priorities to all swap containers. To see the priorities that the Linux Kernel assigns to all the swap containers use this command.

cat /proc/swaps
Priorities can be changed by using the swapon command or defined in /etc/fstab. Consult the manual page of swapon for more info

man swapon
Should I reinstall with more swap?
Definitely not. With the 2.6 kernel, "a swap file is just as fast as a swap partition."(Wikipedia:Paging, LKML).

Why is my swap not being used?
My swap is not being used! When I issue the free command, it shows something like this:


tom@tom:~$ free
             total       used       free     shared    buffers     cached
Mem:        515980     448664      67316          0      17872     246348
-/+ buffers/cache:     184444     331536
Swap:       674688          0     674688
Note: This regards mainly swap on hard disk partitions, but it could help anyway. In these examples /dev/hda8 is considered as swap.

Swap may not be needed

Start many memory consuming applications (e.g. Gimp, web browsers, OpenOffice etc) and then issue the free command again. Is swap being used now?

Ubuntu Desktop uses Swap to Hibernate (PC off, no power needed, program states saved). If Hibernation is important to you, have more swap space than ram + swap overflow.

Is there a swap partition at all?

Use this command to see all partitions

sudo fdisk -l
You should be able to see something like this in the output

/dev/hda8            4787        4870      674698+  82  Linux swap / Solaris
If not, you either need to create a swapfile or create a swap partition. To create a swap partition you can

boot from your Ubuntu install CD, create a swap partition out of the free space on your hard disk and then interrupt your installation.
use Cfdisk.

Enabling a swap partition

In case you do have a swap partition, there are several ways of enabling it.

Use the following command

cat /etc/fstab
Ensure that there is a line link below. This enables swap on boot.

/dev/hda8       none            swap    sw              0       0
Then disable all swap, recreate it, then re-enable it with the following commands.

sudo swapoff -a
sudo /sbin/mkswap /dev/hda8
sudo swapon -a
Empty Swap
Even if you have lots of RAM and even if you have a low swappiness value, it is possible that your computer swaps. This can hurt the multitasking performance of your desktop system.

You can use the following script to get the swap manually back into RAM:

place the script e.g. /usr/local/sbin:

gksudo gedit /usr/local/sbin/swap2ram.sh
copy&paste the script into the file:



#!/bin/sh

mem=$(free  | awk '/Mem:/ {print $4}')
swap=$(free | awk '/Swap:/ {print $3}')

if [ $mem -lt $swap ]; then
    echo "ERROR: not enough RAM to write swap back, nothing done" >&2
    exit 1
fi

swapoff -a &&
swapon -a
save and close gedit
make the script executable:

sudo chmod +x /usr/local/sbin/swap2ram.sh
execute:

sudo /usr/local/sbin/swap2ram.sh

luni, 5 noiembrie 2012

Xubuntu task manager... refresh

ctrl+alt+del    combinație pentru task manager.... copy paste in terminal

xfconf-query -c xfce4-keyboard-shortcuts -n -p "/commands/custom/<Primary><Alt>Delete" -t string -s "xfce4-taskmanager"


ctrl+alt+r   combinație pentru refresh... copy paste in terminal

xfconf-query -c xfce4-keyboard-shortcuts -n -p "/commands/custom/<Primary><Alt>r" -t string -s "xfwm4 --replace"