Buscar este blog

viernes, 26 de julio de 2019

CentOS 7 - Increase swap memory


[root@archive ~]# free -m
              total        used        free      shared  buff/cache   available
Mem:           1839         124        1570           8         144        1554
Swap:          1227           0        1227

[root@archive ~]# df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root  9.8G  1.6G  8.3G  17% /
devtmpfs                 909M     0  909M   0% /dev
tmpfs                    920M     0  920M   0% /dev/shm
tmpfs                    920M  8.4M  912M   1% /run
tmpfs                    920M     0  920M   0% /sys/fs/cgroup
/dev/sda1               1014M  143M  872M  15% /boot
tmpfs                    184M     0  184M   0% /run/user/0

[root@archive ~]# dd if=/dev/zero of=/root/vembuswap bs=1M count=2048
2048+0 records in
2048+0 records out
2147483648 bytes (2.1 GB) copied, 24.9862 s, 85.9 MB/s

[root@archive ~]# mv /root/vembuswap /root/customswap

[root@archive ~]# ls -l /root/customswap
-rw-r--r--. 1 root root 2147483648 Jul 26 12:25 /root/customswap

[root@archive ~]# chmod 600 /root/customswap

[root@archive ~]# mkswap /root/customswap
Setting up swapspace version 1, size = 2097148 KiB
no label, UUID=8b5f50f4-3c03-422a-946d-403afbcb3a22

[root@archive ~]# swapon /root/customswap

[root@archive ~]# vi /etc/fstab
Add the following line:
/root/customswap swap   swap    defaults        0 0
 

[root@archive ~]# swapon -s
Filename                                Type            Size    Used    Priority
/dev/dm-1                               partition       1257468 0       -1
/root/customswap                        file    2097148 0       -2

[root@archive ~]# free -m
              total        used        free      shared  buff/cache   available
Mem:           1839         124          76           8        1638        1528
Swap:          3275           0        3275
[root@archive ~]#