Center European Research Science informatics

...because open source matters

  • Increase font size
  • Default font size
  • Decrease font size
Home Swap Memory on Mos 1.0

Swap memory added on the fly !

E-mail Print PDF

Live example of 4GB swap file creation on Cersi Mos64 ...

1.  Check your memory by issuing the command 'free' at the command prompt:

bash-4.3# free
total           used             free      shared   buff/cache    available
Mem:        2030608      350428      421820       43500     1258360     1597776
Swap:       4990728           0            4990728

2. Now first you have to create a swap file and give it a predetermined size(4194304 for example):

bash-4.3# dd if=/dev/zero of=/swap.img bs=1024 count=4194304

4194304+0 records in
4194304+0 records out
4294967296 bytes (4.3 GB) copied, 77.53 s, 55.4 MB/s

3. Format it to swap Memory by issuing the command 'mkswap' at the command prompt:

bash-4.3# mkswap /swap.img
Setting up swapspace version 1, size = 4 GiB (4294963200 bytes)
no label, UUID=98b94892-b53f-426f-a171-2e4bdf89d7b1

4. Ok give it the correct and secure file permission( default is an insecure permissions of 0644) before activation:

bash-4.3# chmod 0600 /swap.img

5. Now finally activate the swap file by issuing the command 'swapon' at the command prompt::

bash-4.3# swapon /swap.img

6. ... and if you have forgot to set correct file permission you will get the following warning

swapon: /swap.img: insecure permissions 0644, 0600 suggested.

Thats just fine just issue the command now ...

bash-4.3# chmod 0600 /swap.img

7. Check your free Memory again:

bash-4.3# free
total           used             free      shared   buff/cache    available
Mem:        2030608      224340       21888       23080     1784380     1743896
Swap:       9185028      154768     9030260
bash-4.3#

... and notice the increased memory in the Swap: from 4990728 to 9185028 !

.... OK read on same story but this time 2GB swap file creation

If for some reason you need temporarily more swap memory just do this at command prompt :

bash-4.2# free
bash-4.2# dd if=/dev/zero of=/swap.img bs=1024 count=2097152
bash-4.2# mkswap /swap.img
bash-4.2# swapon /swap.img

Have fun !

Example : Typing at command prompt you will see something like this ...

bash-4.2# free
total used free shared buffers cached
Mem: 4037400 1616376 2421024 0 129136 684424
-/+ buffers/cache: 802816 3234584
Swap: 2099196 153436 1945760
bash-4.2# dd if=/dev/zero of=/swap.img bs=1024 count=2097152
2097152+0 records in
2097152+0 records out
2147483648 bytes (2.1 GB) copied, 26.0912 s, 82.3 MB/s
bash-4.2# mkswap /swap.img
Setting up swapspace version 1, size = 2097148 KiB
no label, UUID=0ff0b454-9a9c-4528-aa4d-52f8032f271a
bash-4.2# swapon /swap.img
bash-4.2#

Now swap is on and available to the system! Type free at command prompt and compare with above result.

bash-4.2# free
total used free shared buffers cached
Mem: 4037400 2768188 1269212 0 32408 1871052
-/+ buffers/cache: 864728 3172672
Swap: 4196344 171940 4024404
bash-4.2#
Last Updated on Saturday, 19 September 2015 15:52  

Newsflash

PACKAGE NAME:     chkrootkit-0.49-x86_64-1mos
COMPRESSED PACKAGE SIZE:     304K
UNCOMPRESSED PACKAGE SIZE:     960K

chkrootkit: chkrootkit (Check Rootkit)
chkrootkit:
chkrootkit: chkrootkit is a common unix-based program intended to help system
chkrootkit: administrators check their system for known rootkits. It is a shell
chkrootkit: script using common UNIX/Linux tools like the strings and grep
chkrootkit: commands to search core system programs for signatures and for
chkrootkit: comparing a traversal of the /proc filesystem with the output of 
chkrootkit: the ps (process status) command to look for discrepancies.
chkrootkit: