swap problem

NaSRi

Verified User
Joined
Aug 16, 2014
Messages
82
Hi guys

I've got a weird problem with my server which has 5 Gig swap space however it shows only 2 Gig by free -m

Do you have any idea?


[root@server ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sr0 11:0 1 1024M 0 rom
vda 252:0 0 55G 0 disk
├─vda1 252:1 0 50.1G 0 part /
└─vda2 252:2 0 5G 0 part [SWAP]



[root@server ~]# free -m
total used free shared buffers cached
Mem: 2006 1929 76 0 9 30
-/+ buffers/cache: 1889 116
Swap: 2047 145 1902
 
You have to identify which causing the swapping in your system.
Use top / htop and check the memory usage.
 
Your (virtual) server is installed with 1 GB of ram resulting in a default of 2x1GB swapspace.
Afterwards your vda2 is expanded to 5GB but the swap fs is not resized.

Usually you'll need a few swapoff, resize2fs, mkswap, swapon commands that might have some different parameters depending on the filesystem you use.

Google 'expand swap partition ext4' (or lvm).
 
Hi guys

I've got a weird problem with my server which has 5 Gig swap space however it shows only 2 Gig by free -m

Do you have any idea?


[root@server ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sr0 11:0 1 1024M 0 rom
vda 252:0 0 55G 0 disk
├─vda1 252:1 0 50.1G 0 part /
└─vda2 252:2 0 5G 0 part [SWAP]



[root@server ~]# free -m
total used free shared buffers cached
Mem: 2006 1929 76 0 9 30
-/+ buffers/cache: 1889 116
Swap: 2047 145 1902

It is weird, are you sure you setup swap correctly. I guess you did wrong configurations while setting up swap :)

I also am using swap for my hosting server and it is displaying correctly what I set.

Following this article https://forumweb.hosting/13622-how-...-memory-(swap-file)-on-linux-vps-systems.html

Hope it helps!
 
Back
Top