Minggu, 29 September 2019

How to Add swap memory on Linux Debian 8

  Tidak ada komentar
How to Add swap memory on Linux Debian 8
myuser@openvpn ~$ cat /etc/*ease
PRETTY_NAME="Debian GNU/Linux 8 (jessie)"
NAME="Debian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
ID=debian
HOME_URL="http://www.debian.org/"
SUPPORT_URL="http://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
myuser@openvpn ~$
myuser@openvpn ~$ swapon -s
Filename                                Type            Size    Used    Priority
/dev/dm-1                               partition       524284  188     -1
myuser@openvpn ~$
myuser@openvpn ~$ free -m
             total       used       free     shared    buffers     cached
Mem:          2010       1841        168         40        151       1180
-/+ buffers/cache:        508       1501
Swap:          511          0        511
myuser@openvpn ~$
myuser@openvpn ~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/dm-0        17G  6.0G  9.9G  38% /
udev             10M     0   10M   0% /dev
tmpfs           403M   41M  362M  11% /run
tmpfs          1006M     0 1006M   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs          1006M     0 1006M   0% /sys/fs/cgroup
/dev/sda1       415M  158M  236M  41% /boot
myuser@openvpn ~$
myuser@openvpn ~$ sudo fallocate -l 2G /swapfile
[sudo] password for ecpa:
ecpa@openvpn ~$ ls -lh /swapfile
-rw-r--r-- 1 root root 2.0G Sep 26 14:18 /swapfile
myuser@openvpn ~$
myuser@openvpn ~$ sudo mkswap /swapfile
Setting up swapspace version 1, size = 2097148 KiB
no label, UUID=0282a4d7-26ab-42f9-a3ac-3ca3ad3cdce4
myuser@openvpn ~$
myuser@openvpn ~$ sudo swapon /swapfile
swapon: /swapfile: insecure permissions 0644, 0600 suggested.
myuser@openvpn ~$
myuser@openvpn ~$ sudo chmod 0600 /swapfile
myuser@openvpn ~$
myuser@openvpn ~$ sudo swapon /swapfile
swapon: /swapfile: swapon failed: Device or resource busy
myuser@openvpn ~$
myuser@openvpn ~$ swapon -s
Filename                                Type            Size    Used    Priority
/dev/dm-1                               partition       524284  188     -1
/swapfile                               file            2097148 0       -2
myuser@openvpn ~$
myuser@openvpn ~$ free -m
             total       used       free     shared    buffers     cached
Mem:          2010       1829        180         40        152       1181
-/+ buffers/cache:        495       1514
Swap:         2559          0       2559
myuser@openvpn ~$
myuser@openvpn ~$ sudo vi /etc/fstab
myuser@openvpn ~$
myuser@openvpn ~$ cat /etc/fstab
proc                    /proc   proc    nodev,noexec,nosuid     0       0
/dev/mapper/turnkey-root        /       ext4    errors=remount-ro       0      1
UUID=7b23edb7-a066-4135-b0e7-c7ca87d09d8a       /boot   ext2    defaults       02
/dev/mapper/turnkey-swap_1      none    swap    sw      0       0
/swapfile                                       swap    swap    sw  0   0
myuser@openvpn ~$
myuser@openvpn ~$ cat /proc/sys/vm/swappiness
60
myuser@openvpn ~$

Tidak ada komentar :

Posting Komentar